diff options
author | Ian Jauslin <ian@jauslin.org> | 2020-02-06 02:44:20 -0500 |
---|---|---|
committer | Ian Jauslin <ian@jauslin.org> | 2020-02-06 02:44:20 -0500 |
commit | 4deba4d307b679c782ea535fded5e132055d95c6 (patch) | |
tree | 0b77d1b2d6040439e0c1ada3acd820af828c88a9 /Makefile |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4f30ca1 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +PROJECTNAME=$(basename $(wildcard *.tex)) +LIBS=$(notdir $(wildcard libs/*)) +FIGS=$(notdir $(wildcard figs/*.fig)) +PNGS=$(notdir $(wildcard figs/*.png)) + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) +SYNCTEXS=$(addsuffix .synctex.gz, $(PROJECTNAME)) + +all: $(PROJECTNAME) + +$(PROJECTNAME): $(LIBS) $(FIGS) $(PNGS) + pdflatex -file-line-error $@.tex + pdflatex -synctex=1 $@.tex + +$(SYNCTEXS): $(LIBS) $(FIGS) $(PNGS) + 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 + +$(PNGS): + ln -fs figs/$@ ./ + + +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 |