1 # Copyright (c) 2013-2014 Index Data 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_PATH=jasmine-local-popup.html
10 PHANTOMJS_URL=http://localhost:${APACHE_PORT}/${PHANTOMJS_PATH}
14 JASMINE_NODE= ./node_modules/jasmine-node/bin/jasmine-node
15 PHANTOMJS= ./node_modules/phantomjs/bin/phantomjs
17 SCREENSHOT_WIDTH= 360 480 640 768 1024 1200 1440 2048
18 PERL_SCRIPTS= bin/bomb.pl
20 APACHE_HTTPD:= $(shell env PATH=$$PATH:/usr/sbin which apache2 httpd false | head -1 )
26 rm -f mkws-error.png mkws-error.html
28 ${MAKE} -C./widgets $@
30 distclean: clean clean-tmp clean-error
35 rm -f mkws-error.png.* mkws-error.html.*
40 touch ${TMP_DIR}/.gitkeep
42 mkws-complete-syntax-check:
43 ${MAKE} -C../src ../tools/htdocs/mkws-complete.min.js
45 check check-js: mkws-complete-syntax-check
46 @if [ ! -e node_modules ]; then echo "please run first: make node-modules"; exit 1; fi
47 ${JASMINE_NODE} --noColor --captureExceptions --forceexit ./spec
52 $(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
54 phantomjs p: apache-stop apache-start _phantomjs
58 perl ./bin/bomb.pl --timeout="${PHANTOMJS_TIMEOUT}.5" ${PHANTOMJS} phantom/run-jasmine.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
61 ${MAKE} phantomjs PHANTOMJS_PATH=jasmine-local-popup.html
62 ${MAKE} phantomjs PHANTOMJS_PATH=jasmine-popup.html
63 ${MAKE} phantomjs PHANTOMJS_PATH=jasmine-cors-popup.html
64 ${MAKE} phantomjs PHANTOMJS_PATH=jasmine.html
67 $(MAKE) _phantomjs PHANTOMJS_URL=http://x.example.indexdata.com/jasmine-popup.html
70 ${PHANTOMJS} phantom/screenshot.js ${PHANTOMJS_URL} ${IMAGES}/screenshot.png 1200 1000
73 for i in ${SCREENSHOT_WIDTH}; do \
74 ${PHANTOMJS} phantom/screenshot.js http://mkws.indexdata.com ${IMAGES}/mkws-$$i.png $$i 1000 & \
79 for i in ${SCREENSHOT_WIDTH}; do \
80 ${PHANTOMJS} phantom/screenshot.js http://www.indexdata.com ${IMAGES}/indexdata-$$i.png $$i 1000 & \
85 ${MAKE} -C ./widgets $@
87 jsbeautifier jsb indent:
88 for i in package.json ./spec*/*.js ./js/*.js ./phantom/*.js; do \
89 jsbeautifier -j $$i > $@.tmp && mv -f $@.tmp $$i; \
93 @ls ${PERL_SCRIPTS} | xargs -n1 -P16 perl -c 2>/dev/null
94 @ls ${PERL_SCRIPTS} | xargs -n2 -P8 perltidy -b
97 node_modules node-modules:
98 npm install ${NPM_INSTALL_FLAGS}
101 bin/apache-template-update
102 ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev-${APACHE_PORT}.conf
104 APACHE_PID_FILE=${TMP_DIR}/mkws-jasmine-${APACHE_PORT}.pid
106 @-if [ -e ${APACHE_PID_FILE} ]; then \
107 kill `cat ${APACHE_PID_FILE}`; \
109 killall apache2 2> /dev/null; \
112 rm -f ${APACHE_PID_FILE}
115 @echo "make [ all | check | clean | distclean ]"
116 @echo " [ phantomjs | phantomjs-all ]"
117 @echo " [ jsbeautifier | perltidy | screenshot ]"
118 @echo " [ screenshots ]"
119 @echo " [ node-modules ]"
120 @echo " [ apache-stop apache-start ]"
124 @echo "make phantomjs PHANTOMJS_PATH=${PHANTOMJS_PATH}"
125 @echo "DEBUG=0 APACHE_PORT=5050 make -s phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_PATH=${PHANTOMJS_PATH}"
126 @echo "DEBUG=2 make phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_URL=${PHANTOMJS_URL}"
128 @echo "make phantomjs-all"