PROJECTNAME=Jauslin_Lebowitz_2017 LIBS=$(patsubst libs/%, %, $(wildcard libs/*)) FIGS=$(patsubst figs/%, %, $(wildcard figs/*)) all: $(PROJECTNAME) $(PROJECTNAME): $(LIBS) $(FIGS) pdflatex -file-line-error $(PROJECTNAME).tex pdflatex $(PROJECTNAME).tex pdflatex -synctex=1 $(PROJECTNAME).tex $(LIBS): ln -fs libs/$@ ./ $(FIGS): make -C figs/$@ ln -fs figs/$@/*.pdf ./ clean-aux: rm -f $(PROJECTNAME).aux rm -f $(PROJECTNAME).log rm -f $(PROJECTNAME).out rm -f $(PROJECTNAME).toc clean-libs: rm -f $(LIBS) clean-tex: rm -f $(PROJECTNAME).pdf rm -f $(PROJECTNAME).synctex.gz clean-figs: for fig in $(FIGS); do make -C figs/"$$fig" clean; done clean-figs-aux: for fig in $(FIGS); do make -C figs/"$$fig" clean-aux; done clean: clean-aux clean-tex clean-libs clean-figs