1 # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
3 # For running on Mike's local install of node.js
4 MIKE = PATH=$$PATH:/usr/local/lib/node-v0.10.24-linux-x64/bin
6 APACHE_PORT:= $(shell echo $${APACHE_PORT-4040})
8 #PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html
9 PHANTOMJS_URL=http://localhost:${APACHE_PORT}/jasmine-local-popup.html
13 JASMINE_NODE= ./node_modules/jasmine-node/bin/jasmine-node
14 PHANTOMJS= ./node_modules/phantomjs/bin/phantomjs
16 SCREENSHOT_WIDTH= 360 480 640 768 1024 1200 1440 2048
17 PERL_SCRIPTS= bin/bomb.pl
19 APACHE_HTTPD:= $(shell env PATH=$$PATH:/usr/sbin which apache2 httpd false | head -1 )
24 rm -f mkws-error.png mkws-error.html
27 distclean: clean clean-tmp clean-error
29 rm -f ${TMP_DIR}/jasmine-dev
32 rm -f mkws-error.png.* mkws-error.html.*
37 touch ${TMP_DIR}/.gitkeep
39 mkws-complete-syntax-check:
40 ${MAKE} -C../tools/htdocs mkws-complete.min.js
42 check: mkws-complete-syntax-check
43 @if [ ! -e node_modules ]; then echo "please run first: make node-modules"; exit 1; fi
44 ${JASMINE_NODE} --noColor --captureExceptions --forceexit ./spec
49 $(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
51 phantomjs p: apache-stop apache-start _phantomjs
55 perl ./bin/bomb.pl --timeout="${PHANTOMJS_TIMEOUT}.5" ${PHANTOMJS} phantom/run-jasmine.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
58 $(MAKE) _phantomjs PHANTOMJS_URL=http://x.example.indexdata.com/jasmine-popup.html
61 ${PHANTOMJS} phantom/screenshot.js ${PHANTOMJS_URL} ${IMAGES}/screenshot.png 1200 1000
64 for i in ${SCREENSHOT_WIDTH}; do \
65 ${PHANTOMJS} phantom/screenshot.js http://mkws.indexdata.com ${IMAGES}/mkws-$$i.png $$i 1000 & \
70 for i in ${SCREENSHOT_WIDTH}; do \
71 ${PHANTOMJS} phantom/screenshot.js http://www.indexdata.com ${IMAGES}/indexdata-$$i.png $$i 1000 & \
75 jsbeautifier jsb indent:
76 for i in package.json ./spec*/*.js ./js/*.js ./phantom/*.js; do \
77 jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \
81 @ls ${PERL_SCRIPTS} | xargs -n1 -P16 perl -c 2>/dev/null
82 @ls ${PERL_SCRIPTS} | xargs -n2 -P8 perltidy -b
85 node_modules node-modules:
86 npm install ${NPM_INSTALL_FLAGS}
89 bin/apache-template-update
90 ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev
93 @-if [ -e ${TMP_DIR}/mkws-jasmine.pid ]; then \
94 kill `cat ${TMP_DIR}/mkws-jasmine.pid`; \
96 killall apache2 2> /dev/null; \
99 rm -f ${TMP_DIR}/mkws-jasmine.pid
102 @echo "make [ all | check | clean | distclean ]"
103 @echo " [ phantomjs | screenshot ]"
104 @echo " [ jsbeautifier | perltidy ]"
105 @echo " [ node-modules ]"
106 @echo " [ apache-stop apache-start ]"
108 @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_URL=${PHANTOMJS_URL}"