8 DIST_DIR = ${PREFIX}/dist
10 JS_ENGINE ?= `which node nodejs`
11 COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
13 BASE_FILES = ${SRC_DIR}/core.js\
14 ${SRC_DIR}/support.js\
17 ${SRC_DIR}/attributes.js\
19 ${SRC_DIR}/selector.js\
20 ${SRC_DIR}/traversing.js\
21 ${SRC_DIR}/manipulation.js\
24 ${SRC_DIR}/ajax/jsonp.js\
25 ${SRC_DIR}/ajax/script.js\
26 ${SRC_DIR}/ajax/xhr.js\
27 ${SRC_DIR}/effects.js\
29 ${SRC_DIR}/dimensions.js
31 MODULES = ${SRC_DIR}/intro.js\
35 JQ = ${DIST_DIR}/jquery.js
36 JQ_MIN = ${DIST_DIR}/jquery.min.js
38 SIZZLE_DIR = ${SRC_DIR}/sizzle
39 QUNIT_DIR = ${TEST_DIR}/qunit
41 JQ_VER = $(shell cat version.txt)
42 VER = sed "s/@VERSION/${JQ_VER}/"
44 DATE=$(shell git log -1 --pretty=format:%ad)
46 all: init jquery min lint
47 @@echo "jQuery build complete."
50 @@mkdir -p ${DIST_DIR}
52 ifeq ($(strip $(V)),0)
54 else ifeq ($(strip $(V)),1)
61 -@@if test ! -d $(strip ${1})/.git; then \
62 echo "Cloning $(strip ${1})..."; \
63 git clone $(strip ${verbose}) --depth=1 $(strip ${2}) $(strip ${1}); \
65 echo "Pulling $(strip ${1})..."; \
66 git --git-dir=$(strip ${1})/.git pull $(strip ${verbose}) origin master; \
72 $(call clone_or_pull, ${QUNIT_DIR}, git://github.com/jquery/qunit.git)
73 $(call clone_or_pull, ${SIZZLE_DIR}, git://github.com/jeresig/sizzle.git)
78 ${JQ}: ${MODULES} | ${DIST_DIR}
79 @@echo "Building" ${JQ}
82 sed 's/.function..jQuery...{//' | \
83 sed 's/}...jQuery..;//' | \
84 sed 's/@DATE/'"${DATE}"'/' | \
87 ${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
88 @@echo "Building selector code from Sizzle"
89 @@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
92 @@echo "Checking jQuery against JSLint..."
93 @@${JS_ENGINE} build/jslint-check.js
98 @@echo "Building" ${JQ_MIN}
99 @@${COMPILER} ${JQ} > ${JQ_MIN}.tmp
100 @@echo ";" >> ${JQ_MIN}.tmp
101 @@sed 's/\*\/(/*\/ʩ(/' ${JQ_MIN}.tmp | tr "ʩ" "\n" > ${JQ_MIN}
102 @@rm -rf ${JQ_MIN}.tmp
105 @@echo "Removing Distribution directory:" ${DIST_DIR}
108 @@echo "Removing built copy of Sizzle"
109 @@rm -f src/selector.js
111 @@echo "Removing cloned directories"
112 @@rm -rf test/qunit src/sizzle
114 .PHONY: all jquery lint min init jq clean