-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
68 lines (58 loc) · 2.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# XB PointStream Makefile
#
# You must specify a version when running make:
# make VERSION=0.1
# create a clean release directory and copy in the release documents
release: create-release-dir create-release-files
VERSION ?= $(error Specify a version for your release (e.g., make VERSION=0.1))
# final files to release
create-release-files: create-release-docs create-user-docs minify create-example zip-min
# Minification strips out comments and most whitespace
minify: create-release-dir
cat psapi.js ./libs/mjs.js ./parsers/asc.js ./parsers/pts.js ./parsers/psi.js ./parsers/ply.js ./parsers/psi2.js ./parsers/hps0.js > ./xbps-min/xbps-temp.js
rm -fr tools-bin
mkdir tools-bin/
cc -o tools-bin/minifier tools/jsmin.c
./tools-bin/minifier < ./xbps-min/xbps-temp.js > ./xbps-min/xbps-min-${VERSION}.js
rm ./xbps-min/xbps-temp.js
rm -fr ./tools-bin
#
zip-min: minify
zip -r ./xbps-min/xbps-min-${VERSION}.zip ./xbps-min
mv ./xbps-min/xbps-min-${VERSION}.js .
mv ./xbps-min/xbps-min-${VERSION}.zip .
rm -fr ./xbps-min
mkdir ./xbps-min
mv xbps-min-${VERSION}.js ./xbps-min/xbps-min-${VERSION}.js
mv xbps-min-${VERSION}.zip ./xbps-min/xbps-min-${VERSION}.zip
# Create a simple example
create-example: create-release-dir
mkdir ./xbps-min/clouds
cp ./clouds/acorn.asc ./xbps-min/clouds
echo "<html>" > ./xbps-min/example.html
echo " <head>" >> ./xbps-min/example.html
echo " <script src=\"xbps-min-${VERSION}.js\"></script>" >> ./xbps-min/example.html
echo " <script src=\"example.js\"></script>" >> ./xbps-min/example.html
echo " </head>" >> ./xbps-min/example.html
echo " <body onLoad=\"start();\">" >> ./xbps-min/example.html
echo " <canvas id=\"canvas\" style=\"border: 1px solid black;\" width=\"400\" height=\"400\"></canvas>" >>./xbps-min/example.html
echo " <pre>" >> ./xbps-min/example.html
cat example.js >> ./xbps-min/example.html
echo " </pre>" >> ./xbps-min/example.html
echo " </body>" >> ./xbps-min/example.html
echo "</html>" >> ./xbps-min/example.html
cp example.js ./xbps-min/
# Create user documentation
create-user-docs: create-release-dir
./tools/jsdoc-toolkit/gendocs.sh 0
# Copy over the documents into the release directory
create-release-docs: create-release-dir
cp AUTHORS ./xbps-min
cp README.md ./xbps-min
cp LICENSE ./xbps-min
#
create-release-dir: clean
mkdir ./xbps-min/
# remove the release directory and its contents
clean:
rm -fr ./xbps-min/