summaryrefslogtreecommitdiff
path: root/Makefile
blob: a58119f3580372669ba4712953a9ebaa673a8291 (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
suffix = xhtml
version = $(shell git rev-parse --short HEAD)

xsltproc=xsltproc --stringparam suffix .$(suffix) --stringparam stylesheet style.min.css --stringparam version $(version)
svg2png=rsvg-convert -f png

pages=$(shell xsltproc xsl/main_filenames.xsl main.xml)

pages_gen=$(pages:%.xml=%.$(suffix))

common_depend=main.xml $(wildcard xsl/*.xsl) Makefile checkmark.svg

DEFAULT_VERBOSITY=0

# verbosity stuff
V_XSLT = $(v_xslt_$(V))
v_xslt_ = $(v_xslt_$(DEFAULT_VERBOSITY))
v_xslt_0 = @echo "  XSLT  " $@;

V_GEN = $(v_gen_$(V))
v_gen_ = $(v_gen_$(DEFAULT_VERBOSITY))
v_gen_0 = @echo "  GEN   " $@;

V_CSS = $(v_css_$(V))
v_css_ = $(v_css_$(DEFAULT_VERBOSITY))
v_css_0 = @echo "  CSS   " $@;

V_SED = $(v_sed_$(V))
v_sed_ = $(v_sed_$(DEFAULT_VERBOSITY))
v_sed_0 = @echo "  SED   " $@;


.PHONY: all
all: $(pages_gen) checkmark.png style/style.min.css

%.png: %.svg
	$(V_GEN) $(svg2png) $< > $@

%$(suffix): %.xml %.xsl $(common_depend)
	$(V_XSLT) $(xsltproc) $< > $@
	$(V_SED) sed -i 's/ SYSTEM "about:legacy-compat"//' $@

%$(suffix): %.xml $(common_depend)
	$(V_XSLT) $(xsltproc) $< > $@
	$(V_SED) sed -i 's/ SYSTEM "about:legacy-compat"//' $@

style/style.min.css: style/style.css node_modules/.bin/postcss
	$(V_CSS) node_modules/.bin/postcss -u postcss-css-variables style/style.css | node_modules/.bin/cleancss > style/style.min.css

clean:
	rm -f $(pages_gen) checkmark.png