summaryrefslogtreecommitdiff
path: root/media/Makefile
blob: b872e26cedfed92f1a6ce8ba2da2a6a4a8055f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
d3version=2.6.1
jqueryversion=1.4.4

# Force creating the d3 directory before we even evaluate how to make d3.js
all: .d3/d3-$(d3version) jquery-$(jqueryversion).min.js jquery.tablesorter.min.js
	$(MAKE) d3.min.js d3.layout.min.js

%.min.js: %.js
	$(closurecompiler) '$<'

jquery-$(jqueryversion).js:
	wget http://code.jquery.com/$@

d3.%: .d3/d3-$(d3version)/d3.% .d3/d3-$(d3version)/LICENSE Makefile
	echo '/* $@ - Data Driven Documents' > $@
	echo ' * Version: $(d3version)' >> $@
	echo ' * Homepage: http://mbostock.github.com/d3/' >> $@
	echo ' * Copyright: 2010, Michael Bostock' >> $@
	echo ' * Licence: 3-Clause BSD' >> $@
	echo ' *' >> $@
	sed 's/.*/ * &/' $(<D)/LICENSE >> $@
	echo ' */' >> $@
	cat $< >> $@

.d3/d3-%.tar.gz: Makefile
	mkdir -p $(@D)
	wget https://github.com/mbostock/d3/tarball/v$* -O $@
.d3/d3-%.tar.gz.d: .d3/d3-%.tar.gz Makefile
	rm -rf $@
	mkdir -p $<.d
	cd $@ && tar xzf ../d3-$*.tar.gz
.d3/d3-%: .d3/d3-%.tar.gz.d Makefile
	rm -rf $@
	cp -r $</*/ $@
	rm $@/*.min.js

.SECONDARY:
closurecompiler=compiler() { cp "$$1" "$${1%.js}.min.js"; }; compiler