# # Makefile for LaTeX projects # Author: Stanislav Kruchinin # TARGET=thesis TEX=latex BIBTEX=bibtex8 PDFLATEX=pdflatex L2H=latex2html FIND=/bin/find TEXFLAGS=-src-specials BIBTEXFLAGS=-B -c cp1251 L2HFLAGS=-dir html -iso_language RU.RU -split 3 -short_index \ -numbered_footnotes -no_footnode -white -antialias \ -html_version 4.0 SRC=$(TARGET).tex # Files to remove. CLEANEXT=*.aux *.toc *.idx *.ind *.ilg *.log *.out *.lof *.lot *.lol \ *.bbl *.blg *.bak *.dvi CLEANFILES=$(TARGET).pdf $(TARGET).ps $(TARGET)_2on1.ps $(TARGET)_2on1.pdf \ $(TARGET).tar.bz2 # Targets dvi: $(TARGET).dvi ps: $(TARGET).ps pdf: $(TARGET).pdf html: $(SRC) $(TEX) $(TARGET).tex $(BIBTEX) $(BIBTEXFLAGS) $(TARGET) ;\ $(TEX) $(TARGET).tex $(L2H) $(L2HFLAGS) $(TARGET).tex ps_2on1: $(TARGET)_2on1.ps pdf_2on1: $(TARGET)_2on1.pdf help: @echo "run: make or make dvi or make $(TARGET).dvi" @echo "run: make ps or make $(TARGET).ps" @echo "run: make pdf or make $(TARGET).pdf" @echo "run: make html" @echo "run: make ps_2on1 or make $(TARGET)_2on1.ps" @echo "run: make pdf_2on1 or make $(TARGET)_2on1.pdf" @echo "run: make srcdist to create archive $(TARGET).tar.bz2" @echo "run: make clean to remove (pdf)TeX ouptut files" @echo "run: make cleansvn to \"make clean\" and remove .svn directories" $(TARGET).dvi: $(SRC) $(TEX) $(TEXFLAGS) $(TARGET).tex $(BIBTEX) $(BIBTEXFLAGS) $(TARGET) ;\ counter=3 ; \ while egrep -s 'Rerun (LaTeX|to get)' $(TARGET).log && [ $$counter -gt 0 ] ;\ do \ $(TEX) $(TEXFLAGS) $(TARGET).tex ;\ counter=`expr $$counter - 1` ;\ done $(TARGET).ps: $(TARGET).dvi dvips -o $(TARGET).ps $(TARGET).dvi $(TARGET).pdf: $(SRC) @$(MAKE) -C fig fixbb pdf $(PDFLATEX) $(TARGET).tex $(BIBTEX) $(BIBTEXFLAGS) $(TARGET) ;\ counter=3 ; \ echo "counter=$counter" ; \ while egrep -s 'Rerun (LaTeX|to get)' $(TARGET).log && [ $$counter -gt 0 ] ;\ do \ $(PDFLATEX) $(TARGET).tex ;\ counter=`expr $$counter - 1` ;\ done $(TARGET)_2on1.ps: $(TARGET).ps psnup -2 $^ > $@ $(TARGET)_2on1.pdf: $(TARGET)_2on1.ps ps2pdf $^ $@ fixbb: fig/*.eps @$(MAKE) -C fig fixbb srcdist: @$(MAKE) clean tar cjvf $(TARGET).tar.bz2 . clean: rm -f $(CLEANEXT) $(CLEANFILES) rm -f html/*\.* @$(MAKE) -C fig clean cleansvn: @$(MAKE) clean $(FIND) . -name ".svn" -exec rm -Rf \{\} \;