PREFIX = .
DIST_DIR = ${PREFIX}/dist
-RHINO ?= java -jar ${BUILD_DIR}/js.jar
-
-CLOSURE_COMPILER = ${BUILD_DIR}/google-compiler-20100917.jar
-
-MINJAR ?= java -jar ${CLOSURE_COMPILER}
+JS_ENGINE ?= `which node nodejs`
+COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
BASE_FILES = ${SRC_DIR}/core.js\
${SRC_DIR}/support.js\
${SRC_DIR}/manipulation.js\
${SRC_DIR}/css.js\
${SRC_DIR}/ajax.js\
- ${SRC_DIR}/xhr.js\
- ${SRC_DIR}/transports/jsonp.js\
- ${SRC_DIR}/transports/script.js\
- ${SRC_DIR}/transports/xhr.js\
+ ${SRC_DIR}/ajax/jsonp.js\
+ ${SRC_DIR}/ajax/script.js\
+ ${SRC_DIR}/ajax/xhr.js\
${SRC_DIR}/effects.js\
${SRC_DIR}/offset.js\
${SRC_DIR}/dimensions.js
DATE=$(shell git log -1 --pretty=format:%ad)
-all: init jquery min lint
+all: jquery min lint
@@echo "jQuery build complete."
${DIST_DIR}:
endef
-init:
+${QUNIT_DIR}:
$(call clone_or_pull, ${QUNIT_DIR}, git://github.com/jquery/qunit.git)
+
+${SIZZLE_DIR}:
$(call clone_or_pull, ${SIZZLE_DIR}, git://github.com/jeresig/sizzle.git)
-jquery: ${JQ}
-jq: ${JQ}
+init: ${QUNIT_DIR} ${SIZZLE_DIR}
-${JQ}: ${MODULES} ${DIST_DIR}
+jquery: init ${JQ}
+jq: init ${JQ}
+
+${JQ}: ${MODULES} | ${DIST_DIR}
@@echo "Building" ${JQ}
@@cat ${MODULES} | \
sed 's/.function..jQuery...{//' | \
sed 's/}...jQuery..;//' | \
- sed 's/Date:./&'"${DATE}"'/' | \
+ sed 's/@DATE/'"${DATE}"'/' | \
${VER} > ${JQ};
${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
@@echo "Building selector code from Sizzle"
@@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
-lint: ${JQ}
- @@echo "Checking jQuery against JSLint..."
- @@${RHINO} build/jslint-check.js
+lint: jquery
+ @@if test ! -z ${JS_ENGINE}; then \
+ echo "Checking jQuery against JSLint..."; \
+ ${JS_ENGINE} build/jslint-check.js; \
+ else \
+ echo "You must have NodeJS installed in order to test jQuery against JSLint."; \
+ fi
min: ${JQ_MIN}
-${JQ_MIN}: ${JQ}
- @@echo "Building" ${JQ_MIN}
-
- @@head -15 ${JQ} > ${JQ_MIN}
- @@${MINJAR} --js ${JQ} --warning_level QUIET --js_output_file ${JQ_MIN}.tmp
- @@cat ${JQ_MIN}.tmp >> ${JQ_MIN}
- @@rm -f ${JQ_MIN}.tmp
+${JQ_MIN}: jquery
+ @@if test ! -z ${JS_ENGINE}; then \
+ echo "Minifying jQuery" ${JQ_MIN}; \
+ ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
+ sed '$ s#^\( \*/\)\(.\+\)#\1\n\2;#' ${JQ_MIN}.tmp > ${JQ_MIN}; \
+ rm -rf ${JQ_MIN}.tmp; \
+ else \
+ echo "You must have NodeJS installed in order to minify jQuery."; \
+ fi
+
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}