summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile73
1 files changed, 38 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 6b633158..75540c3e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,12 @@
-# The idea here is to be able to re-generate the exact Javascript
-# files as they exist in git. This means munging whitespace in weird
-# ways, using specific versions of various JS minimizers...
-
# Where are we?
topdir := $(dir $(lastword $(MAKEFILE_LIST)))
www = $(topdir)/../web-cache/www
+artwork = $(topdir)/../web-cache/artwork
+branding = $(artwork)/official-2013/optimized-text
+
-# Where are the Javascript minimizers?
-# Any of the 1.3.x or 2.2.x will produce the same output for these
-uglifyjs-1.3 = ~/Downloads/UglifyJS/bin/uglifyjs --no-copyright --ascii --max-line-len 0
-uglifyjs-2.2 = ~/Downloads/UglifyJS2/bin/uglifyjs --mangle --compress --
-closure-compiler = java -jar ~/Downloads/compiler-20121212/compiler.jar
+# Where is the the Javascript minimizer?
+JSMIN = { sed -n '1,/\*\//p' $1; closure-compiler --js $1; } > $2
# What versions of 3rd party libraries are we using?
jquery-ver=1.8.3
@@ -19,7 +15,8 @@ tablesorter-ver=2.7
d3-ver=3.0.6
konami-ver=c0f686e647765860ff4d2fcb7b48122785432b75
-targets = \
+# What files do we make?
+javascripts = \
sitestatic/bootstrap-typeahead.js \
sitestatic/homepage.js \
sitestatic/jquery-$(jquery-ver).min.js \
@@ -28,21 +25,28 @@ targets = \
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
+
+javascript_basenames = $(sort $(patsubst %.min,%,$(patsubst %.js,%,$(javascripts))))
+targets = $(foreach i,$(javascript_basenames),$i.js $i.min.js) $(images)
# The base rules
-all: $(targets)
-.PHONY: all
-
-basenames = $(sort $(patsubst %.min,%,$(patsubst %.js,%,$(targets))))
-generated = $(addsuffix .js,$(basenames)) $(addsuffix .min.js,$(basenames))
-clean:
- rm -f -- $(generated)
-.PHONY: clean
+all: $(targets) sitestatic/.gitignore visualize/.gitignore
+clean: sitestatic/.gitignore visualize/.gitignore
+ rm -f -- $(targets)
+.PHONY: all clean
-# Don't have non-minimized .js stick around unless we asked for them.
-.INTERMEDIATE: $(filter-out $(targets),$(generated))
+%/.gitignore: $(MAKEFILE_LIST)
+ printf -- '%s\n' $(filter $*/%,$(targets)) > $@
# Turn on sane error handling
.DELETE_ON_ERROR:
@@ -60,8 +64,12 @@ $(www)/https/%:
wget 'https://$*' -O '$@'
touch '$@'
+$(branding)/%:
+ gitget checkout 'git://projects.parabola.nu/artwork.git#branch=master' '$(artwork)'
+ make -C '$(branding)'
+
-# Non-minimized .js files
+# 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 $@
@@ -74,27 +82,22 @@ sitestatic/konami.js: sitestatic/%: $(www)/https/raw.github.com/snaptortoise/kon
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 crazy minimization processes
-
-sitestatic/bootstrap-typeahead.min.js: %.min.js: %.js
- $(uglifyjs-1.3) $< > $@
-sitestatic/jquery-$(jquery-ver).min.js: sitestatic/%.min.js: sitestatic/%.js Makefile.d/%.min.js.preamble
- { cat Makefile.d/$*.min.js.preamble && echo && $(uglifyjs-1.3) $<; } > $@
-sitestatic/jquery.tablesorter-$(tablesorter-ver).min.js: sitestatic/%.min.js: sitestatic/%.js Makefile.d/%.min.js.preamble
- @# The tr/sed is to turn all of the newlines except for the last one into spaces
- { cat Makefile.d/$*.min.js.preamble && echo && $(closure-compiler) $< | tr '\n' ' ' | sed 's, $$,\n,'; } > $@
-sitestatic/konami.min.js: %.min.js: %.js
- @# The sed is to insert newlines and whitespace at the correct places; presumably to match Dan copy/pasting into an editor.
- $(uglifyjs-2.2) $< | sed -r -e 's:e\.iphone\.stop_x|s=this\.tap===:\n\t&:g' -e 's,return"string",\n&,' | sed -e 's,;$$,,' -e '$$s,$$,\n,' > $@
-visualize/static/d3-$(d3-ver).min.js: %.min.js: %.js
- $(uglifyjs-2.2) $< > $@
+# The minimization processes
+
+%.min.js: %.js
+ $(call JSMIN,$<,$@)