summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6d44c885485d9484760a30d0abd56ea29fd1320c (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
srcs = $(shell find public-src -name 3rd-party -prune -o -not -type d -not -name '*.log' -print)
outs = $(patsubst public-src/%,public/%,\
       $(patsubst %.scss,%.css,\
       $(patsubst %.gen,%,\
         $(srcs))))
all: $(outs)
all: public/3rd-party
all: jarmon-dependencies
.PHONY: all

NET-%:
	date > $@

.DELETE_ON_ERROR:
.SECONDARY:
.PHONY: FORCE

# bin/

bin/%: bin-src/%.go bin-src/util $(wildcard bin-src/util/*.go)
	go build -o $@ $<

bin/%: bin-src/%
	@mkdir -p '$(@D)'
	ln -srTf '$<' '$@'

# public/

# Normal pattern rules
public/%: public-src/%
	@mkdir -p '$(@D)'
	ln -srTf '$<' '$@'
public/%: public/%.gen
	$^ > $@
public/%.css: public/%.scss
	scss $< $@

# Specific stuff

public/index.html: public/tls.html.part public/crtsh.html.part public/diff.html.part public/jarmon.html.in

public/crtsh.pem: bin/crtsh-getcerts cfg/domains.txt NET-crtsh
	@mkdir -p '$(@D)'
	bin/crtsh-getcerts $$(sed 's/#.*//' cfg/domains.txt) > $@

public/tls.pem: bin/tls-getcerts cfg/sockets.txt NET-tls
	@mkdir -p '$(@D)'
	bin/tls-getcerts $$(sed 's/#.*//' cfg/sockets.txt) > $@

public/diff.pem: bin/pem-diff public/tls.pem public/crtsh.pem
	$^ > $@

public/tls.html.part public/crtsh.html.part public/diff.html.part: \
public/%.html.part: public/%.pem bin/%-pem2html
	bin/$*-pem2html < $< > $@

public-src/jarmon-depenencies: jarmon/docs/examples/assets/js/dependencies.js
jarmon/docs/examples/assets/js/dependencies.js: FORCE
	$(MAKE) -C jarmon docs/examples/assets/js/dependencies.js

public-src/3rd-party/yarn.LICENSES.txt: bin/yarn-bower public-src/3rd-party/package.json $(wildcard public-src/3rd-party/yarn.lock)
	bin/yarn-bower install
	bin/yarn-bower licenses generate-disclaimer > $@
public/3rd-party: public-src/3rd-party/yarn.LICENSES.txt

jquery-ver=1.6.3
flot-ver=0.8.3
jsrrd-ver=1.1.1
jquerytools-ver=8ac4636a01d3860f1c4726ba722190a531bf1068

jarmon-dependencies: public-src/jarmon-dependencies/jquery-$(jquery-ver).js
jarmon-dependencies: public-src/jarmon-dependencies/flot-$(flot-ver)/excanvas.js
jarmon-dependencies: public-src/jarmon-dependencies/flot-$(flot-ver)/jquery.flot.js
jarmon-dependencies: public-src/jarmon-dependencies/flot-$(flot-ver)/jquery.flot.time.js
jarmon-dependencies: public-src/jarmon-dependencies/flot-$(flot-ver)/jquery.flot.stack.js
jarmon-dependencies: public-src/jarmon-dependencies/flot-$(flot-ver)/jquery.flot.selection.js
jarmon-dependencies: public-src/jarmon-dependencies/javascriptrrd-$(jsrrd-ver)/rrdFile.js
jarmon-dependencies: public-src/jarmon-dependencies/javascriptrrd-$(jsrrd-ver)/binaryXHR.js
jarmon-dependencies: public-src/jarmon-dependencies/jquerytools-$(jquerytools-ver)/tabs.js
jarmon-dependencies: public-src/jarmon-dependencies/jquerytools-$(jquerytools-ver)/toolbox.history.js

public-src/jarmon-dependencies/jquery-%.js:
	@mkdir -p '$(@D)'
	wget -O $@ 'http://code.jquery.com/jquery-$*.js'
public-src/jarmon-dependencies/flot-%.tar.gz:
	@mkdir -p '$(@D)'
	wget -O $@ 'https://github.com/flot/flot/archive/v$*.tar.gz'
public-src/jarmon-dependencies/flot-$(flot-ver)/%: public-src/jarmon-dependencies/flot-$(flot-ver).tar.gz
	@mkdir -p '$(@D)'
	bsdtar -xOf $< flot-$(flot-ver)/$* > $@
public-src/jarmon-dependencies/javascriptrrd-$(jsrrd-ver)/%:
	@mkdir -p '$(@D)'
	wget -O $@ 'https://git.lukeshu.com/2git/javascriptrrd/plain/src/lib/$*?id=v$(jsrrd-ver)'
public-src/jarmon-dependencies/jquerytools-$(jquerytools-ver)/%:
	@mkdir -p '$(@D)'
	wget -O $@ 'https://raw.githubusercontent.com/jquerytools/jquerytools/$(jquerytools-ver)/src/$(firstword $(subst ., ,$*))/$*'