forked from stacks/stacks-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
242 lines (195 loc) · 6.81 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
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
241
242
# Known suffixes.
.SUFFIXES: .aux .bbl .bib .blg .dvi .htm .html .css .log .out .pdf .ps .tex \
.toc .foo .bar
# Master list of stems of tex files in the project.
# This should be in order.
LIJST = introduction conventions sets categories \
topology sheaves sites stacks \
fields algebra brauer \
homology derived simplicial \
more-algebra smoothing \
modules sites-modules \
injectives cohomology sites-cohomology dga dpa hypercovering \
schemes constructions properties morphisms coherent divisors limits \
varieties topologies descent perfect more-morphisms flat groupoids \
more-groupoids etale \
chow intersection \
adequate dualizing etale-cohomology crystalline proetale \
spaces spaces-properties spaces-morphisms decent-spaces \
spaces-cohomology spaces-limits spaces-divisors spaces-over-fields \
spaces-topologies \
spaces-descent spaces-perfect spaces-more-morphisms spaces-pushouts \
spaces-groupoids spaces-more-groupoids bootstrap \
groupoids-quotients spaces-simplicial formal-spaces restricted resolve \
formal-defos defos cotangent \
algebraic examples-stacks stacks-sheaves criteria artin quot \
stacks-properties stacks-morphisms stacks-cohomology stacks-perfect \
stacks-introduction \
examples exercises guide \
desirables coding obsolete
# Add index and fdl to get index and license latexed as well.
LIJST_FDL = $(LIJST) fdl index
# Add book to get all stems of tex files needed for tags
LIJST_TAGS = $(LIJST_FDL) book
# Different extensions
SOURCES = $(patsubst %,%.tex,$(LIJST))
TAGS = $(patsubst %,tags/tmp/%.tex,$(LIJST_TAGS))
TAG_EXTRAS = tags/tmp/my.bib tags/tmp/hyperref.cfg \
tags/tmp/stacks-project.cls tags/tmp/stacks-project-book.cls \
tags/tmp/Makefile tags/tmp/chapters.tex \
tags/tmp/preamble.tex tags/tmp/bibliography.tex
FOO_SOURCES = $(patsubst %,%.foo,$(LIJST))
FOOS = $(patsubst %,%.foo,$(LIJST_FDL))
BARS = $(patsubst %,%.bar,$(LIJST_FDL))
PDFS = $(patsubst %,%.pdf,$(LIJST_FDL))
DVIS = $(patsubst %,%.dvi,$(LIJST_FDL))
# Be careful. Files in INSTALLDIR will be overwritten!
INSTALLDIR=
# Default latex commands
LATEX := latex -src
#LATEX := ./scripts/latex.sh "$(CURDIR)" "latex -src"
PDFLATEX := pdflatex
#PDFLATEX := ./scripts/latex.sh "$(CURDIR)" pdflatex
FOO_LATEX := $(LATEX)
#FOO_LATEX := $(PDFLATEX)
# Currently the default target runs latex once for each updated tex file.
# This is what you want if you are just editing a single tex file and want
# to look at the resulting dvi file. It does latex the license of the index.
# We use the aux file to keep track of whether the tex file has been updated.
.PHONY: default
default: $(FOO_SOURCES)
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
@echo "% This target latexs each updated tex file just once. %"
@echo "% See the file documentation/make-project for others. %"
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
# Target which creates all dvi files of chapters
.PHONY: dvis
dvis: $(FOOS) $(BARS) $(DVIS)
# Target which creates all pdf files of chapters
.PHONY: pdfs
pdfs: $(FOOS) $(BARS) $(PDFS)
# We need the following to cancel the built-in rule for
# dvi files (which uses tex not latex).
%.dvi : %.tex
# Automatically generated tex files
tmp/index.tex: *.tex
python ./scripts/make_index.py "$(CURDIR)" > tmp/index.tex
tmp/book.tex: *.tex tmp/index.tex
python ./scripts/make_book.py "$(CURDIR)" > tmp/book.tex
# Creating aux files
index.foo: tmp/index.tex
$(FOO_LATEX) tmp/index
touch index.foo
book.foo: tmp/book.tex
$(FOO_LATEX) tmp/book
touch book.foo
%.foo: %.tex
$(FOO_LATEX) $*
touch $*.foo
# Creating bbl files
index.bar: tmp/index.tex index.foo
@echo "Do not need to bibtex index.tex"
touch index.bar
fdl.bar: fdl.tex fdl.foo
@echo "Do not need to bibtex fdl.tex"
touch fdl.bar
book.bar: tmp/book.tex book.foo
bibtex book
touch book.bar
%.bar: %.tex %.foo
bibtex $*
touch $*.bar
# Creating pdf files
index.pdf: tmp/index.tex index.bar $(FOOS)
$(PDFLATEX) tmp/index
$(PDFLATEX) tmp/index
book.pdf: tmp/book.tex book.bar
$(PDFLATEX) tmp/book
$(PDFLATEX) tmp/book
%.pdf: %.tex %.bar $(FOOS)
$(PDFLATEX) $*
$(PDFLATEX) $*
# Creating dvi files
index.dvi: tmp/index.tex index.bar $(FOOS)
$(LATEX) tmp/index
$(LATEX) tmp/index
book.dvi: tmp/book.tex book.bar
$(LATEX) tmp/book
$(LATEX) tmp/book
%.dvi : %.tex %.bar $(FOOS)
$(LATEX) $*
$(LATEX) $*
#
#
# Tags stuff
#
#
tags/tmp/book.tex: tmp/book.tex tags/tags
python ./scripts/tag_up.py "$(CURDIR)" book > tags/tmp/book.tex
tags/tmp/index.tex: tmp/index.tex
cp tmp/index.tex tags/tmp/index.tex
tags/tmp/preamble.tex: preamble.tex tags/tags
python ./scripts/tag_up.py "$(CURDIR)" preamble > tags/tmp/preamble.tex
tags/tmp/chapters.tex: chapters.tex
cp chapters.tex tags/tmp/chapters.tex
tags/tmp/%.tex: %.tex tags/tags
python ./scripts/tag_up.py "$(CURDIR)" $* > tags/tmp/$*.tex
tags/tmp/stacks-project.cls: stacks-project.cls
cp stacks-project.cls tags/tmp/stacks-project.cls
tags/tmp/stacks-project-book.cls: stacks-project-book.cls
cp stacks-project-book.cls tags/tmp/stacks-project-book.cls
tags/tmp/hyperref.cfg: hyperref.cfg
cp hyperref.cfg tags/tmp/hyperref.cfg
tags/tmp/my.bib: my.bib
cp my.bib tags/tmp/my.bib
tags/tmp/Makefile: tags/Makefile
cp tags/Makefile tags/tmp/Makefile
# Target dealing with tags
.PHONY: tags
tags: $(TAGS) $(TAG_EXTRAS)
@echo "TAGS TARGET"
$(MAKE) -C tags/tmp
.PHONY: tags_install
tags_install: tags tarball
ifndef INSTALLDIR
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
@echo "% Set INSTALLDIR value in the Makefile! %"
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
else
cp tags/tmp/*.pdf $(INSTALLDIR)
tar -c -f $(INSTALLDIR)/stacks-pdfs.tar --exclude book.pdf --transform=s@tags/tmp@stacks-pdfs@ tags/tmp/*.pdf
git archive --format=tar HEAD | (cd $(INSTALLDIR) && tar xf -)
cp stacks-project.tar.bz2 $(INSTALLDIR)
git log --pretty=oneline -1 > $(INSTALLDIR)/VERSION
endif
.PHONY: tags_clean
tags_clean:
rm -f tags/tmp/*
rm -f tmp/book.tex tmp/index.tex
rm -f stacks-project.tar.bz2
# Additional targets
.PHONY: book
book: book.foo book.bar book.dvi book.pdf
.PHONY: clean
clean:
rm -f *.aux *.bbl *.blg *.dvi *.log *.pdf *.ps *.out *.toc *.foo *.bar
rm -f tmp/book.tex tmp/index.tex
rm -f stacks-project.tar.bz2
.PHONY: distclean
distclean: clean tags_clean
.PHONY: backup
backup:
git archive --prefix=stacks-project/ HEAD | bzip2 > \
../stacks-project_backup.tar.bz2
.PHONY: tarball
tarball:
git archive --prefix=stacks-project/ HEAD | bzip2 > stacks-project.tar.bz2
# Target which makes all dvis and all pdfs, as well as the tarball
.PHONY: all
all: dvis pdfs book tarball
.PHONY: install
install:
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
@echo "% To install the project, use the tags_install target %"
@echo "% Be sure to change INSTALLDIR value in the Makefile! %"
@echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"