summaryrefslogtreecommitdiff
path: root/Makefile
blob: 60841981817c97b1f589a74ccacc74578a8ff17d (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
suffix = .xhtml

xsltproc=xsltproc --stringparam suffix $(suffix)
svg2png=rsvg-convert -f png

#pages=$(shell xmllint  --xpath "//*/@filename" main.xml | sed 's/filename=//g'| xargs echo)
pages=$(shell sed -n 's/^.*filename="\([^"]*\)".*/\1/p' main.xml)

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

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   " $@;


.PHONY: all
all: $(pages_gen) checkmark.png

services$(suffix): buchhalterservice.xml

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

%$(suffix): %.xml %.xsl main.xml xsl/*
	$(V_XSLT) $(xsltproc) $< > $@
%$(suffix): %.xml main.xml xsl/*
	$(V_XSLT) $(xsltproc) $< > $@

.PHONY: buchhalterservice.xml
buchhalterservice.xml:
	$(V_GEN) curl -s http://www.buchhalterseite.de/buchhalter-wissen/ShareBuchhalterseiteKurz.js | \
		sed -n "s/^\tvar buffer = '\(.*\)'\;/\1/p" | \
		xmllint --format - | \
		sed '2s/^/<!DOCTYPE rss SYSTEM "character-entities.dtd">\n/' | \
		sed 's|<rss\(.*\)>|<rss\1 xmlns="http://purl.org/rss/2.0/">|' | \
		sed 's|href=\([^"][^ >]*\)|href="\1"|' | \
		sed 's|<description><\!\[CDATA\[\(.*\)\]\]></description>|<description>\1</description>|' | \
		cat > $@

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