forked from crossbario/autobahn-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (48 loc) · 1.44 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
SRC_DIR = src
TEST_DIR = test
BUILD_DIR = build
PREFIX = .
DIST_DIR = ${PREFIX}/dist
JS_ENGINE ?= `which node nodejs 2>/dev/null`
COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
MODULES = ${SRC_DIR}/autobahn.js
AB = ${DIST_DIR}/autobahn.js
AB_MIN = ${DIST_DIR}/autobahn.min.js
AB_VER = $(shell cat version.txt)
VER = sed "s/@VERSION/${AB_VER}/"
DATE=$(shell git log -1 --pretty=format:%ad)
all: core
core: autobahn min hint
@@echo "AutobahnJS build complete."
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
autobahn: ${AB}
${AB}: ${MODULES} | ${DIST_DIR}
@@echo "Building" ${AB}
@@cat ${MODULES} | \
sed 's/.function..AutobahnJS...{//' | \
sed 's/}...AutobahnJS..;//' | \
sed 's/@DATE/'"${DATE}"'/' | \
${VER} > ${AB};
hint: autobahn
@@if test ! -z ${JS_ENGINE}; then \
echo "Checking AutobahnJS against JSHint..."; \
${JS_ENGINE} build/jshint-check.js; \
else \
echo "You must have NodeJS installed in order to test AutobahnJS against JSHint."; \
fi
min: autobahn ${AB_MIN}
${AB_MIN}: ${AB}
@@if test ! -z ${JS_ENGINE}; then \
echo "Minifying AutobahnJS" ${AB_MIN}; \
${COMPILER} ${AB} > ${AB_MIN}.tmp; \
${POST_COMPILER} ${AB_MIN}.tmp; \
rm -f ${AB_MIN}.tmp; \
else \
echo "You must have NodeJS installed in order to minify AutobahnJS."; \
fi
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}
.PHONY: all autobahn hint min clean