MAIN = exfserm SOURCE = exfser PROBLEM = exfserp SCRIPT = exfsermk.sh MAKEFILE = exfsermk.mak TARGETLIST = Problems Solutions SHEETNUM = 01 02 03 aa PREREQS = $(MAIN).tex SOURCES = $(SHEETNUM:%=$(SOURCE)%.tex) SHEETS = $(foreach trg,$(TARGETLIST),$(trg).pdf $(SHEETNUM:%=$(trg)%.pdf)) TARGETS = $(foreach trg,$(TARGETLIST),$(trg).pdf) GENFILES = $(foreach trg,$(TARGETLIST),$(trg).tex $(SHEETNUM:%=$(trg)%.tex)) BAKFILES = $(SOURCES) $(MAIN).tex $(MAKEFILE) $(SCRIPT) $(PROBLEM)* default: sheets ; sheets: $(SHEETS) ; main: $(TARGETS) ; sheet%: $(foreach trg,$(TARGETLIST),$(trg)%.pdf) ; all: main sheets ; sources: $(GENFILES) ; $(TARGETS): $(SOURCES) $(PREREQS) bash ./$(SCRIPT) $@ $(word 1,$(TARGETLIST))%.pdf: $(SOURCE)%.tex $(PREREQS) bash ./$(SCRIPT) $@ $(word 2,$(TARGETLIST))%.pdf: $(SOURCE)%.tex $(PREREQS) bash ./$(SCRIPT) $@ $(GENFILES): bash ./$(SCRIPT) $@ touch: touch $(MAIN).tex clean: rm -f $(SHEETNUM:%=$(SOURCE)%.aux) rm -f $(SHEETNUM:%=$(SOURCE)%.log) rm -f $(foreach trg,$(TARGETLIST),$(SHEETNUM:%=$(trg)%.log) $(trg).log) rm -f $(patsubst %,$(MAIN)%,.aux .log .out .toc) rm -f $(patsubst %,$(MAIN)%,.mp .mpx -*.mps -tmp.log -tmp.mp -tmp.mpx) rm -f mpxerr.tex mpxerr.log mpxerr.dvi texput.log rm -f $(patsubst %,$(PROBLEM)*%,.aux .log .mp .mpx -*.mps) rm -f $(patsubst %,$(PROBLEM)*%,-tmp.log -tmp.mp -tmp.mpx) clean-bak: rm -f $(BAKFILES:%=%~) $(BAKFILES:%=%.bak) clean-all: clean rm -f $(SHEETS) $(TARGETS) rm -f $(SHEETNUM:%=$(SOURCE)%.pdf) $(MAIN).pdf rm -f $(foreach trg,$(TARGETLIST),$(SHEETNUM:%=$(trg)%.tex) $(trg).tex) rm -f $(PROBLEM)*.pdf