diff options
author | Ian Jauslin <jauslin@ias.edu> | 2019-05-14 11:28:19 -0400 |
---|---|---|
committer | Ian Jauslin <jauslin@ias.edu> | 2019-05-14 11:28:19 -0400 |
commit | f34f94a8fd01975cf2e17a8a8a7e04665aed1cca (patch) | |
tree | 102901914bcfd8f117afa2d9127c429d7ad64573 /Makefile |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4ed7b60 --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +PROJECTNAME=$(basename $(wildcard *.tex)) +LIBS=$(notdir $(wildcard libs/*)) +FIGS=$(notdir $(wildcard figs/*.fig)) + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) +SYNCTEXS=$(addsuffix .synctex.gz, $(PROJECTNAME)) + +all: $(PROJECTNAME) + +$(PROJECTNAME): $(LIBS) $(FIGS) images + pdflatex -file-line-error $@.tex + pdflatex -synctex=1 $@.tex + +$(SYNCTEXS): $(LIBS) $(FIGS) images + pdflatex -synctex=1 $(patsubst %.synctex.gz, %.tex, $@) + + +$(LIBS): + ln -fs libs/$@ ./ + + +$(FIGS): + make -C figs/$@ + for pdf in $$(find figs/$@/ -name '*.pdf'); do ln -fs "$$pdf" ./ ; done + +images: + for jpg in figs/*.jpg; do ln -fs "$$jpg" ./ ; done + for png in figs/*.png; do ln -fs "$$png" ./ ; done + + +clean-aux: clean-figs-aux + rm -f $(addsuffix .aux, $(PROJECTNAME)) + rm -f $(addsuffix .log, $(PROJECTNAME)) + rm -f $(addsuffix .out, $(PROJECTNAME)) + +clean-libs: + rm -f $(LIBS) + +clean-figs: + $(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean; ) + rm -f $(notdir $(wildcard figs/*.fig/*.pdf)) + +clean-figs-aux: + $(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean-aux; ) + + +clean-tex: + rm -f $(PDFS) $(SYNCTEXS) + +clean: clean-aux clean-tex clean-libs clean-figs |