X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=blobdiff_plain;f=Makefile;h=48a885da28e05dbab58f390c862f2c5544c375c1;hp=e1e69212f3a54106480da1bb96f6f1c59c75f027;hb=8d8db3f2b3f8c3d41854726c8a0227f6deecc602;hpb=b2e96801165e20822dd535525260f96d9199ac67 diff --git a/Makefile b/Makefile index e1e6921..48a885d 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,30 @@ +V ?= 0 + SRC_DIR = src +TEST_DIR = test BUILD_DIR = build PREFIX = . -TEST_DIR = ${PREFIX}/test DIST_DIR = ${PREFIX}/dist -SPEED_DIR = ${PREFIX}/speed + +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}/data.js\ + ${SRC_DIR}/queue.js\ + ${SRC_DIR}/attributes.js\ ${SRC_DIR}/event.js\ - ${SRC_DIR}/support.js\ ${SRC_DIR}/selector.js\ ${SRC_DIR}/traversing.js\ - ${SRC_DIR}/attributes.js\ ${SRC_DIR}/manipulation.js\ ${SRC_DIR}/css.js\ ${SRC_DIR}/ajax.js\ - ${SRC_DIR}/fx.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 @@ -27,70 +35,92 @@ MODULES = ${SRC_DIR}/intro.js\ JQ = ${DIST_DIR}/jquery.js JQ_MIN = ${DIST_DIR}/jquery.min.js -JQ_VER = `cat version.txt` -VER = sed s/@VERSION/${JQ_VER}/ +SIZZLE_DIR = ${SRC_DIR}/sizzle +QUNIT_DIR = ${TEST_DIR}/qunit -MINJAR = java -jar ${BUILD_DIR}/yuicompressor-2.4.2.jar +JQ_VER = $(shell cat version.txt) +VER = sed "s/@VERSION/${JQ_VER}/" -DATE=`svn info . | grep Date: | sed 's/.*: //g'` -REV=`svn info . | grep Rev: | sed 's/.*: //g'` +DATE=$(shell git log -1 --pretty=format:%ad) -all: jquery test min speed +all: jquery min lint @@echo "jQuery build complete." ${DIST_DIR}: @@mkdir -p ${DIST_DIR} -jquery: ${DIST_DIR} ${JQ} +ifeq ($(strip $(V)),0) +verbose = --quiet +else ifeq ($(strip $(V)),1) +verbose = +else +verbose = --verbose +endif -${JQ}: ${MODULES} - @@echo "Building" ${JQ} +define clone_or_pull +-@@if test ! -d $(strip ${1})/.git; then \ + echo "Cloning $(strip ${1})..."; \ + git clone $(strip ${verbose}) --depth=1 $(strip ${2}) $(strip ${1}); \ + else \ + echo "Pulling $(strip ${1})..."; \ + git --git-dir=$(strip ${1})/.git pull $(strip ${verbose}) origin master; \ + fi - @@mkdir -p ${DIST_DIR} - @@cat ${MODULES} | \ - sed 's/Date:./&'"${DATE}"'/' | \ - sed 's/Revision:./&'"${REV}"'/' | \ - ${VER} > ${JQ}; +endef - @@echo ${JQ} "Built" - @@echo +${QUNIT_DIR}: + $(call clone_or_pull, ${QUNIT_DIR}, git://github.com/jquery/qunit.git) -min: ${JQ_MIN} +${SIZZLE_DIR}: + $(call clone_or_pull, ${SIZZLE_DIR}, git://github.com/jeresig/sizzle.git) -${JQ_MIN}: ${JQ} - @@echo "Building" ${JQ_MIN} +init: ${QUNIT_DIR} ${SIZZLE_DIR} - @@echo " - Compressing using Minifier" - @@${MINJAR} ${JQ} > ${JQ_MIN} +jquery: init ${JQ} +jq: init ${JQ} - @@echo ${JQ_MIN} "Built" - @@echo +${JQ}: ${MODULES} | ${DIST_DIR} + @@echo "Building" ${JQ} -test: ${JQ} - @@echo "Building Test Suite" - @@echo "Test Suite Built" - @@echo - git submodule init - git submodule update + @@cat ${MODULES} | \ + sed 's/.function..jQuery...{//' | \ + sed 's/}...jQuery..;//' | \ + sed 's/@DATE/'"${DATE}"'/' | \ + ${VER} > ${JQ}; -speed: ${JQ} - @@echo "Building Speed Test Suite" +${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 - @@echo " - Making Speed Test Suite Directory:" ${SPEED_DIR} - @@mkdir -p ${SPEED_DIR} +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 - @@echo " - Copying over script files." - @@cp -f ${BUILD_DIR}/speed/index.html ${SPEED_DIR} - @@cp -f ${BUILD_DIR}/speed/benchmarker.css ${SPEED_DIR} - @@cp -f ${BUILD_DIR}/speed/benchmarker.js ${SPEED_DIR} - @@cp -f ${BUILD_DIR}/speed/jquery-basis.js ${SPEED_DIR} +min: ${JQ_MIN} - @@echo "Speed Test Suite Built" - @@echo +${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} @@rm -rf ${DIST_DIR} - @@echo "Removing Speed Test Suite directory:" ${SPEED_DIR} - @@rm -rf ${SPEED_DIR} + @@echo "Removing built copy of Sizzle" + @@rm -f src/selector.js + + @@echo "Removing cloned directories" + @@rm -rf test/qunit src/sizzle + +.PHONY: all jquery lint min init jq clean