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)
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)
75 $(call clone_or_pull, ${SIZZLE_DIR}, git://github.com/jeresig/sizzle.git)
77 init: ${QUNIT_DIR} ${SIZZLE_DIR}
82 ${JQ}: ${MODULES} | ${DIST_DIR}
83 @@echo "Building" ${JQ}
86 sed 's/.function..jQuery...{//' | \
87 sed 's/}...jQuery..;//' | \
88 sed 's/@DATE/'"${DATE}"'/' | \
91 ${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
92 @@echo "Building selector code from Sizzle"
93 @@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
96 @@if test ! -z ${JS_ENGINE}; then \
97 echo "Checking jQuery against JSLint..."; \
98 ${JS_ENGINE} build/jslint-check.js; \
100 echo "You must have NodeJS installed in order to test jQuery against JSLint."; \
106 @@if test ! -z ${JS_ENGINE}; then \
107 echo "Minifying jQuery" ${JQ_MIN}; \
108 ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
109 sed '$ s#^\( \*/\)\(.\+\)#\1\n\2;#' ${JQ_MIN}.tmp > ${JQ_MIN}; \
110 rm -rf ${JQ_MIN}.tmp; \
112 echo "You must have NodeJS installed in order to minify jQuery."; \
117 @@echo "Removing Distribution directory:" ${DIST_DIR}
120 @@echo "Removing built copy of Sizzle"
121 @@rm -f src/selector.js
123 @@echo "Removing cloned directories"
124 @@rm -rf test/qunit src/sizzle
126 .PHONY: all jquery lint min init jq clean