forked from jquery-archive/jquery-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
203 lines (168 loc) · 7.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# The files to include when compiling the JS files
JSFILES = js/jquery.ui.widget.js \
js/jquery.mobile.widget.js \
js/jquery.mobile.media.js \
js/jquery.mobile.support.js \
js/jquery.mobile.vmouse.js \
js/jquery.mobile.event.js \
js/jquery.mobile.hashchange.js \
js/jquery.mobile.page.js \
js/jquery.mobile.core.js \
js/jquery.mobile.navigation.js \
js/jquery.mobile.navigation.pushstate.js \
js/jquery.mobile.transition.js \
js/jquery.mobile.degradeInputs.js \
js/jquery.mobile.dialog.js \
js/jquery.mobile.page.sections.js \
js/jquery.mobile.collapsible.js \
js/jquery.mobile.fieldContain.js \
js/jquery.mobile.grid.js \
js/jquery.mobile.navbar.js \
js/jquery.mobile.listview.js \
js/jquery.mobile.listview.filter.js \
js/jquery.mobile.nojs.js \
js/jquery.mobile.forms.checkboxradio.js \
js/jquery.mobile.forms.button.js \
js/jquery.mobile.forms.slider.js \
js/jquery.mobile.forms.textinput.js \
js/jquery.mobile.forms.select.custom.js \
js/jquery.mobile.forms.select.js \
js/jquery.mobile.buttonMarkup.js \
js/jquery.mobile.controlGroup.js \
js/jquery.mobile.links.js \
js/jquery.mobile.fixHeaderFooter.js \
js/jquery.mobile.fixHeaderFooter.native.js \
js/jquery.mobile.init.js
# The files to include when compiling the CSS files
CSSFILES = css/structure/jquery.mobile.core.css \
css/structure/jquery.mobile.transitions.css \
css/structure/jquery.mobile.grids.css \
css/structure/jquery.mobile.headerfooter.css \
css/structure/jquery.mobile.navbar.css \
css/structure/jquery.mobile.button.css \
css/structure/jquery.mobile.collapsible.css \
css/structure/jquery.mobile.controlgroup.css \
css/structure/jquery.mobile.dialog.css \
css/structure/jquery.mobile.forms.checkboxradio.css \
css/structure/jquery.mobile.forms.fieldcontain.css \
css/structure/jquery.mobile.forms.select.css \
css/structure/jquery.mobile.forms.textinput.css \
css/structure/jquery.mobile.listview.css \
css/structure/jquery.mobile.forms.slider.css
CSSTHEMEFILES = css/themes/${THEME}/jquery.mobile.theme.css
# Helper Variables
# The command to replace the @VERSION in the files with the actual version
VER = sed "s/v@VERSION/$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd")/"
VER_MIN = "/*! jQuery Mobile v${VER_OFFICIAL} jquerymobile.com | jquery.org/license */"
VER_OFFICIAL = $(shell cat version.txt)
# The output folder for the finished files
OUTPUT = compiled
# The name of the files
NAME = jquery.mobile
STRUCTURE = jquery.mobile.structure
deploy: NAME = jquery.mobile-${VER_OFFICIAL}
deploy: STRUCTURE = jquery.mobile.structure-${VER_OFFICIAL}
# The CSS theme being used
THEME = default
# Build Targets
# When no build target is specified, all gets ran
all: init css js zip notify
# Build and minify the CSS files
css: init
# Build the CSS file with the theme included
@@cat js/jquery.mobile.intro.js | ${VER} > ${OUTPUT}/${NAME}.css
@@cat ${CSSTHEMEFILES} ${CSSFILES} >> ${OUTPUT}/${NAME}.css
# ..... and then minify it
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.css
@@java -jar build/yuicompressor-2.4.6.jar --type css ${OUTPUT}/${NAME}.css >> ${OUTPUT}/${NAME}.min.css
# Build the CSS Structure-only file
@@cat js/jquery.mobile.intro.js | ${VER} > ${OUTPUT}/${STRUCTURE}.css
@@cat ${CSSFILES} >> ${OUTPUT}/${STRUCTURE}.css
# ..... and then minify it
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.structure.min.css
@@java -jar build/yuicompressor-2.4.6.jar --type css ${OUTPUT}/${STRUCTURE}.css >> ${OUTPUT}/${STRUCTURE}.min.css
# ..... and then copy in the images
@@cp -R css/themes/${THEME}/images ${OUTPUT}/
# Css portion is complete.
# -------------------------------------------------
docs: init css js
# Create the Demos/Docs/Tests/Tools
@@mkdir -p tmp/${NAME}
@@cp -r index.html docs experiments external js/jquery.js tests tmp/${NAME}/
@@cp ${OUTPUT}/${NAME}.min.css ${OUTPUT}/${NAME}.min.js tmp/${NAME}/
# ... Update the JavaScript and CSS paths
@@find tmp/${NAME} -type f \
\( -name '*.html' -o -name '*.php' \) \
-exec perl -pi -e \
's|js/"|${NAME}.min.js"|g;s|css/themes/default/|${NAME}.min.css|g;s|js/jquery.js"|jquery.js"|g' {} \;
# ... Move and zip up the the whole folder
@@zip -rq ${OUTPUT}/${NAME}.docs.zip tmp/${NAME}
@@mv tmp/${NAME} ${OUTPUT}/demos
# Finish by removing the temporary files
@@rm -rf tmp
# -------------------------------------------------
# Create the output directory. This is in a separate step so its not dependant on other targets
init:
# -------------------------------------------------
# Building jQuery Mobile in the "${OUTPUT}" folder
@@rm -rf ${OUTPUT}
@@rm -rf tmp
@@mkdir -p ${OUTPUT}
# -------------------------------------------------
# Build and minify the JS files
js: init
# Build the JavaScript file
@@cat js/jquery.mobile.intro.js | ${VER} > ${OUTPUT}/${NAME}.js
@@cat ${JSFILES} >> ${OUTPUT}/${NAME}.js
# ..... and then minify it
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.js
@@java -jar build/google-compiler-20111003.jar --js ${OUTPUT}/${NAME}.js --warning_level QUIET >> ${OUTPUT}/${NAME}.min.js
# -------------------------------------------------
# Output a message saying the process is complete
notify: init
@@echo "The files have been built and are in: " $$(pwd)/${OUTPUT}
# -------------------------------------------------
# Zip up the jQm files without docs
zip: init css js
# Packaging up the files into a zip archive
@@zip -rq ${NAME}.tmp.zip ${OUTPUT}
@@mv ${NAME}.tmp.zip ${OUTPUT}/${NAME}.zip
# -------------------------------------------------
# -------------------------------------------------
# -------------------------------------------------
# -------------------------------------------------
#
# For jQuery Team Use Only
#
# -------------------------------------------------
# Push the latest git version to the CDN. This is done on a post commit hook
latest: init js css zip
# Time to put these on the CDN
@@scp -r ${OUTPUT}/* [email protected]:/var/www/html/code.jquery.com/mobile/latest/
# Do some cleanup to wrap it up
@@rm -rf ${OUTPUT}
# -------------------------------------------------
# Build the nightly backups. This is done on a server cronjob
nightlies: init js css zip docs
# Time to put these on the CDN
@@mkdir -p tmp/nightlies
@@mv ${OUTPUT} tmp/nightlies/$$(date "+%Y%m%d")
@@scp -r tmp/nightlies/* [email protected]:/var/www/html/code.jquery.com/mobile/nightlies/
# Do some cleanup to wrap it up
@@rm -rf tmp
# -------------------------------------------------
# Deploy a finished release. This is manually done.
deploy: init js css docs zip
# Deploying all the files to the CDN
@@mkdir tmp
@@cp -r ${OUTPUT} tmp/${VER_OFFICIAL}
@@scp -r tmp/* [email protected]:/var/www/html/code.jquery.com/mobile/
@@rm -rf tmp/${VER_OFFICIAL}
# Create the Demos/Docs/Tests/Tools for jQueryMobile.com
@@mv ${OUTPUT}/demos tmp/${VER_OFFICIAL}
# ... And copied to the CDN and the jquerymobile.com server
@@scp -r tmp/* [email protected]:/srv/jquerymobile.com/htdocs/demos/
# Do some cleanup to wrap it up
@@rm -rf tmp
@@rm -rf ${OUTPUT}
# -------------------------------------------------