1 # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
5 HANDLEBARS_FILE = handlebars-v1.3.0.js
6 JQUERY_FILE = jquery-1.10.0.min.js
7 JQUERY_JSON_FILE = jquery.json-2.4.js
10 HANDLEBARS_URL = http://builds.handlebarsjs.com.s3.amazonaws.com/${HANDLEBARS_FILE}
11 JQUERY_URL = http://code.jquery.com/${JQUERY_FILE}
12 JQUERY_JSON_URL = https://jquery-json.googlecode.com/files/${JQUERY_JSON_FILE}
13 PP2_URL = http://git.indexdata.com/?p=pazpar2.git;a=blob_plain;f=js/${PP2_FILE};hb=HEAD
15 JQUERY_UI_URL = http://code.jquery.com/ui/1.10.3/jquery-ui.js
16 VERSION = $(shell tr -d '\012' < ${SRC}/VERSION)
18 COMPONENTS = ${SRC}/mkws-handlebars.js \
21 ${SRC}/mkws-filter.js \
22 ${SRC}/mkws-templates.js \
23 ${SRC}/mkws-popup.js \
24 ${SRC}/mkws-widget.js \
25 ${SRC}/mkws-widget-main.js \
26 ${SRC}/mkws-widget-termlists.js \
27 ${SRC}/mkws-widget-authname.js \
28 ${SRC}/mkws-widget-categories.js \
29 ${SRC}/mkws-widget-log.js \
30 ${SRC}/mkws-widget-record.js \
31 ${SRC}/mkws-widget-reference.js \
32 ${SRC}/mkws-widget-builder.js
34 GENERATED = ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE} \
35 mkws.js mkws.min.js mkws-complete.js mkws-complete.min.js mkws-templates.js
39 all: mkws.min.js mkws-complete.min.js
41 mkws-js mkws-complete.js: Makefile mkws.js ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE}
43 echo "/*! Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com"; \
44 echo " Licence: GPL, http://www.indexdata.com/licences/gpl"; \
45 echo " created at: $$(date)"; \
46 echo " MKWS GIT id: $$(git show | head -n 1 | perl -npe 's,\S+\s+,,')"; \
47 echo " pz2.js GIT id: $$(curl -sSf 'http://git.indexdata.com/?p=pazpar2.git;a=rss' | egrep '<guid' | head -1 | perl -ne 'print "$$1\n" if m,.*=([0-9a-f]+)</guid>,')"; \
50 cat ${JQUERY_JSON_FILE}; \
51 echo 'mkws_jQuery = jQuery.noConflict(true);'; \
52 cat ${HANDLEBARS_FILE}; \
55 ) > mkws-complete.js.tmp
56 mv -f mkws-complete.js.tmp mkws-complete.js
59 yui-compressor $? > $@.tmp
63 yui-compressor mkws.js >/dev/null
66 curl -sSf ${HANDLEBARS_URL} -o $@.tmp
70 curl -sSf ${JQUERY_URL} -o $@.tmp
71 perl -npe 's,sourceMappingURL=jquery.*map,,' $@.tmp > $@
75 curl -sSf ${JQUERY_JSON_URL} -o $@.tmp
79 curl -sSf "${PP2_URL}" -o $@.tmp
82 release: mkws.js mkws-complete.js mkws.min.js mkws-complete.min.js
83 @if [ -f ${SRC}/releases/mkws-$(VERSION).js ]; then \
84 echo "*** There is already a release $(VERSION)"; \
86 cp -p mkws.js ${SRC}/releases/mkws-$(VERSION).js; \
87 cp -p mkws.min.js ${SRC}/releases/mkws-$(VERSION).min.js; \
88 cp -p mkws-complete.js ${SRC}/releases/mkws-complete-$(VERSION).js; \
89 cp -p mkws-complete.min.js ${SRC}/releases/mkws-complete-$(VERSION).min.js; \
90 echo "Made release $(VERSION)"; \
93 mkws.js: mkws-templates.js $(COMPONENTS) Makefile
95 cat ${COMPONENTS} > $@.tmp
100 handlebars -n mkws.defaultTemplates ${SRC}/*.templates/*.handlebars -f ${SRC}/mkws-templates.js
103 echo $(COMPONENTS) | perl -npe "s,${SRC},,g; s/\s+/\0/g" | \
104 perl -n0e 'chomp(); print qq{ <script type="text/javascript" src="src$$_"></script>\n}'
107 @echo "(No need for distclean, 'make clean' is fine)"
113 @echo "make [ all | release | clean | distclean ]"
114 @echo " [ mkws-syntax-check ]"