#
# diss.tex - a sample LaTeX dissertation for the ETH
#
# Copyright (C) 2006-2014 Ilja Gerhardt <ilja@cryptix.net>
#
# This source code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Public License as published
# by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# This source code 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.
# Please refer to the GNU Public License for more details.
#
# You should have received a copy of the GNU Public License along with
# this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

NAME=diss

SHELL=/bin/sh
                                                                                
LATEX = /usr/bin/latex
PDFLATEX = /usr/bin/pdflatex
THUMB = /usr/bin/thumbpdf
BIBTEX = /usr/bin/bibtex
INDEX = /usr/bin/makeindex
DVIVIEW = /usr/bin/xdvi
DVIPS = /usr/bin/dvips
SELECT = /usr/bin/psselect
GHOST = /usr/X11R6/bin/ghostview -magstep 1
PS2PDF = /usr/bin/ps2pdf
TAR = /bin/tar
DATE = `date +%y%m%d-%H%M`
                                                                                
                                                                                
all:
	$(PDFLATEX) $(NAME)                                                    
	$(BIBTEX) $(NAME)                                                   
	$(PDFLATEX) $(NAME)                                                    
	$(INDEX) -s $(NAME).ist $(NAME).idx                         
	$(PDFLATEX) $(NAME)                                                    
	$(THUMB) $(NAME)
	$(PDFLATEX) $(NAME)    
view: all
	acroread $(NAME).pdf
clean:
	rm -f $(NAME).ps $(NAME).pdf
	rm -f *.bix *.aux *.blg *.log *.ind *.idx *.ilg *.out *.toc *.dvi *.bbl *.lof *~ *.backup *.bak *.tpt *.brf
images:
	cd images
	for i in *.pdf; do pdftops $i; NAMEBASE=`echo $i | sed s/.pdf//`; mv $NAMEBASE.ps $NAMEBASE.eps; done;
	cd ..
backup: clean
	$(TAR) cvfz backup.tar.gz .
tb:
	find . -name "*.tex" -print -exec tar fu texbackup.tar {} \;
	find . -name "*.bib" -print -exec tar fu texbackup.tar {} \;
	gzip texbackup.tar
	mv texbackup.tar.gz backup/$(DATE).tar.gz
# getbib:
#	scp intra.ethz.ch:/web/intra.ethz.ch/cgi-bin/ilja.bib diss.bib
