forked from web-ui-fw/web-ui-fw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
224 lines (204 loc) · 7.23 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
DEBUG ?= yes
PROJECT_NAME = web-ui-fw
VERSION = 0.1.8
VERSION_COMPAT =
INLINE_PROTO = 1
OUTPUT_ROOT = $(CURDIR)/build
FRAMEWORK_ROOT = ${OUTPUT_ROOT}/${PROJECT_NAME}/${VERSION}
LATEST_ROOT = ${OUTPUT_ROOT}/${PROJECT_NAME}/latest
JS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/js
THEMES_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/themes
WIDGET_CSS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/widget-css
PROTOTYPE_HTML_OUTPUT_DIR = proto-html
WIDGETS_DIR = $(CURDIR)/src/widgets
THEMES_DIR = $(CURDIR)/src/themes
LIBS_DIR = $(CURDIR)/libs
DESTDIR ?=
PREFIX ?= /usr
INSTALL_DIR = ${DESTDIR}${PREFIX}
FW_JS = ${JS_OUTPUT_ROOT}/${PROJECT_NAME}.js
FW_LIBS_JS = ${JS_OUTPUT_ROOT}/${PROJECT_NAME}-libs.js
FW_THEME_CSS_FILE = ${PROJECT_NAME}-theme.css
FW_WIDGET_CSS_FILE = ${WIDGET_CSS_OUTPUT_ROOT}/${PROJECT_NAME}-widget.css
LIBS_JS_FILES = jlayout/jquery.sizes.js \
jlayout/jlayout.border.js \
jlayout/jlayout.grid.js \
jlayout/jlayout.flexgrid.js \
jlayout/jlayout.flow.js \
jlayout/jquery.jlayout.js \
$(NULL)
JQUERY = submodules/jquery-mobile/js/jquery.js
JQUERY_MOBILE = submodules/jquery-mobile/compiled/jquery.mobile.js
JQUERY_MOBILE_CSS = submodules/jquery-mobile/compiled/jquery.mobile.structure.css \
submodules/jquery-mobile/compiled/jquery.mobile.css \
$(NULL)
JQUERY_MOBILE_IMAGES = submodules/jquery-mobile/css/themes/default/images
all: third_party_widgets widgets widget_styling themes
widget_styling: init
# Building non-theme-specific styling for web-ui-fw widgets...
@@rm -f ${FW_WIDGET_CSS_FILE}; \
for w in `find ${WIDGETS_DIR} -maxdepth 1 -mindepth 1 -type d`; do \
for l in `find $$w -iname *.less`; do \
echo " # Compiling CSS from "`basename $$l`; \
lessc $$l > $$l.css; \
done; \
for c in `find $$w -iname *.css`; do \
cat $$c >> ${FW_WIDGET_CSS_FILE}; \
done; \
done
third_party_widgets: init
# Building third party components...
@@uglify=cat; \
if test "x${DEBUG}x" = "xnox" && hash uglifyjs 2>/dev/null; then \
echo " # uglifyjs enabled"; \
uglify="uglifyjs -nc"; \
fi; \
cd ${LIBS_DIR}/js; \
rm -f ${FW_LIBS_JS}; \
for f in ${LIBS_JS_FILES}; do \
cat $$f | $${uglify} >> ${FW_LIBS_JS}; \
done; \
cat ${LIBS_DIR}/js/${JQUERY} | $${uglify} > ${JS_OUTPUT_ROOT}/jquery.js ; \
cat ${LIBS_DIR}/js/${JQUERY_MOBILE} | $${uglify} > ${JS_OUTPUT_ROOT}/jquery-mobile.js; \
if test "x${DEBUG}x" = "xyesx"; then \
mkdir -p $(CURDIR)/dist; \
cp -a ${FW_LIBS_JS} $(CURDIR)/dist/; \
fi
widgets: init
# Building web-ui-fw widgets...
@@uglify=cat; \
if test "x${DEBUG}x" = "xnox" && hash uglifyjs 2>/dev/null; then \
echo " # uglifyjs enabled"; \
uglify="uglifyjs -nc"; \
fi; \
rm -f ${FW_JS}; \
ls -l ${WIDGETS_DIR} | grep '^d' | awk '{print $$NF;}' | \
while read REPLY; do \
echo " # Building widget $$REPLY"; \
if test "x${INLINE_PROTO}x" = "x1x"; then \
./tools/inline-protos.sh ${WIDGETS_DIR}/$$REPLY > ${WIDGETS_DIR}/$$REPLY/js/$$REPLY.js.compiled; \
cat ${WIDGETS_DIR}/$$REPLY/js/$$REPLY.js.compiled | $${uglify} >> ${FW_JS}; \
else \
for f in `find ${WIDGETS_DIR}/$$REPLY/js -iname '*.js' | sort`; do \
echo " $$f"; \
cat $$f | $${uglify} >> ${FW_JS}; \
done; \
fi; \
done; \
if test "x${DEBUG}x" = "xyesx"; then \
mkdir -p $(CURDIR)/dist; \
cp -a ${FW_JS} $(CURDIR)/dist/; \
fi
docs: init
# Building documentation...
@@hash docco 2>&1 /dev/null || (echo "docco not found. Please see README."; exit 1); \
ls -l ${WIDGETS_DIR} | grep '^d' | awk '{print $$NF;}' | \
while read REPLY; do \
echo " # Building docs for widget $$REPLY"; \
for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.js' | sort`; do \
docco $$f > /dev/null; \
done; \
done; \
cp docs/docco.custom.css docs/docco.css; \
cat docs/index.header > docs/index.html; \
for f in `find docs -name '*.html' -not -name index.html | sort`; do \
echo "<li><a href=\"$$(basename $$f)\">$$(basename $$f .html)</a></li>" >> docs/index.html; \
done; \
cat docs/index.footer >> docs/index.html
themes: widget_styling jqm_theme
# Building web-ui-fw themes...
@@cd ${THEMES_DIR}; \
for f in `find ${THEMES_DIR} -maxdepth 1 -mindepth 1 -type d`; do \
outbasename=`basename $$f`; \
outdir=${THEMES_OUTPUT_ROOT}/$$outbasename; \
mkdir -p $$outdir/images; \
cp -a $$f/images/* $$outdir/images/; \
for l in `find $$f -iname *.less` ; do \
lessc $$l > $$l.css; \
done; \
if test "x$${outbasename}x" != "xdefaultx"; then \
rm -f $$outdir/${FW_THEME_CSS_FILE}; \
fi; \
for c in `find $$f -iname *.css` ; do \
cat $$c >> $$outdir/${FW_THEME_CSS_FILE}; \
done; \
cp -a ${FW_WIDGET_CSS_FILE} $$outdir/ ; \
if test "x${INLINE_PROTO}x" != "x1x"; then \
mkdir -p $$outdir/${PROTOTYPE_HTML_OUTPUT_DIR}; \
for f in `find ${WIDGETS_DIR} -iname '*.prototype.html' | sort`; do \
cp $$f $$outdir/${PROTOTYPE_HTML_OUTPUT_DIR}; \
done; \
fi; \
done; \
if test "x${DEBUG}x" = "xyesx"; then \
mkdir -p $(CURDIR)/dist; \
cp -a ${FW_WIDGET_CSS_FILE} $(CURDIR)/dist/; \
fi
jqm_theme: init
# Adding images to jqm theme...
@@mkdir -p ${THEMES_OUTPUT_ROOT}/default/images
@@cp -a ${LIBS_DIR}/js/${JQUERY_MOBILE_IMAGES}/* ${THEMES_OUTPUT_ROOT}/default/images
# Adding CSS to jqm theme...
@@rm -f ${THEMES_OUTPUT_ROOT}/default/${FW_THEME_CSS_FILE}; \
for f in ${JQUERY_MOBILE_CSS}; do \
cat ${LIBS_DIR}/js/$$f >> ${THEMES_OUTPUT_ROOT}/default/${FW_THEME_CSS_FILE}; \
done;
version_compat: third_party_widgets widgets
# Creating compatible version dirs...
for v_compat in ${VERSION_COMPAT}; do \
ln -sf ${VERSION} ${FRAMEWORK_ROOT}/../$$v_compat; \
done;
install: all
# Nothing to install, but left here to support Debian packaging
mkdir -p ${INSTALL_DIR}/share/slp-web-fw ${INSTALL_DIR}/bin
cp -av tools/* ${INSTALL_DIR}/bin
coverage: clean all
# Checking unit test coverage
$(CURDIR)/tests/coverage/instrument.sh
dist: clean all docs
# Creating tarball...
@@ \
TMPDIR=$$(mktemp -d tarball.XXXXXXXX); \
DESTDIR=$${TMPDIR}/${PROJECT_NAME}; \
MIN=''; \
if test "x${DEBUG}x" = "xnox"; then \
MIN='.min'; \
fi; \
TARBALL=${PROJECT_NAME}-${VERSION}-`date +%Y%m%d`$${MIN}.tar.gz; \
mkdir -p $${DESTDIR}; \
cp -a ${FW_JS} \
${FW_LIBS_JS} \
${THEMES_OUTPUT_ROOT}/tizen/${FW_THEME_CSS_FILE} \
${FW_WIDGET_CSS_FILE} \
${THEMES_OUTPUT_ROOT}/tizen/images \
docs \
README.md \
COPYING \
$${DESTDIR}; \
hash git 2>&1 /dev/null && touch $${DESTDIR}/$$(git log | head -n 1 | awk '{print $$2;}'); \
tar cfzps \
$${TARBALL} \
--exclude='.git' \
--exclude='*.less.css' \
--exclude='*.js.compiled' \
--exclude='submodules/jquery-mobile' \
--exclude='${JQUERY}' \
-C $${TMPDIR} ${PROJECT_NAME}; \
rm -rf $${TMPDIR}
clean:
# Removing destination directory...
@@rm -rf ${OUTPUT_ROOT}
# Remove generated files...
@@rm -f `find . -iname *.less.css`
@@rm -f `find . -iname *.js.compiled`
@@rm -f docs/*.html
init:
# Checking for JQM
@@[ -e ${LIBS_DIR}/js/${JQUERY_MOBILE} ] || (echo "You must compile jquery-mobile first. See HACKING."; exit 1;)
# Checking for lessc
@@hash lessc 2>/dev/null || (echo "lessc not found. Please see HACKING."; exit 1); \
# Initializing...
@@mkdir -p ${JS_OUTPUT_ROOT}
@@mkdir -p ${THEMES_OUTPUT_ROOT}
@@mkdir -p ${WIDGET_CSS_OUTPUT_ROOT}
@@test -h ${LATEST_ROOT} || ln -s ${FRAMEWORK_ROOT} ${LATEST_ROOT}