X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=tools%2Fhtdocs%2FMakefile;h=b561e9290242f5672dfa55108d9fd194b20dad86;hp=3099c245237a9aa95bfe2cd6ff5e8715f41d6583;hb=f8c826608ce2e91f200caa4e67da0edee8a783bf;hpb=6fe33fcb5cd87943c27fd77c582a4e8cbe21a031 diff --git a/tools/htdocs/Makefile b/tools/htdocs/Makefile index 3099c24..b561e92 100644 --- a/tools/htdocs/Makefile +++ b/tools/htdocs/Makefile @@ -1,142 +1,117 @@ -###################################################################### # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com -# - -############################## -# select a jquery version -# -#JQUERY_URL= http://code.jquery.com/jquery-2.0.3.min.js -JQUERY_URL= http://code.jquery.com/jquery-1.10.0.min.js -#JQUERY_URL= http://code.jquery.com/jquery-1.9.1.min.js -#JQUERY_URL= http://code.jquery.com/jquery-1.8.3.min.js -#JQUERY_URL= http://code.jquery.com/jquery-1.7.2.min.js -#JQUERY_URL= http://code.jquery.com/jquery-1.6.4.min.js -#JQUERY_URL= http://code.jquery.com/jquery-1.4.4.min.js - -JQUERY_UI_URL= http://code.jquery.com/ui/1.10.3/jquery-ui.js -#JQUERY_UI_URL= http://code.jquery.com/ui/1.8.0/jquery-ui.min.js -JQUERY_JSON_URL= https://jquery-json.googlecode.com/files/jquery.json-2.4.js -HANDLEBARS_URL= http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.1.2.js -o $@ -VERSION = $(shell tr -d '\012' < VERSION) - -MKWS_JS= mkws-complete.js -PZ2API_JS= ../../../pazpar2/js/pz2.js -PZ2API_GIT= ssh://git.indexdata.com:222/home/git/pub/pazpar2 - -JQUERY_FILE := $(shell basename ${JQUERY_URL}) -JQUERY_JSON_FILE := $(shell basename ${JQUERY_JSON_URL}) -HANDLEBARS_FILE := $(shell basename ${HANDLEBARS_URL}) -############################## - -DOCS = README.html README.odt README.pdf \ - whitepaper.html whitepaper.odt whitepaper.pdf - -# Default rule when "make" is invoked without a target -**default**: ${MKWS_JS} mkws-js-min README.html whitepaper.html - -all: ${MKWS_JS} mkws-js-min $(DOCS) - -docs: $(DOCS) - -pz2api-git-checkout: - @if ! test -e ${PZ2API_JS}; then \ - ( cd ../../.. && git clone ${PZ2API_GIT} ); \ - fi -mkws-js ${MKWS_JS}: Makefile mkws.js ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${HANDLEBARS_FILE} - @if ! test -e ${PZ2API_JS}; then \ - echo "The pazpar2 JS file ${PZ2API_JS} does not exists."; \ - echo "Did you checked out the source from the git repo?"; \ - echo ""; \ - echo "Please run:"; \ - echo "$$ make pz2api-git-checkout"; \ - echo ""; \ - exit 1; \ - fi - ( echo "/*! Copyright (c) 2013 IndexData ApS. http://indexdata.com"; \ +SRC= ../../src + +HANDLEBARS_FILE = handlebars-v1.3.0.js +JQUERY_FILE = jquery-1.10.0.min.js +JQUERY_JSON_FILE = jquery.json-2.4.js +PP2_FILE = pz2.js + +HANDLEBARS_URL = http://builds.handlebarsjs.com.s3.amazonaws.com/${HANDLEBARS_FILE} +JQUERY_URL = http://code.jquery.com/${JQUERY_FILE} +JQUERY_JSON_URL = https://jquery-json.googlecode.com/files/${JQUERY_JSON_FILE} +PP2_URL = http://git.indexdata.com/?p=pazpar2.git;a=blob_plain;f=js/${PP2_FILE};hb=HEAD + +JQUERY_UI_URL = http://code.jquery.com/ui/1.10.3/jquery-ui.js +VERSION = $(shell tr -d '\012' < ${SRC}/VERSION) +#HANDLEBARS=handlebars +HANDLEBARS=../../test/node_modules/.bin/handlebars +YUI_COMPRESSOR= $(shell which yui-compressor ../../test/bin/yui-compressor | head -1) + +COMPONENTS = ${SRC}/mkws-handlebars.js \ + ${SRC}/mkws-core.js \ + ${SRC}/mkws-team.js \ + ${SRC}/mkws-filter.js \ + ${SRC}/mkws-templates.js \ + ${SRC}/mkws-popup.js \ + ${SRC}/mkws-widget.js \ + ${SRC}/mkws-widget-main.js \ + ${SRC}/mkws-widget-termlists.js \ + ${SRC}/mkws-widget-authname.js \ + ${SRC}/mkws-widget-categories.js \ + ${SRC}/mkws-widget-log.js \ + ${SRC}/mkws-widget-record.js \ + ${SRC}/mkws-widget-reference.js \ + ${SRC}/mkws-widget-builder.js + +GENERATED = ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE} \ + mkws.js mkws.min.js mkws-complete.js mkws-complete.min.js mkws-templates.js + +**make-default**: all + +all: mkws.min.js mkws-complete.min.js + +mkws-js mkws-complete.js: Makefile mkws.js ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE} + ( set -e; \ + echo "/*! Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com"; \ + echo " Licence: GPL, http://www.indexdata.com/licences/gpl"; \ echo " created at: $$(date)"; \ - echo " mkws.js GIT id: $$(git log mkws.js | head -n 1 | perl -npe 's,\S+\s+,,')"; \ - echo " $$(basename ${PZ2API_JS}) GIT id: $$(cd $$(dirname ${PZ2API_JS}) && git log $$(basename ${PZ2API_JS}) | head -n 1 | perl -npe 's,\S+\s+,,')"; \ + echo " MKWS GIT id: $$(git show | head -n 1 | perl -npe 's,\S+\s+,,')"; \ + echo " pz2.js GIT id: $$(curl -sSf 'http://git.indexdata.com/?p=pazpar2.git;a=rss' | egrep ',')"; \ echo "*/"; \ cat ${JQUERY_FILE}; \ cat ${JQUERY_JSON_FILE}; \ + echo 'mkws_jQuery = jQuery.noConflict(true);'; \ cat ${HANDLEBARS_FILE}; \ - cat ${PZ2API_JS}; \ + cat ${PP2_FILE}; \ cat mkws.js; \ - ) > ${MKWS_JS}.new - mv -f ${MKWS_JS}.new ${MKWS_JS} - -mkws-js-min: mkws.min.js mkws-complete.min.js + ) > mkws-complete.js.tmp + mv -f mkws-complete.js.tmp mkws-complete.js %.min.js: %.js - yui-compressor $? > $@.new - mv -f $@.new $@ + ${YUI_COMPRESSOR} $? > $@.tmp + mv -f $@.tmp $@ mkws-syntax-check: - yui-compressor mkws.js >/dev/null + ${YUI_COMPRESSOR} mkws.js >/dev/null + +${HANDLEBARS_FILE}: + curl -sSf ${HANDLEBARS_URL} -o $@.tmp + mv -f $@.tmp $@ ${JQUERY_FILE}: - curl -sSf ${JQUERY_URL} -o $@.new - perl -npe 's,sourceMappingURL=jquery.*map,,' $@.new > $@ - rm -f $@.new + curl -sSf ${JQUERY_URL} -o $@.tmp + perl -npe 's,sourceMappingURL=jquery.*map,,' $@.tmp > $@ + rm -f $@.tmp ${JQUERY_JSON_FILE}: - curl -sSf ${JQUERY_JSON_URL} -o $@ + curl -sSf ${JQUERY_JSON_URL} -o $@.tmp + mv -f $@.tmp $@ -${HANDLEBARS_FILE}: - curl -sSf ${HANDLEBARS_URL} -o $@ +${PP2_FILE}: + curl -sSf "${PP2_URL}" -o $@.tmp + mv -f $@.tmp $@ release: mkws.js mkws-complete.js mkws.min.js mkws-complete.min.js - @if [ -f releases/mkws-$(VERSION).js ]; then \ + @if [ -f ${SRC}/releases/mkws-$(VERSION).js ]; then \ echo "*** There is already a release $(VERSION)"; \ else \ - cp -p mkws.js releases/mkws-$(VERSION).js; \ - cp -p mkws.min.js releases/mkws-$(VERSION).min.js; \ - cp -p mkws-complete.js releases/mkws-complete-$(VERSION).js; \ - cp -p mkws-complete.min.js releases/mkws-complete-$(VERSION).min.js; \ + cp -p mkws.js ${SRC}/releases/mkws-$(VERSION).js; \ + cp -p mkws.min.js ${SRC}/releases/mkws-$(VERSION).min.js; \ + cp -p mkws-complete.js ${SRC}/releases/mkws-complete-$(VERSION).js; \ + cp -p mkws-complete.min.js ${SRC}/releases/mkws-complete-$(VERSION).min.js; \ echo "Made release $(VERSION)"; \ fi -# For a description of pandoc's markdown format, see: -# http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html --> - -# for older pandoc (<1.9) run first: -# perl -i.bak -npe 's/"(Authors|Subjects)": "(.*?)"/"$1": "test"/' tools/htdocs/whitepaper.markdown -# -%.html: %.markdown +mkws.js: mkws-templates.js $(COMPONENTS) Makefile rm -f $@ - pandoc --standalone --toc -c mkws-doc.css $< | sed '/^$//d' > $@ - chmod ugo-w $@ + cat ${COMPONENTS} > $@.tmp + mv -f $@.tmp $@ + chmod 444 $@ -%.odt: %.markdown - rm -f $@ - pandoc --standalone $< -o $@ - chmod ugo-w $@ +mkws-templates.js: + ${HANDLEBARS} -n mkws.defaultTemplates ${SRC}/*.templates/*.handlebars -f ${SRC}/mkws-templates.js -# ### In order to compile the whitepaper, which has tables, to PDF, -# you will need to install the Debian package -# texlive-latex-recommended -%.pdf: %.markdown - rm -f $@ - pandoc --standalone $< -o $@ - chmod ugo-w $@ +mkws-html-includes: + echo $(COMPONENTS) | perl -npe "s,${SRC},,g; s/\s+/\0/g" | \ + perl -n0e 'chomp(); print qq{ \n}' -############################## -# helper targets -# distclean: clean - rm -f *.orig *.bak *.rej + @echo "(No need for distclean, 'make clean' is fine)" clean: - rm -f ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${HANDLEBARS_FILE} - rm -f mkws.min.js ${MKWS_JS} mkws-complete.min.js - rm -f $(DOCS) + rm -f ${GENERATED} help: - @echo "make [ help | docs | clean ]" - @echo " [ mkws-js | mkws-js-min ]" + @echo "make [ all | release | clean | distclean ]" @echo " [ mkws-syntax-check ]" - @echo "" - @echo "make JQUERY_URL=http://code.jquery.com/jquery-2.0.3.min.js clean mkws-js" - @echo "" - @echo "Please check ./README file too!"