-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
111 lines (93 loc) · 3.31 KB
/
Makefile
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
SHELL:=/bin/bash
### <CONFIG> ###
# BIB files
bib.cr = kwarccrossrefs.bib extcrossrefs.bib
bib.kcr = kwarcpubs.bib $(bib.cr)
bib.ext = extpubs.bib $(bib.kcr)
bib.all = preamble.bib $(bib.ext)
bib.people = mkohlhase akohlhase miancu dginev cjucovschi twiesing dmueller frabe cprodescu clange cdavid vzholudev cmueller nmueller fhorozal jbetzendahl tpollinger mrapp kbercic cshi mrupprecht jfschaefer nroux rmarcus mwagner
bib.systems = sissi tetrapod TNTBase arXMLiv cpoint jomdoc kat krextor llamapun mathhub mmt mws omdoc openmathmap sTeX sally smglom swim
bib.projects = FormalCAD jem latin logosphere mathsearch oaf odk odkWP6 omoc once-cs openmath-tn MaMoReD comma almanac frameit voll-ki
bib.theses = phdthesis mscthesis bscthesis mscproject bscproject theses
bib.do = $(bib.people) $(bib.projects) $(bib.systems) $(bib.theses)
# Sources
src = src/
bib.src = ./
ltxml.src = $(src)ltxml/
tex.src = $(src)tex/
html.src = $(src)html/
pubs.src = $(src)pubs/
# Destination
dist = dist/
bib.dist = ./kwarc.bib
ltxml.dist = $(dist)ltxml/
tex.dist = $(dist)tex/
html.dist = $(dist)html/
pubs.dist = $(dist)pubs/
# Scripts etc
bib.sty = $(ltxml.src)kwarcbibs.sty
html.script = $(html.src)generate-html
CRXSL = $(ltxml.src)crossrefs.xsl
PLXSL = $(pubs.src)publist.xsl
PLXSLA = $(pubs.src)publist-all.xsl
### </CONFIG> ###
# FOR kwarc.bib files
kwarc.bib.in = $(bib.all:%=$(bib.src)%)
# for kwarc.bib.xml files
kwarc.ltxml.in = $(bib.sty) $(bib.sty).ltxml
kwarc.ltxml.out = $(bib.ext:%=$(ltxml.dist)%.xml)
kcr.src = $(bib.kcr:%=$(bib.src)%)
kcr.ltxml.in = $(ltxml.dist)kcr.bib
kcr.ltxml.out = $(kcr.ltxml.in).xml
### TARGETS ###
all: dist
clean: clean-bib clean-xml clean-html clean-pubs
dist: bib xml pubs
# kwarc.bib --> concat files
bib: setup-bib $(bib.dist)
setup-bib:
mkdir -p $(dist)
clean-bib:
-rm $(bib.dist)
$(bib.dist):
awk 'FNR==1{print ""}{print}' $(kwarc.bib.in) > $(bib.dist)
# *.bib.xml --> use latexmlc
xml: setup-xml $(kwarc.ltxml.out)
setup-xml:
mkdir -p $(ltxml.dist)
clean-xml:
-rm -r $(ltxml.dist)
$(kwarc.ltxml.out): $(ltxml.dist)%.xml: $(bib.src)% $(kwarc.ltxml.in)
latexmlc $< --quiet --bibtex --includestyles --path=$(ltxml.src) --preload=$(bib.sty).ltxml --destination=$@ 2> >(tee [email protected] >&2)
# kcr.bib.xml --> use latexmlc after generating kcr.bib
$(kcr.ltxml.in): $(kcr.src)
cat $(kcr.src) > $@
$(kcr.ltxml.out): $(kcr.ltxml.in)
latexmlc $< --quiet --bibtex --includestyles --path=$(ltxml.src) --preload=$(bib.sty).ltxml --destination=pre-$@ 2> >(tee [email protected] >&2)
xsltproc -o $@ $(CRXSL) pre-$@
rm -f pre-$@
# *.html --> custom script (xsltproc + latexml)
html: setup-html $(kcr.ltxml.out)
$(SHELL) $(html.script) $(src) $(dist) "$(bib.do)"
setup-html:
mkdir -p $(html.dist)
mkdir -p ${tex.dist}
mkdir -p $(ltxml.dist)
clean-html:
-rm -r $(html.dist)
-rm -r ${tex.dist}
# pubs --> xsltproc
pubs: setup-pubs html $(bib.do) $(pubs.dist)/index.html
$(pubs.dist)/index.html: setup-pubs html
xsltproc --path $(html.dist) -o $(pubs.dist)/index.html $(PLXSLA) $(PLXSLA)
setup-pubs:
mkdir -p $(pubs.dist)
clean-pubs:
-rm -r $(pubs.dist)
$(bib.do): %: $(PLXSL)
mkdir -p $(pubs.dist)$@
xsltproc --path $(html.dist) --stringparam id $@ -o $(pubs.dist)$@/index.html $(PLXSL) $(PLXSL)
######## testing
test: $(kcr.ltxml.out)
echo:
@echo $(kwarc.ltxml.out)