Tagging the 1.7.1rc1 release.
[jquery.git] / Makefile
blobb33fc2ab8b701033a701ba92ec2b6c0393617c2d
1 SRC_DIR = src
2 TEST_DIR = test
3 BUILD_DIR = build
5 PREFIX = .
6 DIST_DIR = ${PREFIX}/dist
8 JS_ENGINE ?= `which node nodejs 2>/dev/null`
9 COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
10 POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
12 BASE_FILES = ${SRC_DIR}/core.js\
13 ${SRC_DIR}/callbacks.js\
14 ${SRC_DIR}/deferred.js\
15 ${SRC_DIR}/support.js\
16 ${SRC_DIR}/data.js\
17 ${SRC_DIR}/queue.js\
18 ${SRC_DIR}/attributes.js\
19 ${SRC_DIR}/event.js\
20 ${SRC_DIR}/selector.js\
21 ${SRC_DIR}/traversing.js\
22 ${SRC_DIR}/manipulation.js\
23 ${SRC_DIR}/css.js\
24 ${SRC_DIR}/ajax.js\
25 ${SRC_DIR}/ajax/jsonp.js\
26 ${SRC_DIR}/ajax/script.js\
27 ${SRC_DIR}/ajax/xhr.js\
28 ${SRC_DIR}/effects.js\
29 ${SRC_DIR}/offset.js\
30 ${SRC_DIR}/dimensions.js\
31 ${SRC_DIR}/exports.js
33 MODULES = ${SRC_DIR}/intro.js\
34 ${BASE_FILES}\
35 ${SRC_DIR}/outro.js
37 JQ = ${DIST_DIR}/jquery.js
38 JQ_MIN = ${DIST_DIR}/jquery.min.js
40 SIZZLE_DIR = ${SRC_DIR}/sizzle
42 JQ_VER = $(shell cat version.txt)
43 VER = sed "s/@VERSION/${JQ_VER}/"
45 DATE=$(shell git log -1 --pretty=format:%ad)
47 all: update_submodules core
49 core: jquery min lint size
50 @@echo "jQuery build complete."
52 ${DIST_DIR}:
53 @@mkdir -p ${DIST_DIR}
55 jquery: ${JQ}
57 ${JQ}: ${MODULES} | ${DIST_DIR}
58 @@echo "Building" ${JQ}
60 @@cat ${MODULES} | \
61 sed 's/.function..jQuery...{//' | \
62 sed 's/}...jQuery..;//' | \
63 sed 's/@DATE/'"${DATE}"'/' | \
64 ${VER} > ${JQ};
66 ${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
67 @@echo "Building selector code from Sizzle"
68 @@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
70 lint: jquery
71 @@if test ! -z ${JS_ENGINE}; then \
72 echo "Checking jQuery against JSLint..."; \
73 ${JS_ENGINE} build/jslint-check.js; \
74 else \
75 echo "You must have NodeJS installed in order to test jQuery against JSLint."; \
78 size: jquery min
79 @@if test ! -z ${JS_ENGINE}; then \
80 gzip -c ${JQ_MIN} > ${JQ_MIN}.gz; \
81 wc -c ${JQ} ${JQ_MIN} ${JQ_MIN}.gz | ${JS_ENGINE} ${BUILD_DIR}/sizer.js; \
82 rm ${JQ_MIN}.gz; \
83 else \
84 echo "You must have NodeJS installed in order to size jQuery."; \
87 freq: jquery min
88 @@if test ! -z ${JS_ENGINE}; then \
89 ${JS_ENGINE} ${BUILD_DIR}/freq.js; \
90 else \
91 echo "You must have NodeJS installed to report the character frequency of minified jQuery."; \
94 min: jquery ${JQ_MIN}
96 ${JQ_MIN}: ${JQ}
97 @@if test ! -z ${JS_ENGINE}; then \
98 echo "Minifying jQuery" ${JQ_MIN}; \
99 ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
100 ${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \
101 rm -f ${JQ_MIN}.tmp; \
102 else \
103 echo "You must have NodeJS installed in order to minify jQuery."; \
106 clean:
107 @@echo "Removing Distribution directory:" ${DIST_DIR}
108 @@rm -rf ${DIST_DIR}
110 @@echo "Removing built copy of Sizzle"
111 @@rm -f src/selector.js
113 distclean: clean
114 @@echo "Removing submodules"
115 @@rm -rf test/qunit src/sizzle
117 # change pointers for submodules and update them to what is specified in jQuery
118 # --merge doesn't work when doing an initial clone, thus test if we have non-existing
119 # submodules, then do an real update
120 update_submodules:
121 @@if [ -d .git ]; then \
122 if git submodule status | grep -q -E '^-'; then \
123 git submodule update --init --recursive; \
124 else \
125 git submodule update --init --recursive --merge; \
126 fi; \
129 # update the submodules to the latest at the most logical branch
130 pull_submodules:
131 @@git submodule foreach "git pull \$$(git config remote.origin.url)"
132 @@git submodule summary
134 pull: pull_submodules
135 @@git pull ${REMOTE} ${BRANCH}
137 .PHONY: all jquery lint min clean distclean update_submodules pull_submodules pull core