-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
56 lines (41 loc) · 1.1 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
SRC_DIR = src
TEST_DIR = test
BUILD_DIR = build
PREFIX = .
DIST_DIR = ${PREFIX}/dist
JS_ENGINE ?= `which node nodejs`
COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
ATOLL = ${DIST_DIR}/atoll.js
ATOLL_MIN = ${DIST_DIR}/atoll.min.js
ATOLL_VER = $(shell cat version.txt)
VERSION = sed "s/@ATOLL_VER/${ATOLL_VER}/"
DATE_GIT = $(shell git log -1 --pretty=format:%ad)
ifdef DATE_GIT
DATE = ${DATE_GIT}
else
DATE_HG = $(shell hg tip --template "{date|date}")
DATE = ${DATE_HG}
endif
core: atoll min
@@echo "Atoll built!"
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
atoll : ${ATOLL}
${ATOLL}: ${DIST_DIR}
@@echo "Building" ${ATOLL} ${ATOLL_VER}
@@cat lib/atoll.js | \
sed 's/@TIP_DATE/'"${DATE}"'/' | \
${VERSION} > ${ATOLL};
min: atoll ${ATOLL_MIN}
${ATOLL_MIN}: ${ATOLL}
@@if test ! -z ${JS_ENGINE}; then \
echo "Minifying Atoll" ${ATOLL_MIN}; \
${COMPILER} ${ATOLL} > ${ATOLL_MIN}.tmp; \
cp ${ATOLL_MIN}.tmp ${ATOLL_MIN}; \
rm -f ${ATOLL_MIN}.tmp; \
else \
echo "You need NodeJS installed to minify Atoll"; \
fi
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}