include jquery.json-2.4.js plugin to mkws-complete.js
[mkws-moved-to-github.git] / tools / htdocs / Makefile
1 ######################################################################
2 # Copyright (c) 2013 IndexData ApS. http://indexdata.com
3 #
4
5 ##############################
6 # select a jquery version
7 #
8 #JQUERY_URL=    http://code.jquery.com/jquery-2.0.3.min.js
9 JQUERY_URL=     http://code.jquery.com/jquery-1.10.0.min.js
10 #JQUERY_URL=    http://code.jquery.com/jquery-1.9.1.min.js
11 #JQUERY_URL=    http://code.jquery.com/jquery-1.8.3.min.js
12 #JQUERY_URL=    http://code.jquery.com/jquery-1.7.2.min.js
13 #JQUERY_URL=    http://code.jquery.com/jquery-1.6.4.min.js
14 #JQUERY_URL=    http://code.jquery.com/jquery-1.4.4.min.js
15
16 JQUERY_UI_URL=  http://code.jquery.com/ui/1.10.3/jquery-ui.js
17 #JQUERY_UI_URL= http://code.jquery.com/ui/1.8.0/jquery-ui.min.js
18 JQUERY_JSON_URL= https://jquery-json.googlecode.com/files/jquery.json-2.4.js
19
20 MKWS_JS=        mkws-complete.js
21 PZ2API_JS=      ../../../pazpar2/js/pz2.js
22 PZ2API_GIT=     ssh://git.indexdata.com:222/home/git/pub/pazpar2
23 ##############################
24 JQUERY_JSON_FILE := $(shell basename ${JQUERY_JSON_URL})
25
26 DOCS = README.html README.odt README.pdf \
27        whitepaper.html whitepaper.odt whitepaper.pdf
28
29 **default**: ${MKWS_JS} README.html whitepaper.html
30
31 all: ${MKWS_JS} $(DOCS)
32
33 docs: $(DOCS)
34
35 pz2api-git-checkout:
36         @if ! test -e ${PZ2API_JS}; then \
37             ( cd ../../.. && git clone ${PZ2API_GIT} ); \
38         fi
39
40 mkws-js ${MKWS_JS}: mkws.js handlebars-v1.1.2.js ${JQUERY_JSON_FILE}
41         @if ! test -e ${PZ2API_JS}; then \
42             echo "The pazpar2 JS file ${PZ2API_JS} does not exists."; \
43             echo "Did you checked out the source from the git repo?"; \
44             echo ""; \
45             echo "Please run:"; \
46             echo "$$ make pz2api-git-checkout"; \
47             echo ""; \
48             exit 1; \
49         fi
50         ( echo "/* created at: $$(date)"; \
51           echo "   mkws.js GIT id: $$(git log mkws.js | head -n 1 | perl -npe 's,\S+\s+,,')"; \
52           echo "   $$(basename ${PZ2API_JS}) GIT id: $$(cd $$(dirname ${PZ2API_JS}) && git log $$(basename ${PZ2API_JS}) | head -n 1 | perl -npe 's,\S+\s+,,')"; \
53           echo "*/"; \
54           curl -sSf ${JQUERY_URL} | perl -npe 's,sourceMappingURL=jquery.*map,,'; \
55           cat ${JQUERY_JSON_FILE}; \
56           cat handlebars-v1.1.2.js; \
57           cat ${PZ2API_JS}; \
58           cat  mkws.js ) > ${MKWS_JS}.new
59         mv -f ${MKWS_JS}.new ${MKWS_JS}
60
61 handlebars-v1.1.2.js:
62         curl -sSf http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.1.2.js -o $@
63
64 ${JQUERY_JSON_FILE}:
65         curl -sSf ${JQUERY_JSON_URL} -o $@
66
67
68 # For a description of pandoc's markdown format, see:
69 # http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html -->
70
71 # for older pandoc (<1.9) run first:
72 # perl -i.bak -npe 's/"(Authors|Subjects)": "(.*?)"/"$1": "test"/' tools/htdocs/whitepaper.markdown
73 #
74 %.html: %.markdown
75         rm -f $@
76         pandoc --standalone --toc -c mkws-doc.css $< | sed '/^<col width="[0-9]*%" \/>$//d' > $@
77         chmod ugo-w $@
78
79 %.odt: %.markdown
80         rm -f $@
81         pandoc --standalone $< -o $@
82         chmod ugo-w $@
83
84 # ### In order to compile the whitepaper, which has tables, to PDF,
85 # you will need to install the Debian package
86 #       texlive-latex-recommended
87 %.pdf: %.markdown
88         rm -f $@
89         pandoc --standalone $< -o $@
90         chmod ugo-w $@
91
92 ##############################
93 # helper targets
94 #
95 distclean: clean
96 clean:
97         rm -f ${MKWS_JS} $(DOCS)
98
99 help:
100         @echo "make [ help | mkws-js | docs | clean ]"
101         @echo ""
102         @echo "make JQUERY_URL=http://code.jquery.com/jquery-2.0.3.min.js clean mkws-js"
103         @echo ""
104         @echo "Please check ./README file too!"