forked from rdallasgray/roto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
69 lines (57 loc) · 1.7 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
69
PROJECT = Roto
SRC_DIR = src
BUILD_DIR = .
DEMO_DIR = demo
MAIN = jquery.roto
BEZ = lib/bez/jquery.bez.min.js
JS_ENGINE ?= `which node nodejs`
COMPILER ?= `which uglifyjs`
VERSION = $(shell git describe --tags --long | sed s/\-/\./)
YEAR = $(shell date +"%Y")
all: main min bez copy_demo clean
nomin: main bez clean
main: submodules version
submodules:
@@echo "Updating submodules"
@@git submodule init
@@git submodule update
@@git submodule foreach "git checkout master"
@@git submodule foreach "git pull"
@@git submodule summary
version:
@@echo "Setting version number (${VERSION}) and year (${YEAR})"
@@sed 's/@VERSION/${VERSION}/' <${SRC_DIR}/${MAIN}.js | sed 's/@YEAR/${YEAR}/' > ${BUILD_DIR}/${MAIN}.tmp
min:
@@if test ! -z ${JS_ENGINE} && test ! -z ${COMPILER}; then \
echo "Minifying ${PROJECT}"; \
${COMPILER} ${BUILD_DIR}/${MAIN}.tmp > ${BUILD_DIR}/${MAIN}.min.js; \
else \
echo "You must have NodeJS and UglifyJS installed in order to minify ${PROJECT}."; exit 2;\
fi
bez:
@@echo "Attaching Bez to Roto"
@@cp ${BEZ} ${BUILD_DIR}/${MAIN}.tmp
@@cat ${BUILD_DIR}/${MAIN}.min.js >> ${BUILD_DIR}/${MAIN}.tmp
@@echo ";" >> ${BUILD_DIR}/${MAIN}.tmp
@@cp ${BUILD_DIR}/${MAIN}.tmp ${BUILD_DIR}/${MAIN}.min.js
copy_demo:
@@echo "Copying ${MAIN}.min.js to ${DEMO_DIR}"
@@cp ${BUILD_DIR}/${MAIN}.min.js ${DEMO_DIR}
clean:
@@echo "Removing temp files"
@@rm -f ${BUILD_DIR}/${MAIN}.tmp
@@echo "Done"
pages:
@@echo "Updating gh-pages"
@@git checkout gh-pages
@@rm -Rf lib
@@git archive master -o tmp.zip /demo
@@unzip tmp.zip
@@cp -R demo/* .
@@rm tmp.zip
@@rm -Rf demo
@@git add *
@@git commit -a -m "Updated demo to ${VERSION}"
@@git push origin gh-pages
@@git checkout master
@@echo "Done"