-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
151 lines (121 loc) · 4.43 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
144
145
146
147
148
149
150
151
# --------------------------------------------------------------------------------
# $Id$
# --------------------------------------------------------------------------------
# export TEXINPUTS:=.:local
export TEXINPUTS:=./local//:../local//:
C = Preface QuickTour FirstApp Syntax Messages \
Model Environment SUnit BasicClasses Collections Streams Morphic \
Metaclasses
ifndef TRAVIS
ifdef NO_WSL
PREFIX = cmd.exe /c
else
PREFIX =
endif
PDFLATEX = ${PREFIX} pdflatex -file-line-error -interaction=nonstopmode
BIBTEX = ${PREFIX} bibtex
MAKEINDEX = ${PREFIX} makeindex
else
PDFLATEX = docker run -v $(CURDIR):/src tom95/texlive-docker-swa pdflatex -interaction=nonstopmode
BIBTEX = docker run -v $(CURDIR):/src tom95/texlive-docker-swa bibtex
endif
BOOK=SBE
ETC=SBE-etc
ifdef BASH_V5 # Bash v5 interprets escape characters differently 🙄
TEXINPUT=$(shell echo "$$([ "$$DEBUG_FIGURES" = true ] && echo '\AtBeginDocument{\include{robustize-figures}}')$$([ -z "$$SQUEAK_VERSION" ] || echo '\newcommand{\SQUEAKVERSION}{${SQUEAK_VERSION}}')\\input{${BOOK}}")
else
TEXINPUT=$(shell echo "$$([ "$$DEBUG_FIGURES" = true ] && echo '\\\\AtBeginDocument{\\\\include{robustize-figures}}')$$([ -z "$$SQUEAK_VERSION" ] || echo '\\\\newcommand{\\\\SQUEAKVERSION}{${SQUEAK_VERSION}}')\\\\input{${BOOK}}")
endif
# --------------------------------------------------------------------------------
all : complete
# NB: be sure to use texlive and to set the TEXINPUTS variable accordingly
# See README.md
book: clean listings book-pages
book-pages :
time ${PDFLATEX} '${TEXINPUT}'
time ${BIBTEX} ${BOOK}
time ${PDFLATEX} '${TEXINPUT}'
time ${PDFLATEX} '${TEXINPUT}' | tee warnings.txt
# Filter out blank lines and bogus warnings
perl -pi \
-e '$$/ = "";' \
-e 's/[\n\r]+/\n/g;' \
-e 's/LaTeX Warning: Label `\w*:defaultlabel'\'' multiply defined.[\n\r]*//g;' \
-e 's/Package wrapfig Warning: wrapfigure used inside a conflicting environment[\n\r]*//g;' \
warnings.txt
# We need a makefile rule to generate the index as well ...
index :
${MAKEINDEX} ${BOOK}
complete : book index
time ${PDFLATEX} '${TEXINPUT}'
etc :
time ${PDFLATEX} ${ETC}
${MAKEINDEX} ${ETC}
time ${PDFLATEX} ${ETC}
time ${PDFLATEX} ${ETC}
open ${ETC}.pdf
examples :
./build_scripts/examples.rb $C > [email protected]
listings : clean_listings
bash -e build_scripts/annotate-listings.sh SmalltalkSources/ ListingSources/
fun :
time ./build_scripts/examples.rb $C > [email protected]
# Requires Gnu Smalltalk 2.95c with scripting support:
time ./build_scripts/examples.st $C > [email protected]
# --------------------------------------------------------------------------------
# MAINTENANCE
# Adapt this rule to find anything (such as duplicate labels)
find :
find . -name \*.tex | \
xargs egrep '\\atsign'
# Search for any figure files with non-unique names
duplicates :
ls figures */figures | sort | uniq -d
# look for bad usages of see index (with ! in second arg)
badsee :
find . -name \*.tex | \
xargs egrep '\\seeindex\{.*}{.*!.*}'
badindex :
find . -name \*.tex | \
xargs egrep '\\index\{.*}{'
# Check for duplicate labels
checkLabels :
find . -name \*.tex | \
xargs perl -p -e 's/\%.*//;' | \
fgrep '\label' | \
perl -p -e 's/.*\\label{([^}]*)}.*/$$1/;' | \
sort | uniq -d
# Count deprecated stuff:
deprecated :
# @ echo "OLDscript:"
# @find . -name \*.tex | xargs fgrep '{OLDscript}' | sed 's/:.*//' | sort | uniq -c
@ echo "doublebox:"
@find . -name \*.tex | xargs fgrep 'doublebox' | sed 's/:.*//' | sort | uniq -c
munge :
find . -name \*.tex | \
xargs perl -pi \
-e 's/{Chapter summary}/{Chapter Summary}/g;'
keys :
find . -name \*.tex -or -name \*.txt | \
xargs svn propset svn:keywords "Date Author Id Log"
# Fix the mime types of all pdf files
ps :
find . -name \*.pdf | \
xargs svn ps svn:mime-type application/octet-stream
# --------------------------------------------------------------------------------
clean : clean_listings
-rm -f *.aux *.log *.out *.glo *.toc *.ilg *.blg *.idx
-rm -f */*.aux */*.log */*.out
-rm -f .DS_Store */.DS_Store
-rm -f common*.url common*.pdf SBE.url
-rm -f test.*
clean_figures :
git clean -dfX -n | cut -d " " -f 3 | grep 'figures/$$\|\.png$$' | xargs rm -rf
clean_listings :
-rm -rf ListingSources ||:
bare : clean
mv figures/squeak-logo.pdf figures/squeak-logo.pdfSAVE
-rm -f ${BOOK}.pdf */*.pdf
mv figures/squeak-logo.pdfSAVE figures/squeak-logo.pdf
# --------------------------------------------------------------------------------