5 PROJECT_NAME = tizen-web-ui-fw
8 PKG_VERSION = $(shell cat packaging/web-ui-fw.spec | grep Version: | sed -e "s@Version:\s*@@" )
11 PATH := $(CURDIR)/build-tools/bin:$(PATH)
14 JSLINT = jslint --sloppy --eqeq --bitwise --forin --nomen --predef jQuery --color --plusplus --browser --jqmspace --regexp --continue
15 COMMON_WIDGET = common
17 OUTPUT_ROOT = $(CURDIR)/build
18 FRAMEWORK_ROOT = ${OUTPUT_ROOT}/${PROJECT_NAME}/${VERSION}
20 LATEST_ROOT = ${OUTPUT_ROOT}/${PROJECT_NAME}/latest
22 JS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/js
23 export THEME_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/themes
24 CSS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/themes/${THEME_NAME}
25 CSS_IMAGES_OUTPUT_DIR = ${CSS_OUTPUT_ROOT}/images
26 WIDGET_CSS_OUTPUT_ROOT = ${FRAMEWORK_ROOT}/widget-css
27 PROTOTYPE_HTML_OUTPUT_DIR = proto-html
29 WIDGETS_DIR = $(CURDIR)/src/widgets
31 THEMES_DIR = $(CURDIR)/src/themes
32 LIBS_DIR = $(CURDIR)/libs
34 COPYING_FILE = $(CURDIR)/COPYING
39 INSTALL_DIR = ${DESTDIR}${PREFIX}
41 FW_JS = ${JS_OUTPUT_ROOT}/${PROJECT_NAME}.js
42 FW_MIN = $(subst .js,.min.js,$(FW_JS))
43 FW_LIB_JS = ${JS_OUTPUT_ROOT}/${PROJECT_NAME}-libs.js
44 FW_LIB_MIN = $(subst .js,.min.js,$(FW_LIB_JS))
46 FW_JS_THEME = ${JS_OUTPUT_ROOT}/${PROJECT_NAME}-${THEME_NAME}-theme.js
47 FW_CSS = ${CSS_OUTPUT_ROOT}/${PROJECT_NAME}-theme.css
48 FW_LIBS_JS = ${JS_OUTPUT_ROOT}/${PROJECT_NAME}-libs.js
49 FW_THEME_CSS_FILE = ${PROJECT_NAME}-theme.css
50 FW_WIDGET_CSS_FILE = ${WIDGET_CSS_OUTPUT_ROOT}/${PROJECT_NAME}-widget.css
52 LIBS_JS_FILES = jquery.easing.1.3.js \
57 JQUERY_MOBILE_CSS = submodules/jquery-mobile/compiled/jquery.mobile.structure.css \
58 submodules/jquery-mobile/compiled/jquery.mobile.css \
60 JQUERY_MOBILE_IMAGES = submodules/jquery-mobile/css/themes/default/images
62 JQM_VERSION = jquery-mobile-1.2.0
63 JQM_LIB_PATH = $(CURDIR)/libs/js/${JQM_VERSION}
65 JQUERY = jquery-1.8.2.js
66 JQUERY_MIN = $(subst .js,.min.js,$(JQUERY))
68 all: libs_prepare third_party widgets libs_cleanup loader themes version version_compat compress
71 # Prepare libs/ build...
72 @@test -d ${LIBS_DIR}.bak && rm -rf ${LIBS_DIR} && mv ${LIBS_DIR}.bak ${LIBS_DIR}; \
73 cp -a ${LIBS_DIR} ${LIBS_DIR}.bak
74 for f in `ls ${LIBS_DIR}/patch/*.patch`; do \
76 echo "Apply patch: $$f"; \
77 cat $$f | patch -p1 -N; \
81 # Cleanup libs/ directory...
82 @@rm -rf ${LIBS_DIR} && mv ${LIBS_DIR}.bak ${LIBS_DIR}
85 # Building jQuery Mobile...
86 cd ${JQM_LIB_PATH} && make js NODE=/usr/bin/node || exit 1; \
87 cp -f ${JQM_LIB_PATH}/compiled/*.js ${JQM_LIB_PATH}/../; \
90 # Building third party components...
91 @@cd ${LIBS_DIR}/js; \
92 for f in ${LIBS_JS_FILES}; do \
93 cat $$f >> ${FW_LIB_JS}; \
94 uglifyjs --ascii $$f >> ${FW_LIB_MIN}; \
95 echo "" >> ${FW_LIB_MIN}; \
97 cp ${LIBS_DIR}/js/${JQUERY} ${JS_OUTPUT_ROOT}/jquery.js
98 cp ${LIBS_DIR}/js/${JQUERY_MIN} ${JS_OUTPUT_ROOT}/jquery.min.js
100 widgets: init third_party
101 # Building widgets...
102 @@ls -l ${WIDGETS_DIR} | grep '^d' | awk '{print $$NF;}' | \
103 while read REPLY; do \
104 echo " # Building widget $$REPLY"; \
105 if test ${JSLINT_LEVEL} -ge 1; then \
106 if test $$REPLY != ${COMMON_WIDGET}; then \
107 for FNAME in ${WIDGETS_DIR}/$$REPLY/js/*.js; do \
109 if test ${JSLINT_LEVEL} -ge 2 -a $$? -ne 0; then \
115 if test "x${INLINE_PROTO}x" = "x1x"; then \
116 ./tools/inline-protos.sh ${WIDGETS_DIR}/$$REPLY >> ${WIDGETS_DIR}/$$REPLY/js/$$REPLY.js.compiled; \
117 cat ${WIDGETS_DIR}/$$REPLY/js/$$REPLY.js.compiled >> ${FW_JS}; \
119 for f in `find ${WIDGETS_DIR}/$$REPLY -iname 'js/*.js' | sort`; do \
121 cat $$f >> ${FW_JS}; \
124 for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.js.theme' | sort`; do \
126 cat $$f >> ${FW_JS_THEME}; \
128 for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.less' | sort`; do \
130 lessc $$f > $$f.css; \
132 for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.css' | sort`; do \
134 cat $$f >> ${FW_CSS}; \
136 for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.gif' -or -iname '*.png' -or -iname '*.jpg' | sort`; do \
138 cp $$f ${CSS_IMAGES_OUTPUT_DIR}; \
140 if test "x${INLINE_PROTO}x" != "x1x"; then \
141 for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.prototype.html' | sort`; do \
143 cp $$f ${PROTOTYPE_HTML_OUTPUT_DIR}; \
149 loader: widgets globalize
150 cat 'src/loader/loader.js' >> ${FW_JS}
154 cat 'libs/js/globalize/lib/globalize.js' >> ${FW_JS}
155 # copy globalize libs...
156 cp -a libs/js/globalize/lib/cultures ${FRAMEWORK_ROOT}/js/
160 make -C src/themes || exit $?
162 version: loader themes
163 echo '(function($$){$$.tizen.frameworkData.pkgVersion="$(PKG_VERSION)";}(jQuery));' >> ${FW_JS}
164 echo "$(PKG_VERSION)" > ${FRAMEWORK_ROOT}/../VERSION
166 compress: widgets loader themes
167 # Javacript code compressing
168 @@echo " # Compressing...."; \
169 echo '/*' > ${FW_MIN}; \
170 cat ${COPYING_FILE} >> ${FW_MIN}; \
171 echo '*/' >> ${FW_MIN}; \
172 uglifyjs --ascii -nc ${FW_JS} >> ${FW_MIN}; \
174 @@cd ${THEME_OUTPUT_ROOT}; \
175 for csspath in */*.css; do \
176 echo "Compressing $$csspath"; \
177 cleancss -o $${csspath/%.css/.min.css} $$csspath; \
182 # Building documentation...
183 @@hash docco 2>&1 /dev/null || (echo "docco not found. Please see README."; exit 1); \
184 ls -l ${WIDGETS_DIR} | grep '^d' | awk '{print $$NF;}' | \
185 while read REPLY; do \
186 echo " # Building docs for widget $$REPLY"; \
187 for f in `find ${WIDGETS_DIR}/$$REPLY -iname '*.js' | sort`; do \
188 docco $$f > /dev/null; \
191 cp docs/docco.custom.css docs/docco.css; \
192 cat docs/index.header > docs/index.html; \
193 for f in `find docs -name '*.html' -not -name index.html | sort`; do \
194 echo "<li><a href=\"$$(basename $$f)\">$$(basename $$f .html)</a></li>" >> docs/index.html; \
196 cat docs/index.footer >> docs/index.html
199 version_compat: third_party widgets
200 # Creating compatible version dirs...
201 for v_compat in ${VERSION_COMPAT}; do \
202 ln -sf ${VERSION} ${FRAMEWORK_ROOT}/../$$v_compat; \
204 ln -sf ${VERSION} ${FRAMEWORK_ROOT}/../latest
207 mkdir -p ${OUTPUT_ROOT}/demos
208 cp -av demos/* ${OUTPUT_ROOT}/demos/
209 cp -f src/template/bootstrap.js ${OUTPUT_ROOT}/demos/gallery/
213 mkdir -p ${INSTALL_DIR}/bin ${INSTALL_DIR}/share/tizen-web-ui-fw/demos/ ${INSTALL_DIR}/share/tizen-web-ui-fw/bin/
214 cp -av ${OUTPUT_ROOT}/tizen-web-ui-fw/* src/template ${INSTALL_DIR}/share/tizen-web-ui-fw/
215 cp -av tools/* ${INSTALL_DIR}/share/tizen-web-ui-fw/bin/
216 cp -av demos/tizen-winsets ${INSTALL_DIR}/share/tizen-web-ui-fw/demos/ && cd ${INSTALL_DIR}/share/tizen-web-ui-fw/demos/tizen-winsets && sed -i -e "s#../../build#../../..#g" *.html
220 # Checking unit test coverage
221 $(CURDIR)/tests/coverage/instrument.sh
225 # Creating tarball...
227 TMPDIR=$$(mktemp -d tarball.XXXXXXXX); \
228 DESTDIR=$${TMPDIR}/${PROJECT_NAME}; \
230 if test "x${DEBUG}x" = "xnox"; then \
233 TARBALL=${PROJECT_NAME}-${VERSION}-`date +%Y%m%d`$${MIN}.tar.gz; \
234 mkdir -p $${DESTDIR}; \
237 ${THEMES_OUTPUT_ROOT}/tizen/${FW_THEME_CSS_FILE} \
238 ${FW_WIDGET_CSS_FILE} \
239 ${THEMES_OUTPUT_ROOT}/tizen/images \
244 hash git 2>&1 /dev/null && touch $${DESTDIR}/$$(git log | head -n 1 | awk '{print $$2;}'); \
248 --exclude='*.less.css' \
249 --exclude='*.js.compiled' \
250 --exclude='submodules/jquery-mobile' \
251 --exclude='${JQUERY}' \
252 -C $${TMPDIR} ${PROJECT_NAME}; \
257 # Removing destination directory...
258 @@rm -rf ${OUTPUT_ROOT}
259 # Remove generated files...
260 @@rm -f `find . -iname *.less.css`
261 @@rm -f `find . -iname *.js.compiled`
265 # Check build environment...
266 @@hash lessc 2>/dev/null || (echo "lessc not found. Please see HACKING."; exit 1); \
269 @@mkdir -p ${JS_OUTPUT_ROOT}
270 @@mkdir -p ${THEME_OUTPUT_ROOT}
271 @@mkdir -p ${CSS_OUTPUT_ROOT}
272 @@mkdir -p ${CSS_IMAGES_OUTPUT_DIR}
273 @@mkdir -p ${PROTOTYPE_HTML_OUTPUT_DIR}