forked from jaubourg/ajaxHooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (71 loc) · 2.43 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
BASE_FILES = $(shell ${JS_ENGINE} ${BUILD_DIR}/get_modules.js ${BUILD_DIR}/data/modules.json ${SRC_DIR})
MODULES = ${BUILD_DIR}/data/intro.js\
${BASE_FILES}\
${BUILD_DIR}/data/outro.js
AH = ${DIST_DIR}/jquery-ajaxhooks.js
AH_MIN = ${DIST_DIR}/jquery-ajaxhooks.min.js
AH_VER = $(shell cat ${BUILD_DIR}/data/version.txt)
VER = sed "s/@VERSION/${AH_VER}/"
DATE=$(shell git log -1 --pretty=format:%ad)
all: update_submodules core
core: ajaxHooks min lint
@@echo "jQuery ajaxHooks build complete."
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
ajaxHooks: ${AH}
${AH}: ${MODULES} | ${DIST_DIR}
@@echo "Building" ${AH}
@@cat ${MODULES} | \
sed 's/.function..jQuery...{//' | \
sed 's/}...jQuery..;//' | \
sed 's/@DATE/'"${DATE}"'/' | \
${VER} > ${AH};
lint: ajaxHooks
@@if test ! -z ${JS_ENGINE}; then \
echo "Checking jQuery ajaxHooks against JSLint..."; \
${JS_ENGINE} build/jslint-check.js; \
else \
echo "You must have NodeJS installed in order to test jQuery ajaxHooks against JSLint."; \
fi
min: ajaxHooks ${AH_MIN}
${AH_MIN}: ${AH}
@@if test ! -z ${JS_ENGINE}; then \
echo "Minifying jQuery ajaxHooks" ${AH_MIN}; \
${COMPILER} ${AH} > ${AH_MIN}.tmp; \
${POST_COMPILER} ${AH_MIN}.tmp > ${AH_MIN}; \
rm -f ${AH_MIN}.tmp; \
else \
echo "You must have NodeJS installed in order to minify jQuery ajaxHooks."; \
fi
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}
distclean: clean
@@echo "Removing submodules"
@@rm -rf test/qunit
# change pointers for submodules and update them to what is specified in ajaxHooks
# --merge doesn't work when doing an initial clone, thus test if we have non-existing
# submodules, then do an real update
update_submodules:
@@if [ -d .git ]; then \
if git submodule status | grep -q -E '^-'; then \
git submodule update --init --recursive; \
else \
git submodule update --init --recursive --merge; \
fi; \
fi;
# update the submodules to the latest at the most logical branch
pull_submodules:
@@git submodule foreach "git pull \$$(git config remote.origin.url)"
@@git submodule summary
pull: pull_submodules
@@git pull ${REMOTE} ${BRANCH}
.PHONY: all ajaxHooks lint min clean distclean update_submodules pull_submodules pull core