summaryrefslogtreecommitdiff
path: root/visualize/static/Makefile
blob: 92340883f3615fe7915064ceeaae0e68ca5cfd29 (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
39
40
41
42
d3version=2.7.2

_targets=d3.js d3.layout.js d3.geom.js
targets=$(_targets) $(patsubst %.js,%.min.js,$(_targets))
gitignore=.d3

# Force creating the d3 directory before we even evaluate how to make d3.js
all: .d3/d3-$(d3version) .gitignore
	$(MAKE) $(targets)

distclean-hook: PHONY
	rm -rf .d3

####

d3.%: .d3/d3-$(d3version)/d3.% .d3/d3-$(d3version)/LICENSE Makefile
	@echo '[D3-HEADER] > $@'
	@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

####

include ../../sitestatic/js.mk