| 1 |
########################################################################### |
| 2 |
# Automating proposal management by make. |
| 3 |
# The participants work on proposal.tex in "draft" mode, which gives a lot |
| 4 |
# of information to the developers. Variants submit.tex and public.tex are |
| 5 |
# used to prepare official versions (hiding development/private info). |
| 6 |
########################################################################### |
| 7 |
# possibly customize the following variables to your setting |
| 8 |
PROPOSAL = propB.tex # the proposal |
| 9 |
BIB = ../lib/dummy.bib # bibTeX databases |
| 10 |
PROP.dir = ../../.. |
| 11 |
########################################################################### |
| 12 |
# the following are computed |
| 13 |
TSIMP = # pdflatex Targets without bibTeX |
| 14 |
TSIMP.pdf = $(TSIMP:%.tex=%.pdf) # PDFs to be produced |
| 15 |
TBIB = $(PROPOSAL) # pdflatex Targets with bibTeX |
| 16 |
TARGET = $(TSIMP) $(TBIB) # all pdflatex targets |
| 17 |
TBIB.pdf = $(TBIB:%.tex=%.pdf) # PDFs to be produced |
| 18 |
TBIB.aux = $(TBIB:%.tex=%.aux) # their aux files. |
| 19 |
PDATA = $(PROPOSAL:%.tex=%.pdata) # the proposal project data |
| 20 |
SRC = $(filter-out $(TARGET),$(shell ls *.tex)) # included files |
| 21 |
PDFLATEX = pdflatex -interaction batchmode -file-line-error |
| 22 |
BBL.base = 1 2 3 4 |
| 23 |
BBL = $(PROPOSAL:%.tex=%.bbl) $(BBL.base:%=$(PROPOSAL:%.tex=%)%-blx.bbl) |
| 24 |
PROPCLS.dir = $(PROP.dir)/base |
| 25 |
PROPETC.dir = $(PROP.dir)/etc |
| 26 |
EUPROPCLS.dir = $(PROP.dir)/eu |
| 27 |
TEXINPUTS := .//:$(PROPCLS.dir)//:$(EUPROPCLS.dir)//:$(PROPETC.dir)//: |
| 28 |
BIBINPUTS := ../lib:$(BIBINPUTS) |
| 29 |
PROPCLS.clssty = proposal.cls pdata.sty |
| 30 |
PROPETC.sty = workaddress.sty metakeys.sty sref.sty |
| 31 |
EUPROPCLS.clssty = euproposal.cls |
| 32 |
PROPCLS = $(PROPCLS.clssty:%=$(PROPCLS.dir)/%) $(EUPROPCLS.clssty:%=$(EUPROPCLS.dir)/%) $(PROPETC.sty:%=$(PROPETC.dir)/%) |
| 33 |
|
| 34 |
all: $(TBIB.pdf) $(TSIMP.pdf) |
| 35 |
|
| 36 |
submit: |
| 37 |
$(MAKE) -w PROPOSAL=final.tex all |
| 38 |
|
| 39 |
public: |
| 40 |
$(MAKE) -w PROPOSAL=public.tex all |
| 41 |
|
| 42 |
bbl: $(BBL) |
| 43 |
$(BBL): %.bbl: %.aux |
| 44 |
bibtex -min-crossrefs=100 -terse $< |
| 45 |
|
| 46 |
$(TSIMP.pdf): %.pdf: %.tex $(PROPCLS) $(PDATA) |
| 47 |
$(PDFLATEX) $< || $(RM) $@ |
| 48 |
|
| 49 |
$(PDATA): %.pdata: %.tex |
| 50 |
$(PDFLATEX) $< |
| 51 |
|
| 52 |
$(TBIB.aux): %.aux: %.tex |
| 53 |
$(PDFLATEX) $< |
| 54 |
|
| 55 |
$(TBIB.pdf): %.pdf: %.tex $(SRC) $(BIB) $(PROPCLS) |
| 56 |
$(PDFLATEX) $< || $(RM) $@ |
| 57 |
sort $(PROPOSAL:%.tex=%.delivs) > $(PROPOSAL:%.tex=%.deliverables) |
| 58 |
@if (test -e $(patsubst %.tex, %.idx, $<));\ |
| 59 |
then makeindex $(patsubst %.tex, %.idx, $<); fi |
| 60 |
$(MAKE) -$(MAKEFLAGS) $(BBL) |
| 61 |
@if (grep "(re)run BibTeX" $(patsubst %.tex, %.log, $<)> /dev/null);\ |
| 62 |
then $(MAKE) -B $(BBL); fi |
| 63 |
$(PDFLATEX) $< || $(RM) $@ |
| 64 |
@if (grep Rerun $(patsubst %.tex, %.log, $<) > /dev/null);\ |
| 65 |
then $(PDFLATEX) $< || $(RM) $@; fi |
| 66 |
@if (grep Rerun $(patsubst %.tex, %.log, $<) > /dev/null);\ |
| 67 |
then $(PDFLATEX) $< || $(RM) $@; fi |
| 68 |
|
| 69 |
clean: |
| 70 |
rm -f *.log *.blg *~ *.synctex.gz *.cut |
| 71 |
|
| 72 |
distclean: clean |
| 73 |
rm -f *.aux *.out *.run.xml *.bbl *.toc *.deliv* *.pdata |
| 74 |
rm -Rf auto |
| 75 |
|
| 76 |
echo: |
| 77 |
echo $(BBL) |