Simplified getting the commit date using git log --pretty. Fixed missing date in...
[jquery.git] / Makefile
1 SRC_DIR = src
2 BUILD_DIR = build
3
4 PREFIX = .
5 DIST_DIR = ${PREFIX}/dist
6
7 BASE_FILES = ${SRC_DIR}/core.js\
8         ${SRC_DIR}/support.js\
9         ${SRC_DIR}/data.js\
10         ${SRC_DIR}/queue.js\
11         ${SRC_DIR}/attributes.js\
12         ${SRC_DIR}/event.js\
13         ${SRC_DIR}/selector.js\
14         ${SRC_DIR}/traversing.js\
15         ${SRC_DIR}/manipulation.js\
16         ${SRC_DIR}/css.js\
17         ${SRC_DIR}/ajax.js\
18         ${SRC_DIR}/effects.js\
19         ${SRC_DIR}/offset.js\
20         ${SRC_DIR}/dimensions.js
21
22 MODULES = ${SRC_DIR}/intro.js\
23         ${BASE_FILES}\
24         ${SRC_DIR}/outro.js
25
26 JQ = ${DIST_DIR}/jquery.js
27 JQ_MIN = ${DIST_DIR}/jquery.min.js
28
29 JQ_VER = `cat version.txt`
30 VER = sed s/@VERSION/${JQ_VER}/
31
32 RHINO = java -jar ${BUILD_DIR}/js.jar
33 MINJAR = java -jar ${BUILD_DIR}/google-compiler-20091218.jar
34
35 DATE=`git log -1 --pretty=format:%ad`
36
37 all: jquery lint min
38         @@echo "jQuery build complete."
39
40 ${DIST_DIR}:
41         @@mkdir -p ${DIST_DIR}
42
43 init:
44         @@echo "Grabbing external dependencies..."
45         @@if test ! -d test/qunit/.git; then git clone git://github.com/jquery/qunit.git test/qunit; fi
46         @@if test ! -d src/sizzle/.git; then git clone git://github.com/jeresig/sizzle.git src/sizzle; fi
47         - @@cd src/sizzle && git pull origin master > /dev/null 2>&1
48         - @@cd test/qunit && git pull origin master > /dev/null 2>&1
49
50 jquery: ${DIST_DIR} selector ${JQ}
51 jq: ${DIST_DIR} ${JQ}
52
53 ${JQ}: selector ${MODULES}
54         @@echo "Building" ${JQ}
55
56         @@mkdir -p ${DIST_DIR}
57
58         @@cat ${MODULES} | \
59                 sed 's/Date:./&'"${DATE}"'/' | \
60                 ${VER} > ${JQ};
61
62 selector: ${DIST_DIR} init
63         @@echo "Building selector code from Sizzle"
64         @@sed '/EXPOSE/r src/sizzle-jquery.js' src/sizzle/sizzle.js | grep -v window.Sizzle > src/selector.js
65
66 lint: ${JQ}
67         @@echo "Checking jQuery against JSLint..."
68         @@${RHINO} build/jslint-check.js
69
70 min: ${JQ_MIN}
71
72 ${JQ_MIN}: ${JQ}
73         @@echo "Building" ${JQ_MIN}
74
75         @@head -15 ${JQ} > ${JQ_MIN}
76         @@${MINJAR} --js ${JQ} --warning_level QUIET >> ${JQ_MIN}
77
78 clean:
79         @@echo "Removing Distribution directory:" ${DIST_DIR}
80         @@rm -rf ${DIST_DIR}
81
82         @@echo "Removing built copy of Sizzle"
83         @@rm src/selector.js
84
85         @@echo "Removing cloned directories"
86         @@rm -rf test/qunit src/sizzle