# -*- makefile -*- # This makefile is useful for compiling lab sheets for LPI courses. # Just copy into the directory as is; there is no need to edit it at all. # It assumes that each *.tex file is to generate one pdf file. # It also assumes that each output file depends on all the *.fig files. # It does not process the file with lgrind first; see my Makefile # for c-for-engineers for that. # It is not designed for producing beamer slides. # See my Makefile for beamer-slides for that. # Copyright (C) 2005 Nick Urbanik # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #LATEX = latex --interaction=batchmode #PDFLATEX = pdflatex --interaction=batchmode LATEX = latex PDFLATEX = pdflatex LGRIND = lgrind -d /usr/local/share/texmf/tex/latex/lgrind/lgrindef VIEWER = xpdf texfiles = $(wildcard *.tex) pdffiles = $(texfiles:%.tex=%.pdf) dvifiles = $(texfiles:%.tex=%.dvi) figfiles = $(wildcard *.fig) epsfigs = $(figfiles:.fig=.eps) pdffigs = $(figfiles:.fig=.pdf) all: $(pdffiles) $(pdffiles): $(texfiles) $(psffigs) Makefile tidy: rm -f *.log *.ps *.toc *.aux *.eepic *.bak *.lg *.out *.idx *~ clean: tidy rm -f *.dvi *.pdf %-solns.tex: %.tex @echo @echo \* @echo \* Converting $< to $@ @echo \* sed 's/^\\documentclass{lpiclab}/\\documentclass[solutions]{lpiclab}\% DO NOT EDIT---WILL BE OVERWRITTEN/' $< > $@ %.dvi: %.tex @echo @echo \* @echo \* Compiling $< @echo \* latex $< @while ( grep "Rerun to get cross-references" \ $(subst .tex,.log,$<) >/dev/null ); do \ echo '** Re-running LaTeX **'; \ latex $<; \ done %.pdf: %.tex @echo @echo \* @echo \* Compiling $< @echo \* pdflatex $< @while ( grep "Rerun to get cross-references" \ $(subst .tex,.log,$<) >/dev/null ); do \ echo '** Re-running LaTeX **'; \ pdflatex $<; \ done # DON'T Cancel the built in rule that uses tex to produce dvi files: # %.dvi: %.tex # See http://freshmeat.net/articles/view/667/ # 1. latex file.tex # 2. dvips -Ppdf -G0 file.dvi -o file.ps # 3. ps2pdf13 -dPDFsettings=/prepress file.ps file.pdf # Two points to note: # * The -G0 parameter passed to dvips is used to get around a # bug in GhostScript which converts the "f" character to a # pound sign in the final PDF. # * The -dPDFsettings parameter for ps2pdf13 is used to prevent # downsampling of EPS images when they are converted to PDF. # Without this switch, EPS graphics in the final PDF look # very fuzzy, especially when viewed with a projector. %.lg: %.tex @echo @echo \* @echo \* running lgrind on $< @echo \* lgrind -e -lCC $< > $@ %.ps: %.dvi @echo @echo \* @echo \* Converting $< to PostScript @echo \* dvips -Ppdf -G0 -o $@ $< %.pdf: %.ps @echo @echo \* @echo \* Converting $< to PDF @echo \* ps2pdf13 -dPDFsettings=/prepress $< $@ %-4up.ps: %.ps @echo @echo \* @echo \* Converting $< to 4up, ready for printing @echo \* psnup -m12mm -b-2mm -pa4 -4 -l $< > $@ lpr: $(DOCUMENT)-4up.ps @echo @echo \* @echo \* Printing $< @echo \* lpr $< # %.pdf: %.dvi # @echo # @echo \* # @echo \* Converting $< to PDF # @echo \* # dvips -o - -Ppdf $< | ps2pdf13 - $@ %: %.dvi @echo @echo \* @echo \* Spawning viewer for $< @echo \* $(VIEWER) $< %.tex: %.c @echo @echo \* @echo \* Formatting C program $< to $@ @echo \* c2lt $< > $@ %.gz: % @echo @echo \* @echo \* Compressing $< @echo \* gzip $< %.eps: %.obj @echo @echo \* @echo \* Producing Encapsulated PostScript for $< @echo \* tgif -print -eps -color $< %.eepic: %.fig @echo @echo \* @echo \* Producing EEPIC for $< @echo \* fig2dev -L eepic $< $@ %.eps: %.fig @echo @echo \* @echo \* Producing EPS from $< @echo \* fig2dev -L eps $< $@ %.eps: %.gif @echo @echo \* @echo \* Producing EPS from $< @echo \* convert $< $@ %.pdf: %.gif @echo @echo \* @echo \* Producing PDF from $< @echo \* convert $< $@ %.pdf: %.eps @echo @echo \* @echo \* Producing EPS from $< @echo \* epstopdf $< publish: publish-snm # Stop GNU make from overzealous deletion of intermediate files .PRECIOUS: %.ps %.dvi %.eps