X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=makefile;h=331c65cd70c266c3cef55ca9a6ed7278b1a94bee;hb=6e017b796214315c5df54cf94b2504e0cff2a711;hp=7a9df645e7066ed45043c65afac036ba91211d03;hpb=22c2d3825cff157d59e5b9d22570ca2465939c6f;p=mjotex.git diff --git a/makefile b/makefile index 7a9df64..331c65c 100644 --- a/makefile +++ b/makefile @@ -6,11 +6,14 @@ LATEX = pdflatex -file-line-error -halt-on-error # The name of this document. -PN := paper +PN = examples # A space-separated list of bib files. These must all belong to paths # contained in your $BIBINPUTS environment variable. -BIBS = references.bib +# +# Leave commented if you don't use a bibliography file. +# +#BIBS = references.bib # A space-separated list of the mjotex files that you use. The path to # mjotex must be contain in your $TEXINPUTS environment variable. @@ -22,7 +25,15 @@ MJOTEX += mjo-theorem-star.tex mjo-topology.tex # Use kpsewhich (from the kpathsea suite) to find the absolute paths # of the bibtex/mjotex files listed in in $(BIBS)/$(MJOTEX). The SRCS # variable should contain all (Bib)TeX source files for the document. -SRCS = $(PN).tex $(shell kpsewhich $(BIBS)) $(shell kpsewhich $(MJOTEX)) +SRCS = $(PN).tex +ifdef BIBS +BIBPATHS = $(shell kpsewhich $(BIBS)) +SRCS += $(BIBPATHS) +endif +ifdef MJOTEX +MJOTEXPATHS = $(shell kpsewhich $(MJOTEX)) +SRCS += $(MJOTEXPATHS) +endif # The first target is the default, so put the PDF document first. @@ -95,20 +106,28 @@ $(PN).aux: $(SRCS) # As a side effect, we now need to depend on $(SRCS) here, since we # won't pick it up transitively from $(PN).aux. # +# If the $BIBS variable is undefined, we presume that there are no +# references and create an empty bbl file. Otherwise, we risk trying +# to run biblatex on an aux file containing no citations. +# $(PN).bbl: $(SRCS) | $(PN).aux +ifdef BIBS bibtex $(PN).aux - +else + echo -n '' > $@ +endif # Run chktex to find silly mistakes. There is some exit code weirdness # (Savannah bug 45979), so we just look for empty output. .PHONY: check check: - @[ -z "$(shell chktex -q mjotex.sty)" ] + @[ -z "$(shell chktex --quiet mjotex.sty)" ] # Clean up leftover junk. .PHONY: clean clean: - rm -f *.{aux,bbl,bcf,bib,blg,lof,log,nav,out,pdf,snm,toc,xml} + rm -f *.{aux,bbl,bcf,bib,blg,listing,lof,log} + rm -f *.{nav,out,pdf,snm,spl,toc,xml} rm -rf dist/ # If this document will be published, the publisher isn't going to @@ -119,4 +138,4 @@ clean: .PHONY: dist dist: $(PN).bbl mkdir -p dist - cp $(SRCS) $(PN).bbl dist/ + cp $(SRCS) $(PN).bbl $(BIBPATHS) $(MJOTEXPATHS) dist/