diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 01:29:41 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-04-15 01:29:41 -0400 |
commit | 90873ef7de4bf842fbf6971836a373c555cfcbaa (patch) | |
tree | 52608c90e8a0fa13b1f2b4ccfade1d9162beb5d1 /Makefile | |
parent | 65e3ef63f7475a217da5205a788f52f3888ebea7 (diff) | |
parent | 7a8b5707b277f052b712c51574b0e28834b5a5f8 (diff) |
Merge branch 'archweb-generic' into master-nomake
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 104 |
1 files changed, 98 insertions, 6 deletions
@@ -1,11 +1,103 @@ -subdirs = sitestatic sitestatic/archnavbar sitestatic/logos visualize/static +# Where are we? +topdir := $(dir $(lastword $(MAKEFILE_LIST))) +www = $(topdir)/../web-cache/www +artwork = $(topdir)/../web-cache/artwork +branding = $(artwork)/official-2013/optimized-text -define newline = +# Where is the the Javascript minimizer? +JSMIN = { sed -n '1,/\*\//p' $1; closure-compiler --js $1; } > $2 -endef +# What versions of 3rd party libraries are we using? +jquery-ver=1.8.3 +bootstrap-ver=2.1.1 +tablesorter-ver=2.7 +d3-ver=3.0.6 +konami-ver=c0f686e647765860ff4d2fcb7b48122785432b75 -default: all ; +# What files do we make? +javascripts = \ + sitestatic/bootstrap-typeahead.js \ + sitestatic/homepage.js \ + sitestatic/jquery-$(jquery-ver).min.js \ + sitestatic/jquery.tablesorter-$(tablesorter-ver).js \ + sitestatic/jquery.tablesorter-$(tablesorter-ver).min.js \ + sitestatic/konami.min.js \ + visualize/static/d3-$(d3-ver).js \ + visualize/static/d3-$(d3-ver).min.js +images += sitestatic/favicon.ico sitestatic/silhouette.png +images += sitestatic/archnavbar/archlogo.png +images += \ + sitestatic/logos/apple-touch-icon-114x114.png \ + sitestatic/logos/apple-touch-icon-144x144.png \ + sitestatic/logos/apple-touch-icon-57x57.png \ + sitestatic/logos/apple-touch-icon-72x72.png \ + sitestatic/logos/icon-transparent-64x64.png -%: - $(foreach subdir,$(subdirs),$(MAKE) -C $(subdir) $@$(newline)) +javascript_basenames = $(sort $(patsubst %.min,%,$(patsubst %.js,%,$(javascripts)))) +targets = $(foreach i,$(javascript_basenames),$i.js $i.min.js) $(images) + + +# The base rules + +all: $(targets) sitestatic/.gitignore visualize/.gitignore +clean: sitestatic/.gitignore visualize/.gitignore + rm -f -- $(targets) +.PHONY: all clean + +%/.gitignore: $(MAKEFILE_LIST) + printf -- '%s\n' $(filter $*/%,$(targets)) > $@ + +# Turn on sane error handling +.DELETE_ON_ERROR: + + +# How to download files + +$(www)/http/%: + mkdir -p '$(@D)' + wget 'http://$*' -O '$@' + touch '$@' + +$(www)/https/%: + mkdir -p '$(@D)' + wget 'https://$*' -O '$@' + touch '$@' + +$(branding)/%: + gitget checkout 'git://projects.parabola.nu/artwork.git#branch=master' '$(artwork)' + make -C '$(branding)' + + +# Non-minimized files +sitestatic/bootstrap-typeahead.js: sitestatic/%: $(www)/https/raw.github.com/twitter/bootstrap/v$(bootstrap-ver)/js/% Makefile.d/%.patch + cp $< $@ + patch -i Makefile.d/$*.patch $@ +sitestatic/jquery-$(jquery-ver).js: sitestatic/%: $(www)/http/code.jquery.com/% + cp $< $@ +sitestatic/jquery.tablesorter-$(tablesorter-ver).js: $(www)/https/raw.github.com/Mottie/tablesorter/v$(tablesorter-ver)/js/jquery.tablesorter.js + cp $< $@ +sitestatic/konami.js: sitestatic/%: $(www)/https/raw.github.com/snaptortoise/konami-js/$(konami-ver)/% Makefile.d/%.patch + cp $< $@ + patch -i Makefile.d/$*.patch $@ +sitestatic/homepage.js: sitestatic/bootstrap-typeahead.min.js sitestatic/konami.min.js Makefile.d/homepage.js.in + { \ + echo '/* bootstrap-typeahead.min.js: */' && \ + cat sitestatic/bootstrap-typeahead.min.js && \ + echo && \ + echo '/* konami.min.js: */' && \ + sed -e 's,^\s*,,' -e 's,^return.*,&;,' sitestatic/konami.min.js && \ + echo && \ + echo '/* Main homepage.js content: */' && \ + cat Makefile.d/homepage.js.in ; \ + } > $@ +visualize/static/d3-$(d3-ver).js: %: $(www)/https/raw.github.com/mbostock/d3/v$(d3-ver)/d3.js + cp $< $@ + +$(foreach i,$(images),$(eval $i: $$(branding)/$(notdir $i); cp $$< $$@)) + + +# The minimization processes + +%.min.js: %.js + $(call JSMIN,$<,$@) |