-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (22 loc) · 997 Bytes
/
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
all: 00.pdf
-include $(shell mkdir -p .dep 2>/dev/null) $(wildcard .dep/*.d)
ifeq ($(wildcard .progress),.progress)
.DEFAULT_GOAL := progress
endif
progress: .progress
@$(MAKE) all | ./.progress
clean:
rm -f $(shell tail -n +3 .gitignore | grep -v pdf)
.progress:
@[ -x .progress ] || ( echo '#!/usr/bin/awk -f$$$$BEGIN {$$a[0] = "/"$$a[1] = "-"$$a[2] = "\\"$$a[3] = "|"$$pass = 0$$}$$$${$$if (!pass) printf "" a[(FNR - 1) % 4]$$else print$$}$$$$/pdflatex/ {$$if (!pass) printf "o "$$}$$$$/ONEXIT/ {$$if (!pass) printf ". "$$}$$$$/^!/ {$$pass = 1$$print ""$$print$$}$$$$END {$$if (!pass) print "Done."$$}$$$$' | tr $$ \\n > .progress ; chmod +x .progress )
.dep/%.tex.d: %.tex
@echo $(<:.tex=.pdf): $< $$(sed -n '/^\\input/s/.*{\([^.]*\).*}.*/\1.tex/p' $<) > $@
@echo $@: $< >> $@
%.pdf: %.tex
@echo $(<:.tex=.pdf): $< $$(sed -n '/^\\input/s/.*{\([^.]*\).*}.*/\1.tex/p' $<) > .dep/$<.d
pdflatex $<
ifneq ($(QUICK),yes)
pdflatex $<
pdflatex $<
endif
.PHONY: all progress clean