-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
121 lines (96 loc) · 3.98 KB
/
makefile
File metadata and controls
121 lines (96 loc) · 3.98 KB
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
112
113
114
115
116
117
118
119
120
121
target-texts := $(wildcard text/*/)
text-mds := $(wildcard build/text-mds/*.md)
target-analyses := $(wildcard analysis/*/)
analysis-mds := $(wildcard build/analysis-mds/*.md)
composite-mds := $(wildcard build/composite-mds/*.md)
character-mds-list : ; @echo $(text-mds)
target-characters-list : ; @echo $(target-texts)
target-analyses-list : ; @echo $(target-analyses)
.PHONY : all
all : build/mds
$(MAKE) build/pdfs-from-mds build/html-from-mds build/tei-from-mds build/txt-from-mds build/docx-from-mds build/complete/text.pdf build/complete/text.html build/complete/text.xml build/complete/text.docx build/complete/text.txt build/complete/composite-text.html build/complete/composite-text.pdf index.md
$(MAKE) clean
#insert a "pagebreak.md" between each page and name file better
text/%.mds :
./build-text-mds.sh $(@D)
analysis/%.mds :
./build-analysis-mds.sh $(@D)
# until pandoc is updated, manually alter the pipe character to \|
#[^\\] is not \ and \1 whatever that was
index.md : index-source.md
pandoc -f markdown -t markdown_github --smart index-source.md -o index.md
sed -i 's/\([^\\]\)|/\1\\|/g' index.md
%.pdf : %.tex
context --result=$@ $<
%.tex : %.md
pandoc -s -f markdown -t context -o $@ $<
%.html : %.md
pandoc -s -f markdown -t html5 -o $@ $<
%.xml : %.md
pandoc -s -f markdown -t tei -o $@ $<
%.docx : %.md
pandoc -s -f markdown -t docx -o $@ $<
%.txt : %.md
pandoc -s -f markdown -t plain -o $@ $<
build/complete/text.md :
cat $(text-mds) > $@
build/complete/composite-text.md :
cat $(composite-mds) > $@
build/complete/text.pdf : build/complete/text.tex
context --result=build/complete/text.pdf $<
build/complete/composite-text.pdf : build/complete/composite-text.tex
context --result=build/complete/composite-text.pdf $<
build/mds : text
$(MAKE) $(addsuffix text.mds, $(target-texts))
$(MAKE) $(addsuffix analysis.mds, $(target-analyses))
$(MAKE) build/remove-empty-mds
./concatenate-composites.sh
$(MAKE) build/remove-empty-mds
touch build/mds
build/pdfs-from-mds : build/mds build/remove-empty-mds
$(MAKE) $(subst .md,.pdf,$(text-mds))
mv build/text-mds/*.pdf build/pdfs
$(MAKE) $(subst .md,.pdf,$(composite-mds))
mv build/composite-mds/*.pdf build/composite-pdfs
touch build/pdfs-from-mds
build/html-from-mds : build/mds build/remove-empty-mds
$(MAKE) $(subst .md,.html,$(text-mds))
mv build/text-mds/*.html build/html
$(MAKE) $(subst .md,.html,$(composite-mds))
mv build/composite-mds/*.html build/composite-html
touch build/html-from-mds
build/tei-from-mds : build/mds build/remove-empty-mds
$(MAKE) $(subst .md,.xml,$(text-mds))
mv build/text-mds/*.xml build/xml
touch build/tei-from-mds
build/txt-from-mds : build/mds build/remove-empty-mds
$(MAKE) $(subst .md,.txt,$(text-mds))
mv build/text-mds/*.txt build/txt
touch build/txt-from-mds
build/docx-from-mds : build/mds build/remove-empty-mds
$(MAKE) $(subst .md,.docx,$(text-mds))
mv build/text-mds/*.docx build/docx
touch build/docx-from-mds
.PHONY : build/remove-empty-mds
build/remove-empty-mds :
find build/text-mds -size -10c -delete
find build/analysis-mds -size -10c -delete
find build/composite-mds -size -10c -delete
.PHONY : clean
clean :
find . \( -name "*.tex" -o -name "*.log" -o -name "*.tuc" \) -delete
.PHONY : cleanall
cleanall : clean
find build/html -name "*.html" -delete
find build/text-mds -name "*.md" -delete
find build/analysis-mds -name "*.md" -delete
find build/composite-mds -name "*.md" -delete
find build/composite-pdfs -name "*.pdf" -delete
find build/composite-html -name "*.html" -delete
find build \( -name mds -o -name pdfs-from-mds -o -name html-from-mds -o -name tei-from-mds -o -name txt-from-mds -o -name docx-from-mds \) -delete
find build/pdfs \( -name "*.pdf" \) -delete
find build/docx \( -name "*.docx" \) -delete
find build/txt \( -name "*.txt" \) -delete
find build/xml \( -name "*.xml" \) -delete
find build/complete \( -name "*.pdf" -o -name "*.html" -o -name "*.md" -o -name "*.txt" -o -name "*.xml" -o -name "*.docx" \) -delete
find . -name "index.md" -delete