# # Makefile to build TeX documents (using pdflatex of latex) # # by E.Chudakov gen@jlab.org # 20 Apr 2008 # Update 26 Sep 2011 - another layer in the tree of directories # Check the directory name topdir := $(shell /bin/pwd) topdirsp := $(shell basename $(topdir)) top := $(DOCNAME) srcdir := $(shell cd ../../src ; pwd) srcdir1 := $(strip $(srcdir)) fnam :=$(srcdir)/mains/$(top)/main.tex ifneq ($(fnam),$(wildcard $(fnam))) $(error File $(top) $(fnam) is missing) endif TEXINPUTS =.:$(srcdir1)/mains/$(top):$(srcdir1):$(srcdir1)/texnical: 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 to get" > $(top).log ; \ ln -s -f $(fnam) $(top).tex ; \ $(PDFLATEX) $(top) ;\ $(BIBTEX) $(top) nrun=1; while [ ! -z "`sed -n '/Rerun to get/p' < $(top).log`" ] ; do \ echo Rerun ... ; \ $(PDFLATEX) $(top) ; \ nrun=`expr $$nrun + 1` ; \ done ; echo Finished at iteration $$nrun rm -f $(top).tex pdfnb: clean echo "Rerun to get" > $(top).log ; \ ln -s -f $(fnam) $(top).tex ; \ $(PDFLATEX) $(top) ;\ nrun=1; while [ ! -z "`sed -n '/Rerun to get/p' < $(top).log`" ] ; do \ echo Rerun ... ; \ $(PDFLATEX) $(top) ; \ nrun=`expr $$nrun + 1` ; \ done ; echo Finished at iteration $$nrun rm -f $(top).tex ps: clean echo "Rerun to get" > $(top).log ; \ ln -s -f $(fnam) $(top).tex ; \ ln -s -f ../src/$(top)/title.tex . ; \ $(LATEX) $(top) ;\ $(BIBTEX) $(top) nrun=1; while [ ! -z "`sed -n '/Rerun to get/p' < $(top).log`" ] ; do \ echo Rerun ... ; \ $(LATEX) $(top) ; \ nrun=`expr $$nrun + 1` ; \ done ; echo Finished at iteration $$nrun $(DVIPS) -f $(top) > $(top).ps rm -f $(top).tex talk: clean ln -s -f $(fnam) $(top).tex ; \ $(PDFLATEX) $(top) ;\ $(PDFLATEX) $(top) ;\ rm -f $(top).tex # =========== SVN info # $Header$ # $Author$