From 62d9f6628a30dc7540071108473b0ea94e58a39e Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Fri, 27 Jun 2014 16:32:52 +0200 Subject: [PATCH] re-organize mkws.js build process, MKWS-229 --- Makefile | 5 +-- src/Makefile | 102 --------------------------------------------- tools/htdocs/Makefile | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 105 deletions(-) delete mode 100644 src/Makefile create mode 100644 tools/htdocs/Makefile diff --git a/Makefile b/Makefile index 9504c36..6d6441f 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com all: - ${MAKE} -C./src $@ + ${MAKE} -C./tools/htdocs $@ ${MAKE} -C./doc $@ clean distclean: - ${MAKE} -C./src $@ + ${MAKE} -C./tools/htdocs $@ ${MAKE} -C./doc $@ ${MAKE} -C./examples/htdocs $@ ${MAKE} -C./test $@ @@ -18,7 +18,6 @@ phantomjs p: # must be called once after GIT checkout setup: -#why? ${MAKE} -C./tools/htdocs mkws-js-min ${MAKE} -C./test node-modules check: setup check-js diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index bc7ef19..0000000 --- a/src/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -HANDLEBARS_FILE = handlebars-v1.1.2.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' < VERSION) - -COMPONENTS = mkws-handlebars.js \ - mkws-core.js mkws-team.js mkws-filter.js \ - mkws-widget.js mkws-widget-main.js mkws-widget-termlists.js \ - mkws-widget-authname.js mkws-widget-categories.js mkws-widget-log.js \ - mkws-widget-record.js mkws-widget-reference.js 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 - -INSTALLABLE = mkws-jquery.js VERSION NEWS $(GENERATED) - -INSTALLED = $(INSTALLABLE:%=../tools/htdocs/%) - -**make-default**: ../tools/htdocs/mkws.js - -install: $(INSTALLED) - -uninstall: - rm -f $(INSTALLED) - -../tools/htdocs/%: % - rm -f $@ && cp -p $? $@ && chmod 444 $@ - -all: mkws.min.js mkws-complete.min.js - -mkws-js mkws-complete.js: Makefile mkws.js mkws-jquery.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 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 ${PP2_FILE}; \ - cat mkws.js; \ - cat mkws-jquery.js; \ - ) > mkws-complete.js.new - mv -f mkws-complete.js.new mkws-complete.js - -%.min.js: %.js - yui-compressor $? > $@.new - mv -f $@.new $@ - -mkws-syntax-check: - 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 - -${JQUERY_JSON_FILE}: - curl -sSf ${JQUERY_JSON_URL} -o $@.tmp - mv -f $@.tmp $@ - -${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 \ - 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; \ - echo "Made release $(VERSION)"; \ - fi - -mkws.js: $(COMPONENTS) Makefile - rm -f $@ - cat $(COMPONENTS) > $@ - chmod 444 $@ - -distclean: clean - rm -f *.orig *.bak *.rej - -clean: - rm -f ${GENERATED} - diff --git a/tools/htdocs/Makefile b/tools/htdocs/Makefile new file mode 100644 index 0000000..22e4d7c --- /dev/null +++ b/tools/htdocs/Makefile @@ -0,0 +1,110 @@ +# Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com + +SRC= ../../src +VPATH= ${SRC} + +HANDLEBARS_FILE = handlebars-v1.1.2.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) + +COMPONENTS = mkws-handlebars.js \ + mkws-core.js mkws-team.js mkws-filter.js \ + mkws-widget.js mkws-widget-main.js mkws-widget-termlists.js \ + mkws-widget-authname.js mkws-widget-categories.js mkws-widget-log.js \ + mkws-widget-record.js mkws-widget-reference.js 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 + +INSTALLABLE = mkws-jquery.js VERSION NEWS $(GENERATED) + +INSTALLED = $(INSTALLABLE:%=../tools/htdocs/%) + +**make-default**: mkws.js + +install: $(INSTALLED) + +uninstall: + rm -f $(INSTALLED) + +../tools/htdocs/%: % + rm -f $@ && cp -p $? $@ && chmod 444 $@ + +all: mkws.min.js mkws-complete.min.js + +mkws-js mkws-complete.js: Makefile mkws.js mkws-jquery.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 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 ${PP2_FILE}; \ + cat mkws.js; \ + cat ${SRC}/mkws-jquery.js; \ + ) > mkws-complete.js.new + mv -f mkws-complete.js.new mkws-complete.js + +%.min.js: %.js + yui-compressor $? > $@.new + mv -f $@.new $@ + +mkws-syntax-check: + 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 + +${JQUERY_JSON_FILE}: + curl -sSf ${JQUERY_JSON_URL} -o $@.tmp + mv -f $@.tmp $@ + +${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 ${SRC}/releases/mkws-$(VERSION).js ]; then \ + echo "*** There is already a release $(VERSION)"; \ + else \ + 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 + +mkws.js: $(COMPONENTS) Makefile + rm -f $@ + ( cd ${SRC}; cat ${COMPONENTS} ) > $@ + chmod 444 $@ + +distclean: clean + rm -f *.orig *.bak *.rej + +clean: + rm -f ${GENERATED} + +help: + @echo "make [ all | release | clean | distclean ]" + @echo " [ mkws-syntax-check ]" -- 1.7.10.4