23j_b/Makefile

56 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2023-02-27 00:10:42 +00:00
PROJECTNAME=$(basename $(wildcard *.tex))
FIGS=$(notdir $(wildcard figs/*.fig))
PDFS=$(addsuffix .pdf, $(PROJECTNAME))
SYNCTEXS=$(addsuffix .synctex.gz, $(PROJECTNAME))
all: $(PROJECTNAME)
$(PROJECTNAME): $(FIGS)
pdflatex -file-line-error $@.tex
pdflatex -file-line-error $@.tex
pdflatex -synctex=1 $@.tex
$(PROJECTNAME).aux: $(FIGS)
pdflatex -file-line-error -draftmode $(PROJECTNAME).tex
$(SYNCTEXS): $(FIGS)
pdflatex -synctex=1 $(patsubst %.synctex.gz, %.tex, $@)
$(PROJECTNAME).bbl: $(PROJECTNAME).aux bibliography.bib
bibtex $(PROJECTNAME).aux
figs: $(FIGS)
$(FIGS):
make -C figs/$@
for pdf in $$(find figs/$@/ -name '*.pdf'); do ln -fs "$$pdf" ./ ; done
clean-aux: clean-figs-aux
rm -f $(addsuffix .aux, $(PROJECTNAME))
rm -f $(addsuffix .log, $(PROJECTNAME))
rm -f $(addsuffix .out, $(PROJECTNAME))
rm -f $(addsuffix .toc, $(PROJECTNAME))
rm -f $(addsuffix .blg, $(PROJECTNAME))
rm -f $(addsuffix Notes.bib, $(PROJECTNAME))
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-bibliography:
rm -f $(PROJECTNAME).bbl
clean: clean-aux clean-tex clean-figs