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