# this is # ---------------------------------------------------------------------------- # Copyright (c) 2010 by Daniel Armbruster # ---- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ---- # Daniel Armbruster 2010/06/25 # # REVISIONS and CHANGES # 25/06/2010 V1.0 Daniel Armbruster # 18/08/2010 V1.1 translate help into english # 02/07/2011 V1.2 complete update # # all: pdf default: ps ########################################### # Your settings. ############################################ MAIN=manual IMGDIR=img #PDFIMAGES=$(addsuffix .pdf, $(basename $(wildcard $(IMGDIR)/*))) #EPSIMAGES=$(addsuffix .eps, $(basename $(wildcard $(IMGDIR)/*))) TABLEDIR=tab TABLES= # ============================================================================= LATEX=/usr/bin/latex PDFLATEX=/usr/bin/pdflatex LATEXFLAGS=-interaction=nonstopmode PS2PDFFLAGS=-dAutoRotatePages=true GSCHEM=/usr/bin/gschem CONVERT=/usr/bin/convert ZIP=/usr/bin/zip -r TAR=tar -zvcf ECHO=echo DVIPSOPTS= BIBTEX=bibtex FEATURES=index abbr bib DEL=rm -rvf TEXFILES = $(wildcard *.tex) PICS = $(wildcard ./$(IMGDIR)/*) # ============================================================================= .PHONY: clean clean: ; -/bin/rm -vf $(MAIN).pdf -/bin/rm -vf $(MAIN).ps -find . -name \*.eps | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.toc | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.log | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.lof | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.lot | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.aux | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.dvi | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.nav | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.snm | xargs --no-run-if-empty /bin/rm -vf -find . -name \*.out | xargs --no-run-if-empty /bin/rm -vf # ============================================================================= # pattern rules # ============================================================================= .SUFFIXES: .SUFFIXES: .pdf .tex .ps .dvi .png .gif .bmp .jpg .eps .fig .csv .sch .svg .gpt .tex.pdf: $(PDFLATEX) $(LATEXFLAGS) $< $(PDFLATEX) $(LATEXFLAGS) $< $(PDFLATEX) $(LATEXFLAGS) $< .tex.dvi: $(LATEX) $(LATEXFLAGS) $< $(LATEX) $(LATEXFLAGS) $< $(LATEX) $(LATEXFLAGS) $< .dvi.ps: dvips $(DVIPSOPTS) $< .bmp.png: $(CONVERT) $< $@ .eps.png: $(CONVERT) $< $@ .jpg.png: $(CONVERT) $< $@ .gif.png: $(CONVERT) $< $@ .jpg.eps: $(CONVERT) $< $@ .svg.eps: inkscape $< --export-eps=$@ .gif.eps: $(CONVERT) $< $@ .fig.eps: fig2dev -L eps $< $@ .bmp.eps: $(CONVERT) $< $@ .png.eps: $(CONVERT) $< $@ .ps.eps: ps2eps -f $< .eps.pdf: epstopdf $< .svg.pdf: inkscape $< --export-pdf=$@ .ps.pdf: ps2pdf $(PS2PDFFLAGS) $< $@ .fig.pdf: fig2dev -L eps $< $@.eps epstopdf $@.eps -o=$@ rm $@.eps .gpt.ps: gnuplot $< .sch.ps: $(GSCHEM) -q -s /usr/share/gEDA/scheme/print.scm -o $(notdir $@) $< .csv.tex: cat $< | sed "s/;/\t\&\t/g"|sed 's/$$/\t\\\\/g'|sed 's/\"//g' > $@ # ============================================================================= # pdflatex, latex pdfimages: $(PDFIMAGES) mkdir -p $(IMGDIR) cd $(IMGDIR) $(MAKE) $< epsimages: $(EPSIMAGES) mkdir -p $(IMGDIR) cd $(IMGDIR) $(MAKE) $< ifdef PDFIMAGES pdf: pdfimages rm -f $(MAIN).pdf $(MAKE) $(MAIN).pdf else pdf: rm -f $(MAIN).pdf $(MAKE) $(MAIN).pdf endif ifdef EPSIMAGES dvi: epsimages $(MAKE) $(MAIN).dvi else dvi: epsimages $(MAKE) $(MAIN).dvi endif ps: dvi rm -f $(MAIN).ps $(MAKE) $(MAIN).ps # ============================================================================= # bibliography, index, and list of abbreviations index: $(MAIN).ind $(MAIN).ilg abbr: $(MAIN).nls bib: $(MAIN).blg $(MAIN).bbl # preparation $(MAIN).idx $(MAIN).nlo $(MAIN).aux: $(MAIN).tex $(LATEX) $(LATEXFLAGS) $(MAIN).tex # index (rule: index) $(MAIN).ind $(MAIN).ilg: $(MAIN).tex $(MAIN).idx $(MAKEINDEX) $(MAIN).idx # list of abbreviations (rule: abbr) $(MAIN).nls: $(MAIN).tex $(MAIN).nlo $(MAKEINDEX) $(MAIN).nlo -s nomencl.ist -o $(MAIN).nls # bibliography (rule: bib) $(MAIN).blg $(MAIN).bbl: $(MAIN).tex $(MAIN).bib $(MAIN).aux $(BIBTEX) $(MAIN) # ============================================================================= # archiv ARCHIVFILES = $(TEXFILES) $(PICS) ARCHIVFILES += [mM]akefile tararchiv: $(MAIN).tar.gz $(MAIN).tar.gz: $(ARCHIVFILES) $(TAR) $(MAIN).tar.gz $(ARCHIVFILES) ziparchiv: $(MAIN).zip $(MAIN).zip: $(ARCHIVFILES) $(ZIP) $(MAIN).zip $(ARCHIVFILES) # ============================================================================= # show pdfshow: pdf @xpdf $(MAIN).pdf & psshow: ps @gv $(MAIN).ps & # ============================================================================= # table table: $(TABLES) mkdir -p $(TABLEDIR) cd $(TABLEDIR) $(MAKE) -f ../[mM]akefile $< # ============================================================================= # help help: @$(ECHO) "*************************************************************" @$(ECHO) " Makefile - LaTeX" @$(ECHO) "author: Daniel Armbruster" @$(ECHO) "email: dani.armbruster@gmx.de" @$(ECHO) "created: 12.12.09" @$(ECHO) "modified: 17.12.09" @$(ECHO) "*************************************************************" @$(ECHO) "-------------------------------------------------------------" @$(ECHO) "Help - for this Makefile" @$(ECHO) "-------------------------------------------------------------" @$(ECHO) "pdf: create a *.pdf document" @$(ECHO) "tararchiv: create a *.tar archive" @$(ECHO) "ziparchiv: create a *.zip archive" @$(ECHO) "pdfshow: show the *.pdf document with xpdf" @$(ECHO) "psshow: show the *.ps document with evince" @$(ECHO) "table: convert tables -> *.csv to *.tex" @$(ECHO) "clean: delete all temporary files" @$(ECHO) "help: print this help" @$(ECHO) @$(ECHO) "-------------------------------------------------------------" @$(ECHO) "Info:" @$(ECHO) "-------------------------------------------------------------" @$(ECHO) "main file: $(MAIN).tex" @$(ECHO) "lastly used pics: $(PDFIMAGES)" @$(ECHO) "lastly converted tables: $(TABLES)" @$(ECHO) @$(ECHO) "-------------------------------------------------------------" @$(ECHO) "Notices:" @$(ECHO) "-------------------------------------------------------------" @$(ECHO) "1. give the names of the images in the *.tex file without " @$(ECHO) " any file endings " @$(ECHO) "2. declare images with file ending in this Makefile " @$(ECHO) "3. tables must contain as delimiter the ';' token and as " @$(ECHO) " text-delimiter a '\"' token." @$(ECHO) # ----- END OF Makefile -----