File size: 10,439 Bytes
c5fb0ef 15ca8af c5fb0ef a24e95f c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef 15ca8af c5fb0ef | 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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | .PHONY: default all clean version.tex dvi
ifeq ($(OS),Windows_NT)
SHELL := powershell.exe
.SHELLFLAGS := -NoProfile -ExecutionPolicy Bypass -Command
endif
# Default top-level LaTeX to generate
DEFAULTTOPTEX = hott-online.tex
# Top-level LaTeX files from which HoTT book can be generated
TOPTEXFILES = $(DEFAULTTOPTEX) hott-bilingual.tex hott-ustrade.tex hott-letter.tex hott-letter-exercises.tex hott-a4.tex hott-a4-exercises.tex hott-ebook.tex hott-ebook-wide.tex hott-ebook-narrow.tex hott-arxiv.tex
# LaTeX files that actually comprise the book
# (that is, all of them except configuration)
BOOKTEXFILES = main.tex \
macros.tex \
version.tex \
frontpage.tex \
front.tex \
preface.tex \
introduction.tex \
preliminaries.tex \
basics.tex \
logic.tex \
equivalences.tex \
induction.tex \
hits.tex \
hlevels.tex \
homotopy.tex \
categories.tex \
setmath.tex \
reals.tex \
formal.tex \
symbols.tex \
back.tex \
blurb.tex
# Configuration files
OPTFILES = opt-letter.tex \
opt-a4.tex \
opt-ustrade.tex \
opt-ebook.tex \
opt-ebook-wide.tex \
opt-ebook-narrow.tex \
opt-color.tex \
opt-black-white.tex \
opt-cover.tex \
opt-no-cover.tex \
opt-bastard.tex \
opt-no-bastard.tex
# Image files
LORESPNGFILES = cover-lores-back-bw.png \
cover-lores-back.png \
cover-lores-front-bw.png \
cover-lores-front.png \
cover-lores.png \
torus-lores-bw.png
HIRESPNGFILES = cover-hires-back-bw.png \
cover-hires-back.png \
cover-hires-front-bw.png \
cover-hires-front.png \
cover-hires.png \
cover-hires-bw.png \
torus-hires-bw.png
# All the LaTeX files for the HoTT book in order of dependency
TEXFILES = $(TOPTEXFILES) $(BOOKTEXFILES) $(OPTFILES)
# aux files to be used when combining info from HoTT book with
# exercises
BOOKAUXFILES := $(BOOKTEXFILES:.tex=.aux)
# PDF and DVI files corresponding to HoTT book files
TOPPDFFILES:=$(TOPTEXFILES:.tex=.pdf)
TOPDVIFILES:=$(TOPTEXFILES:.tex=.dvi)
# Default PDF file to make
DEFAULTPDF:=$(DEFAULTTOPTEX:.tex=.pdf)
default: $(DEFAULTPDF)
all: $(TOPPDFFILES) exercise_solutions.pdf errata.pdf cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-letter.pdf cover-a4.pdf
dvi: $(TOPDVIFILES) exercise_solutions.dvi errata.dvi cover-lulu-hardcover.dvi cover-lulu-paperback.dvi cover-letter.dvi cover-a4.dvi
# Main targets
ifeq ($(OS),Windows_NT)
$(TOPPDFFILES) : %.pdf : %.tex $(TEXFILES) references.bib cover-lores-front.png cover-lores-back.png
if (Get-Command latexmk -ErrorAction SilentlyContinue) { latexmk -interaction=batchmode -g -pdf "$<" } else { Write-Host "run 1: pdflatex $<"; pdflatex -halt-on-error -interaction=batchmode "$<" *> $$null; bibtex "$(patsubst %.tex,%,$<)"; makeindex "$(patsubst %.tex,%,$<)"; Write-Host "run 2: pdflatex $<"; pdflatex -halt-on-error -interaction=batchmode "$<" *> $$null; pdflatex -halt-on-error "$<"; Write-Host "HINT: If you think this took a long time you should install latexmk." }
$(TOPDVIFILES) : %.dvi : %.tex $(TEXFILES) references.bib cover-lores-front.png cover-lores-back.png
if (Get-Command latexmk -ErrorAction SilentlyContinue) { latexmk -interaction=batchmode -dvi "$<" } else { Write-Host "run 1: latex $<"; latex -halt-on-error -interaction=batchmode "$<" *> $$null; bibtex "$(patsubst %.tex,%,$<)"; makeindex "$(patsubst %.tex,%,$<)"; Write-Host "run 2: latex $<"; latex -halt-on-error -interaction=batchmode "$<" *> $$null; latex -halt-on-error "$<"; Write-Host "HINT: If you think this took a long time you should install latexmk." }
else
$(TOPPDFFILES) : %.pdf : %.tex $(TEXFILES) references.bib cover-lores-front.png cover-lores-back.png
if which latexmk > /dev/null 2>&1 ;\
then latexmk -interaction=batchmode -g -pdf $< ;\
else (echo "run 1: pdflatex $<"; pdflatex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) && \
bibtex $(patsubst %.tex,%,$<) && \
makeindex $(patsubst %.tex,%,$<) && \
(echo "run 2: pdflatex $<"; pdflatex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) ;\
pdflatex -halt-on-error $< ;\
echo "HINT: If you think this took a long time you should install latexmk." ;\
fi
$(TOPDVIFILES) : %.dvi : %.tex $(TEXFILES) references.bib cover-lores-front.png cover-lores-back.png
if which latexmk > /dev/null 2>&1 ;\
then latexmk -interaction=batchmode -dvi $< ;\
else (echo "run 1: latex $<"; latex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) && \
bibtex $(patsubst %.tex,%,$<) && \
makeindex $(patsubst %.tex,%,$<) && \
(echo "run 2: latex $<"; latex -halt-on-error -interaction=batchmode $< 2>&1 >/dev/null) ;\
latex -halt-on-error $< ;\
echo "HINT: If you think this took a long time you should install latexmk." ;\
fi
endif
all default: log-check
log-check:
ifeq ($(OS),Windows_NT)
if (Test-Path hott-online.ilg) { if (Select-String -Path hott-online.ilg -SimpleMatch "!! Input index error") { Write-Host "Indexing error detected in hott-online.ilg"; exit 1 } }
else
: check for indexing errors
! grep -n "!! Input index error" hott-online.ilg /dev/null
endif
version.tex:
ifeq ($(OS),Windows_NT)
$$ver = (git describe --always --long).Trim(); "\newcommand{\OPTversion}{$$ver}" | Out-File -Encoding ascii version.tex
else
printf '\\newcommand{\\OPTversion}{%s}\n' "`git describe --always --long`" > version.tex
endif
# these warnings are mostly spurious, and could have been prevented by a better makeindex algorithm
log-check-for-warnings:
ifeq ($(OS),Windows_NT)
if (Test-Path hott-online.ilg) { if (Select-String -Path hott-online.ilg -SimpleMatch "## Warning") { Write-Host "Index warning detected in hott-online.ilg" } }
else
: check for indexing warnings
- ! grep -n "## Warning" hott-online.ilg /dev/null
endif
$(BOOKAUXFILES) : %.aux : %.tex
echo "WARNING: assuming $@ is up-to-date"
# Generate labels for the solutions
main.labels: $(BOOKAUXFILES)
ifeq ($(OS),Windows_NT)
Get-Content $^ | Select-String -Pattern '^\\newlabel' | ForEach-Object { $$_.Line } | Out-File -Encoding ascii $@
else
cat $^ | grep ^.newlabel >$@
endif
# Extract label numbers for verifying that they haven't changed within an edition.
# Discard symbol index numbers (not seen by user) and page numbers (we don't care about them).
main.labelnumbers: main.labels
sed 's/.*symindex.*//g' main.labels | sed 's/{\({[^}]*}\).*/\1/g' | sort >main.labelnumbers
# Check that no labels have changed, by making sure that all label
# numbers from the first edition are still present
labelcheck: main.labelnumbers
diff -u main.labelnumbers.first-edition main.labelnumbers | grep '^-\\newlabel' && echo Some label numbers have changed since the first edition!
ifeq ($(OS),Windows_NT)
cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-letter.pdf cover-a4.pdf exercise_solutions.pdf errata.pdf : %.pdf : %.tex
if (Get-Command latexmk -ErrorAction SilentlyContinue) { latexmk -interaction=batchmode -pdf "$<" } else { pdflatex -halt-on-error "$<" }
else
cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-letter.pdf cover-a4.pdf exercise_solutions.pdf errata.pdf : %.pdf : %.tex
if which latexmk > /dev/null 2>&1 ;\
then latexmk -interaction=batchmode -pdf $<;\
else pdflatex -halt-on-error $<; fi
endif
ifeq ($(OS),Windows_NT)
cover-lulu-hardcover.dvi cover-lulu-paperback.dvi cover-letter.dvi cover-a4.dvi exercise_solutions.dvi errata.dvi : %.dvi : %.tex
if (Get-Command latexmk -ErrorAction SilentlyContinue) { latexmk -interaction=batchmode -dvi "$<" } else { latex -halt-on-error "$<" }
else
cover-lulu-hardcover.dvi cover-lulu-paperback.dvi cover-letter.dvi cover-a4.dvi exercise_solutions.dvi errata.dvi : %.dvi : %.tex
if which latexmk > /dev/null 2>&1 ;\
then latexmk -interaction=batchmode -dvi $<;\
else latex -halt-on-error $<; fi
endif
cover-lulu-hardcover.pdf cover-lulu-paperback.pdf cover-lulu-hardcover.dvi cover-lulu-paperback.dvi: cover-hires.png $(OPTFILES)
cover-letter.pdf cover-a4.pdf cover-letter.dvi cover-a4.dvi: cover-lores-front.png cover-lores-back.png $(OPTFILES)
hott-arxiv.tex: hott-online.tex main.tex
ifeq ($(OS),Windows_NT)
$$enc = New-Object System.Text.UTF8Encoding($$false); $$header = '% hott-arxiv.tex AUTOGENERATED FROM hott-online.tex AND main.tex'; $$text = @($$header) + (Get-Content hott-online.tex); $$text = ($$text -replace '\\input\{main\}',''); $$text += Get-Content main.tex; [System.IO.File]::WriteAllLines('hott-arxiv.tex', $$text, $$enc)
else
echo '% hott-arxiv.tex AUTOGENERATED FROM hott-online.tex AND main.tex' >hott-arxiv.tex
cat hott-online.tex >>hott-arxiv.tex
sed 's/\\input{main}//' <hott-arxiv.tex >hott-arxiv.tex.tmp
mv hott-arxiv.tex.tmp hott-arxiv.tex
cat main.tex >>hott-arxiv.tex
endif
hott-arxiv.tar.gz: hott-arxiv.pdf
tar -czf hott-arxiv.tar.gz hott-arxiv.tex hott-arxiv.bbl hott-arxiv.ind $(BOOKTEXFILES) $(OPTFILES) $(LORESPNGFILES) mathpartir.sty
exercise_solutions.pdf exercise_solutions.dvi: main.labels
errata.pdf errata.dvi: version.tex main.labels
clean:
ifeq ($(OS),Windows_NT)
Remove-Item -Force -ErrorAction SilentlyContinue *~; Remove-Item -Force -ErrorAction SilentlyContinue *.aux; $$prefixes = @('exercise_solutions','errata'); $$exts = @('out','log','pdf','dvi','fls','fdb_latexmk','aux','brf','bbl','idx','ilg','ind','toc','sed'); foreach ($$p in $$prefixes) { foreach ($$e in $$exts) { Remove-Item -Force -ErrorAction SilentlyContinue "$$p.$$e" } }; foreach ($$e in $$exts) { Remove-Item -Force -ErrorAction SilentlyContinue "hott-*.$$e" }; if (Get-Command latexmk -ErrorAction SilentlyContinue) { latexmk -interaction=batchmode -C hott-*.tex }
else
rm -f *~ *.aux {exercise_solutions,errata,hott-*}.{out,log,pdf,dvi,fls,fdb_latexmk,aux,brf,bbl,idx,ilg,ind,toc,sed}
if which latexmk > /dev/null 2>&1 ; then latexmk -interaction=batchmode -C hott-*.tex; fi
endif
# list the tex files explicitly because:
# - we want to tag them in the same order they appear in the book, so tag search is in logical sequence
# - there are many *.tex garbage files in this directory
TAGS: $(TEXFILES) exercise_solutions.tex errata.tex
etags $^ -o $@.tmp
mv $@.tmp $@
indexterms.txt: \
other/index-helper.py \
front.tex \
preface.tex \
introduction.tex \
preliminaries.tex \
basics.tex \
logic.tex \
equivalences.tex \
induction.tex \
hits.tex \
hlevels.tex \
homotopy.tex \
categories.tex \
setmath.tex \
reals.tex \
formal.tex
other/index-helper.py >$@
|