# $Id: tex.mak,v 1.1 2004/07/25 17:24:00 vassilii Exp $ # Makefile for easy TeX work # # Copy this file to where your tex document is, under the name `Makefile' # # Do `make help' for documentation. # Copyright (C) 2004 Vassilii Khachaturov # # 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. .PHONY: all ################ CUSTOMIZE HERE ################# # If your main TeX doc is called final.tex, # set TITLE=final , etc. NOTE: not TITLE=final.tex, just TITLE=final TITLE=final TEX=latex # or tex. Or elatex for Hebrew etc. PDFTEX=pdf$(TEX) XPDF=acroread XDVI=xdvi -expert # Use `make xdvi' to view your work with xdvi. remove -expert if you like # the buttons to appear on the screen (I prefer more screen area visible # without them, but this means I remember all the keystrokes) # See the xdvi(1) manpage for more info. # Subdir of your home dir for rsync. You need to set it up for `make rsync' # to work properly. Use this if you want to use this makefile on your laptop # or home workstation, and would like to upload things to the University. UPLOAD=Teaching RHOST=black # To do the rsync, do # `make rsync' first, and verify what is going to be done. # After that, do a `make rsync NO=' to force it really happen. # You normally won't need to change anything below this line. ################ STOP CUSTOMIZING HERE ################# .PHONY: clean realclean rsync xdvi pdf ps dvi help # This one allows you to create a subdir of your directory # where the tex file and the Makefile is, and make a symlink # to the Makefile like this inside it: `ln -s ../Makefile .' # After that, you can run make in the subdir to process your article. # This is useful if you are placing some local .cfg files in the subdir, # e.g., you can have one subdir generating foiltex slides and another # one for handouts. vpath %.tex .. GREPLOG=grep -q 'Rerun to get cross-references right' all: $(TITLE).dvi dvi: $(TITLE).dvi ps: $(TITLE).ps pdf: $(TITLE).pdf %.dvi: %.tex $(TEX) $* @while $(GREPLOG) $*.log; do $(TEX) $*; done %.ps: %.dvi dvips $* %.pdf: %.tex $(PDFTEX) $* @while $(GREPLOG) $*.log; do $(PDFTEX) $*; done xdvi: $(TITLE).dvi $(XDVI) -keep -mgs2 800x600 -mgs3 1024x768 $< xpdf: $(TITLE).pdf $(XPDF) $< clean: -rm *~ *.log *.aux $(TITLE).dvi $(TITLE).ps realclean: clean -rm *.bak $(TITLE).pdf # `make rsync' is advanced stuff. Look at the RHOST and UPLOAD descr. above, # and read the manpage for rsync(1) before you use this one. NO=-n rsync: clean rsync $(NO) -pazv --progress -e ssh . $(RHOST):$(UPLOAD) help: @echo "Operation shortcuts for the default document - $(TITLE).tex" @echo "Do \`make' or \`make dvi' to create $(TITLE).dvi using $(TEX)" @echo "Do \`make ps' to create $(TITLE).ps from $(TITLE).tex" @echo "Do \`make pdf' to create $(TITLE).pdf from $(TITLE).tex" @echo "Do \`make xdvi' to create and display $(TITLE).dvi" @echo "Do \`make xpdf' to create and display $(TITLE).pdf" @echo "\`make clean' will clean up the generated files" @echo @echo "Alternatively, do" @echo " make chapter1.dvi" @echo " to create chapter1.dvi from chapter1.tex" @echo " make letter.ps" @echo " to create letter.ps from letter.tex" @echo " make resume.pdf" @echo " to create resume.pdf from resume.tex" @echo @echo "Additional features available in the CUSTOMIZE HERE section of the Makefile." $(TITLE).tex: @echo "Edit the Makefile and set TITLE= to your default document" @echo "E.g., if your default document is final.tex, set TITLE=final" @echo "Run \`make help' for more information" @exit 1 %.tex: @echo "$@ does not exist." @echo "Run \`make help' for more information" @exit 2