/
Makefile
143 lines (106 loc) · 4.12 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# specify thh main file and all the files that you are including
SOURCE= main.tex $(wildcard local*.tex) $(wildcard chapters/*.tex)
# specify your main target here:
pdf: main.bbl main.pdf #by the time main.pdf, bib assures there is a newer aux file
all: pod cover
complete: index main.pdf
index: main.snd
main.pdf: main.aux
xelatex main
main.aux: $(SOURCE)
xelatex -no-pdf main
#create only the book
main.bbl: $(SOURCE) localbibliography.bib
xelatex -no-pdf main
biber main
main.snd: main.bbl
touch main.adx main.sdx main.ldx
sed -i s/.*\\emph.*// main.adx #remove titles which biblatex puts into the name index
sed -i s/.*Board.*// main.adx
sed -i s/.*FDRE.*// main.adx
sed -i s/.*TUKI.*// main.adx
sed -i s/.*UNESCO.*// main.adx
sed -i 's/hyperindexformat{\\\(infn {[0-9]*\)}/\1/' main.sdx # ordering of references to footnotes
sed -i 's/hyperindexformat{\\\(infn {[0-9]*\)}/\1/' main.adx
sed -i 's/hyperindexformat{\\\(infn {[0-9]*\)}/\1/' main.ldx
python3 fixindex.py
cp mainmod.adx main.adx
makeindex -o main.and main.adx
makeindex -o main.lnd main.ldx
makeindex -o main.snd main.sdx
xelatex main
#create a png of the cover
cover: FORCE
convert main.pdf\[0\] -quality 100 -background white -alpha remove -bordercolor "#999999" -border 2 cover.png
cp cover.png googlebooks_frontcover.png
convert -geometry 50x50% cover.png covertwitter.png
convert main.pdf\[0\] -quality 100 -background white -alpha remove -bordercolor "#999999" -border 2 -resize x495 coveromp.png
display cover.png
googlebooks: googlebooks_interior.pdf
googlebooks_interior.pdf: complete
cp main.pdf googlebooks_interior.pdf
pdftk main.pdf cat 1 output googlebooks_frontcover.pdf
openreview: openreview.pdf
openreview.pdf: main.pdf
pdftk main.pdf multistamp orstamp.pdf output openreview.pdf
proofreading: proofreading.pdf
githubrepo: localmetadata.tex proofreading versions.json
grep lsID localmetadata.tex |egrep -o "[0-9]*" > ID
git clone https://github.com/langsci/`cat ID`.git
cp proofreading.pdf Makefile versions.json `cat ID`
mv `cat ID` ..
versions.json: localmetadata.tex
grep "^.title{" localmetadata.tex|grep -o "{.*"|egrep -o "[^{}]+">title
grep "^.author{" localmetadata.tex|grep -o "{.*"|egrep -o "[^{}]+" |sed 's/\\\(last\)\?and/"},{"name":"/g'>author
echo -n '{ "versions": [{ "versiontype": "proofreading", "title": "'>versions.json
cat title >> versions.json
echo -n '","authors": [{"name": "'>> versions.json
cat author >> versions.json
echo -n '"}],"publishedAt": "'>> versions.json
date --rfc-3339=s|sed s/" "/T/|sed s/+.*/.000Z/ >> versions.json
echo -n '"}]}'>> versions.json
rm author title
paperhive: versions.json
git branch gh-pages
git checkout gh-pages
git add proofreading.pdf versions.json
git commit -m 'prepare for proofreading' proofreading.pdf versions.json
git push origin gh-pages
git checkout master
echo "langsci.github.io/BOOKID"
firefox https://paperhive.org/documents/new
cd ..
mv `cat ID` ..
rm ID
proofreading.pdf:
pdftk main.pdf multistamp prstamp.pdf output proofreading.pdf
blurb: blurb.html blurb.tex biosketch.tex biosketch.html
blurb.tex: blurb.md
pandoc -f markdown -t latex blurb.md>blurb.tex
blurb.html: blurb.md
pandoc -f markdown -t html blurb.md>blurb.html
biosketch.tex: blurb.md
pandoc -f markdown -t latex biosketch.md>biosketch.tex
biosketch.html: blurb.md
pandoc -f markdown -t html biosketch.md>biosketch.html
#housekeeping
clean:
rm -f *.bak *~ *.backup *.tmp \
*.adx *.and *.idx *.ind *.ldx *.lnd *.sdx *.snd *.rdx *.rnd *.wdx *.wnd \
*.log *.blg *.ilg \
*.aux *.toc *.cut *.out *.tpm *.bbl *-blx.bib *_tmp.bib *bcf \
*.glg *.glo *.gls *.wrd *.wdv *.xdv *.mw *.clr \
*.run.xml \
chapters/*aux chapters/*~ chapters/*.bak chapters/*.backup\
langsci/*/*aux langsci/*/*~ langsci/*/*.bak langsci/*/*.backup
realclean: clean
rm -f *.dvi *.ps *.pdf
chapterlist:
grep chapter main.toc|sed "s/.*numberline {[0-9]\+}\(.*\).newline.*/\\1/"
podcover:
bash podcovers.sh
barechapters:
cat *tex | detex > barechapters.txt
languagecandidates:
egrep -oh "[a-z] [A-Z][a-z]+" chapters/*tex| grep -o [A-Z].* |sort -u >languagelist.txt
FORCE: