summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pseudo/Makefile
blob: 0541b20e49eeaf2ba7421241621e2a4f0e300a40 (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
TARGETS=doc/pseudo.pdf doc/fig/readmefig.svg

LATEX=latexmk -norc -pdf -auxdir=build -outdir=build
FIGS=build/hilitefig.pdf build/pausefig.pdf build/kwfig.pdf
TESTS=build/pseudotest.pdf

all: $(TARGETS)

doc/pseudo.pdf: build/pseudo.pdf
	cp $< $@

build/pseudo.pdf: doc/pseudo.tex build/pseudo.bib $(FIGS) $(TESTS) README.md pseudo.sty
	$(LATEX) $<

build/pseudo.bib: doc/pseudo.bib
	cp $< $@

build/hilitefig.pdf: doc/fig/hilitefig.tex pseudo.sty
	$(LATEX) $<

build/pausefig.pdf: doc/fig/pausefig.tex pseudo.sty
	$(LATEX) $<

build/kwfig.pdf: doc/fig/kwfig.tex pseudo.sty
	$(LATEX) $<

build/pseudotest.pdf: test/pseudotest.tex pseudo.sty
	$(LATEX) $<

pseudo.sty:	VERSION LICENSE doc/pseudo.tex
	cat LICENSE | sed -e "s/^/% /" | sed -e "s/^% \$$/%/" > pseudo.sty
	echo "%" >> pseudo.sty
	cat doc/pseudo.tex | sed -n \
		-e "/\begin{source}/,/\end{source}/{" \
		-e "/\\begin{source}/b" \
		-e "/\\end{source}/b" \
		-e "s/_@@/__pseudo/g" \
		-e "s/@@/__pseudo/g" \
		-e "s/VERSION/$$(cat VERSION)/g" \
		-e "s/DATE/$$(date +"%Y\/%m\/%d")/g" \
		-e "s/[ ]*%.*\$$//" \
		-e "/^\$$/d" \
		-e "p" \
		-e "}" >> pseudo.sty

build/readmecode.tex: doc/fig/readmecode.tex
	cp $< $@

build/readmefig.pdf: doc/fig/readmefig.tex build/readmecode.tex
	$(LATEX) $<

doc/fig/readmefig.svg: build/readmefig.pdf
	pdf2svg $< $@

doc/fig/readmecode.tex: README.md
	cat $< | sed -n -e "/\\begin{pseudo}\\*$$/,/\\end{pseudo}/p" > $@