# building Czech TL doc on texlive2003
# $Date: 2004/11/15 $  
doc = live

#all: pdf normal html
all: normal

default:	onerun

onerun:
	latex '\def\Status{0}\input $(doc)'

dvi:
	rm -f *.aux *.toc
	latex '\def\Status{0}\input $(doc)'
	latex '\nonstopmode\def\Status{0}\input $(doc)'
	latex '\nonstopmode\def\Status{0}\input $(doc)'

normal:	dvi
	dvips -Ppdf live -o
	ps2pdf live.ps cstldoc.pdf	

pdftex:  
	rm -f *.aux *.toc *.lof *.lot
	pdflatex '\nonstopmode\def\Status{1}\input $(doc)'
	pdflatex '\nonstopmode\def\Status{1}\input $(doc)'
	pdflatex '\nonstopmode\def\Status{1}\input $(doc)'

html:  
	rm -f *.aux *.toc *.lof *.lot
	latex '\nonstopmode\def\Status{2}\input $(doc)'
	latex '\nonstopmode\def\Status{2}\input $(doc)'
	latex '\nonstopmode\def\Status{2}\input $(doc)'
	tex4ht live
	t4ht live

#baskerville:  
#	rm -f *.aux *.toc
#	latex '\def\Status{3}\input $(doc)'
#	latex '\def\Status{3}\input $(doc)'
#	latex '\def\Status{3}\input $(doc)'

tugboat:  
	rm -f *.aux *.toc
	latex '\def\Status{4}\input $(doc)'
	latex '\def\Status{4}\input $(doc)'
	latex '\def\Status{4}\input $(doc)'

clean: 
	rm -f *.aux *.log *.blg *.toc *.out *.lot tex4ht.ps *.4*
	rm -f *.xref *.lg *.idv *.out *.otc *.tmp tmp.* *~ live.ps *.dvi
	rm -rf auto

realclean: clean
	rm -f live.dvi
	rm -f live.pdf live.ps
	rm -f *.html *.htm *.gif *.css


bib:  
	rm -f *.aux *.toc
	-latex live
	-bibtex live

nocites:
	find /texlive/texmf/lists -type f | \
	sed 's/$$/ /' | \
	sed 's/.texlive.texmf.lists.*free.//' | \
	sed 's/\// /' | \
	awk '{print "\\nocite{"$$2"}"}' | \
	sort | uniq > nocites.tex 


texlive:
	find /texlive/texmf/lists -type f | \
	sed 's/.texlive.texmf.lists.*free.//' | \
	sed 's/\// /' | \
	awk '{print "$$texlive{\""$$2"\"}=\""$$1"\";"}' | \
	sort | uniq > texlive.pl

csdist:
	cd ..; zip -9 cstldoc czechslovak/* pictures/* examples/*;cd czechslovak
	scp fdl.txt ../cstldoc.zip VERSION README cstldoc.pdf sojka@odysseus:/ftp/pub/tex/local/cstug/sojka/cstldoc

catalogue:
	cat entries/*.bib > catalogue.bib

instdir=../../../../Master/texmf/doc/tldoc
install:
	lang=`pwd | sed 's/.*\///'`; echo tldoc install in $$lang; \
	for i in live*html live.css *.jpg live.pdf; do \
	  cmp -s $$i $(instdir)/$$lang/$$i && continue; \
	  p4 edit $(instdir)/$$lang/$$i; \
	  cp $$i $(instdir)/$$lang; \
	done
	@echo "Don't forget to p4 submit."
