From 7ccccb7abbf0f7a393fea8d3334abdbf2025db62 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 14 Jul 2013 15:04:01 -0600 Subject: Add Makefiles to download .js files, and generate .min.js files. --- Makefile | 11 +++++++++++ common.mk | 22 ++++++++++++++++++++++ sitestatic/Makefile | 24 ++++++++++++++++++++++++ visualize/static/Makefile | 23 +++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 Makefile create mode 100644 common.mk create mode 100644 sitestatic/Makefile create mode 100644 visualize/static/Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..9c3fafea --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +subdirs = sitestatic visualize/static + +define newline = + + +endef + +default: all ; + +%: + $(foreach subdir,$(subdirs),$(MAKE) -C $(subdir) $@$(newline)) diff --git a/common.mk b/common.mk new file mode 100644 index 00000000..a0db5d70 --- /dev/null +++ b/common.mk @@ -0,0 +1,22 @@ +topdir := $(dir $(lastword $(MAKEFILE_LIST))) +www = $(topdir)/../web-cache/www + +#JSMIN = cp $1 $2 +#JSMIN = compiler $1 +#JSMIN = uglify-js -nc $1 > $2 +JSMIN = { sed -n '1,/\*\//p' $1; closure-compiler --js $1; } > $2 + +%.min.js: %.js + $(call JSMIN,$<,$@) + +$(www)/http/%: + mkdir -p '$(@D)' + wget 'http://$*' -O '$@' + touch '$@' + +$(www)/https/%: + mkdir -p '$(@D)' + wget 'http://$*' -O '$@' + touch '$@' + +.PHONY: PHONY diff --git a/sitestatic/Makefile b/sitestatic/Makefile new file mode 100644 index 00000000..e99e3c96 --- /dev/null +++ b/sitestatic/Makefile @@ -0,0 +1,24 @@ +include ../common.mk + +jquery-ver=1.8.3 +bootstrap-ver=2.1.1 +tablesorter-ver=2.7 +targets = \ + bootstrap-typeahead \ + jquery-$(jquery-ver) \ + jquery.tablesorter-$(tablesorter-ver) \ + konami + +target-files=$(addsuffix .js,$(targets)) $(addsuffix .min.js,$(targets)) +all: $(target-files) +clean: + rm -f -- $(target-files) + +bootstrap-typeahead.js: %: $(www)/https/raw.github.com/twitter/bootstrap/v$(bootstrap-ver)/js/% + cp $< $@ +jquery-$(jquery-ver).js: %: $(www)/http/code.jquery.com/% + cp $< $@ +jquery.tablesorter-$(tablesorter-ver).js: $(www)/https/raw.github.com/Mottie/tablesorter/v$(tablesorter-ver)/js/jquery.tablesorter.js + cp $< $@ +konami.js: %: $(www)/https/raw.github.com/snaptortoise/konami-js/master/% + cp $< $@ diff --git a/visualize/static/Makefile b/visualize/static/Makefile new file mode 100644 index 00000000..9a7f9828 --- /dev/null +++ b/visualize/static/Makefile @@ -0,0 +1,23 @@ +include ../../common.mk + +d3-ver=3.0.6 +targets = d3-$(d3-ver) + +target-files=$(addsuffix .js,$(targets)) $(addsuffix .min.js,$(targets)) +all: $(target-files) +clean: + rm -f -- $(target-files) + +d3-$(d3-ver).js: %: \ + $(www)/https/raw.github.com/mbostock/d3/v$(d3-ver)/d3.js \ + $(www)/https/raw.github.com/mbostock/d3/v$(d3-ver)/LICENSE + { \ + echo '/*! $@ - Data Driven Documents' && \ + echo ' * Version: $(d3-ver)' && \ + echo ' * Homepage: http://mbostock.github.com/d3/' && \ + echo ' * Copyright: 2012, Michael Bostock' && \ + echo ' * Licence: 3-Clause BSD' && \ + echo ' *' && \ + sed 's/.*/ * &/' $( $@ -- cgit v1.2.3-54-g00ecf