BASENAME=scientificcomputing-script SUBDIRS=programming debugging plotting codestyle statistics bootstrap regression likelihood pointprocesses designpattern SUBTEXS=$(foreach subd, $(SUBDIRS), $(subd)/lecture/$(subd).tex) all : script chapters chapters : for sd in $(SUBDIRS); do $(MAKE) -C $$sd/lecture chapter; done script : plots $(BASENAME).pdf plots : for sd in $(SUBDIRS); do $(MAKE) -C $$sd/lecture plots; done pdf : $(BASENAME).pdf $(BASENAME).pdf : $(BASENAME).tex header.tex $(SUBTEXS) pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true splitindex $(BASENAME).idx index : pdflatex $(BASENAME).tex splitindex $(BASENAME).idx pdflatex $(BASENAME).tex pdflatex $(BASENAME).tex again : pdflatex $(BASENAME).tex watchpdf : while true; do ! make -s -q pdf && make pdf; sleep 0.5; done watchscript : while true; do ! make -s -q script && make script; sleep 0.5; done cleanplots: for sd in $(SUBDIRS); do $(MAKE) -C $$sd/lecture cleanplots; done cleantex: rm -f *~ $(BASENAME).aux $(BASENAME).log $(BASENAME).out $(BASENAME)-solutions.tex $(BASENAME).toc $(BASENAME).lo? $(BASENAME).idx $(BASENAME)-term.i* $(BASENAME)-enterm.i* $(BASENAME)-code.i* for sd in $(SUBDIRS); do $(MAKE) -C $$sd/lecture cleantex; done clean : cleantex for sd in $(SUBDIRS); do $(MAKE) -C $$sd/lecture clean; done cleanall : clean rm -f $(BASENAME).pdf for sd in $(SUBDIRS); do $(MAKE) -C $$sd/lecture cleanall; done