# # Makefile to build TeX documents (using pdflatex of latex) # # by E.Chudakov gen@jlab.org # 20 Apr 2008 # Check the directory name topdir := $(shell /bin/pwd) topdirsp := $(shell basename $(topdir)) top := $(DOCNAME) srcdir := $(shell cd ../src ; pwd) srcdir1 := $(strip $(srcdir)) fnam :=$(srcdir)/$(top)/main.tex ifneq ($(fnam),$(wildcard $(fnam))) $(error File $(top) $(fnam) is missing) endif TEXINPUTS =.:$(srcdir1):$(srcdir1)/common:$(srcdir1)/$(top): BIBINPUTS =$(TEXINPUTS) BSTINPUTS =$(TEXINPUTS) export TEXINPUTS BIBINPUTS BSTINPUTS DVIPS = dvips LATEX = latex PDFLATEX = pdflatex MAKEINDEX = makeindex BIBTEX = bibtex .PHONY : clean .PHONY : pdf none: pdf clean: echo Clean ls -1 $(top).* | grep -v '\.tex' | xargs rm -f aux: $(top).aux pdf pdf: clean echo "Rerun" > $(top).log ; \ ln -s -f $(fnam) $(top).tex ; \ ln -s -f ../src/$(top)/title.tex . ; \ $(PDFLATEX) $(top) ;\ $(BIBTEX) $(top) nrun=1; while [ ! -z "`sed -n '/Rerun/p' < $(top).log`" ] ; do \ echo Rerun ... ; \ $(PDFLATEX) $(top) ; \ nrun=`expr $$nrun + 1` ; \ done ; \ if [ ! -z "`sed -n '/undefined references/p' < $(top).log`" ]; then \ $(PDFLATEX) $(top) ; nrun=`expr $$nrun + 1` ; \ fi ; \ echo Finished at iteration $$nrun rm -f $(top).tex ; \ rm -f title.tex # SVN info $Id: $