forked from ryankeleti/ega
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (83 loc) · 2.31 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
# modified from https://github.com/stacks/stacks-project
# see scripts/README.md
FILES = what intro ega0 ega1 ega2 ega3 ega4 ref
TEX = $(patsubst %,%.tex,$(FILES))
PDFS = $(patsubst %,%.pdf,$(FILES))
PDFLATEX = pdflatex
PDF_DIR = $(CURDIR)/pdfs
WEBNAME = ega
.PHONY: default
default: $(TEX)
@echo "make pdfs --- makes all pdfs"
@echo "make book --- makes complete book pdf"
@echo "make all --- make pdfs + make book"
@echo "make auto --- make all, but for server"
@echo "make clean --- clean up"
@echo "make cleanaux --- clean up auxiliary files"
@echo "make cleanforce --- clean up everything without prompt"
.PHONY: pdfs
pdfs: $(PDFS)
%.pdf: %.tex
$(PDFLATEX) $*
$(PDFLATEX) $*
if [ $* != what ]; then bibtex $*; fi
$(PDFLATEX) $*
$(PDFLATEX) $*
mkdir -p $(PDF_DIR)
mv $*.pdf $(PDF_DIR)
$(FILES): %: %.pdf
.PHONY: book
book:
python3 ./scripts/make_book.py $(CURDIR)
$(PDFLATEX) book
$(PDFLATEX) book
bibtex book
$(PDFLATEX) book
$(PDFLATEX) book
mkdir -p $(PDF_DIR)
mv book.pdf $(PDF_DIR)
.PHONY: cleanaux
cleanaux:
rm -f *.aux *.bbl *.blg *.log *.fdb_latexmk *.fls *.out *.toc
.PHONY: clean
clean:
rm -f *.aux *.bbl *.blg *.log *.fdb_latexmk *.fls *.out *.toc
if [ -f book.tex ]; then rm -i book.tex; fi
for f in *.pdf; do if [ -f "$$f" ]; then rm -i *.pdf; fi; done
if [ -d $(PDF_DIR) ]; then\
for f in $(PDF_DIR)/*.pdf; do\
if [ -f "$$f" ]; then rm -i $(PDF_DIR)/*.pdf; fi;\
break;\
done;\
rm -ir $(PDF_DIR);\
fi
.PHONY: cleanforce
cleanforce:
rm -f *.aux *.bbl *.blg *.log *.fdb_latexmk *.fls *.out *.toc *.pdf book.tex *-auto.tex ega-web.*
rm -rf $(PDF_DIR)
rm -rf tags $(WEBNAME).* $(WEBNAME)
.PHONY: all
all: pdfs book
.PHONY: auto
auto:
python3 ./scripts/make_book.py $(CURDIR)
cp book.tex book-auto.tex
sh ./scripts/add-auto-info.sh book-auto.tex
mkdir -p $(PDF_DIR)
$(PDFLATEX) book-auto
$(PDFLATEX) book-auto
bibtex book-auto
$(PDFLATEX) book-auto
$(PDFLATEX) book-auto
mv book-auto.pdf $(PDF_DIR)
for f in $(FILES); do\
cp "$$f".tex "$$f"-auto.tex;\
sh ./scripts/add-auto-info.sh "$$f"-auto.tex;\
$(PDFLATEX) "$$f"-auto;\
$(PDFLATEX) "$$f"-auto;\
bibtex "$$f"-auto;\
$(PDFLATEX) "$$f"-auto;\
$(PDFLATEX) "$$f"-auto;\
mv "$$f"-auto.pdf $(PDF_DIR);\
done
rm -f *.aux *.bbl *.blg *.log *.fdb_latexmk *.fls *.out *.toc *-auto.tex