-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (50 loc) · 1.4 KB
/
Makefile
File metadata and controls
73 lines (50 loc) · 1.4 KB
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
70
71
72
73
BUILD_DIR = build
PREFIX = .
SRC_DIR = ${PREFIX}
DIST_DIR = ${PREFIX}/dist
JS_ENGINE ?= `which node nodejs 2> /dev/null`
COMPILER = ../node_modules/.bin/uglifyjs -c unsafe
POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
SRC = ${SRC_DIR}/jsonselect.js
DIST = ${DIST_DIR}/jsonselect.js
DIST_MIN = ${DIST_DIR}/jsonselect.min.js
all: hint project min tests
@@echo "Project build complete."
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
project: ${DIST}
${DIST}: ${SRC} | ${DIST_DIR}
@@echo "Building" ${DIST}
@@echo ${SRC}
@@cat ${SRC} > ${DIST};
min: project ${DIST_MIN}
${DIST_MIN}: ${DIST}
@@if test ! -z ${JS_ENGINE}; then \
echo "Minifying Project" ${DIST_MIN}; \
${COMPILER} ${DIST} > ${DIST_MIN}.tmp; \
${POST_COMPILER} ${DIST_MIN}.tmp > ${DIST_MIN}; \
rm -f ${DIST_MIN}.tmp; \
else \
echo "You must have NodeJS installed in order to minify Project."; \
fi
hint:
@@if test ! -z ${JS_ENGINE}; then \
echo "Hinting Project"; \
../node_modules/.bin/jshint jsonselect.js; \
else \
echo "Nodejs is missing"; \
fi
test/tests/README.md:
@@cd .. && git submodule init
@@cd .. && git submodule update
tests: test/tests/README.md
@@if test ! -z ${JS_ENGINE}; then \
echo "Testing Project"; \
${JS_ENGINE} test/run.js; \
else \
echo "nodejs is missing"; \
fi
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}
.PHONY: all project hint min tests