## $Id: Makefile 458 2011-02-28 17:44:57Z sluque $

###_+ Custom VARS ---------------------------------------------------------

# We don't need to do anything with the Sweave files, as R CMD build
# weaves them before calling make
LATEX=pdflatex
BIBTEX=bibtex
TEXTRASH=*.*ps *.dvi *.bbl *.aux *.blg *.log *.toc *.out *.tex auto/
RMOTHERTRASH=-find . -name '*.png' -a ! -name 'tcltk.png' -delete


###_+ Phonies -------------------------------------------------------------

.PHONY : clean

###_+ Rules ---------------------------------------------------------------

all : diveMove.pdf clean

%.pdf : %.tex
	$(R_HOME)/bin/R CMD Rd2dvi --pdf -o '$*-rd.pdf' --title='$*' ../../man/
	$(LATEX) $*
	$(BIBTEX) $*
	$(LATEX) $*
	$(LATEX) $*
	$(LATEX) $*
	rm -rf $(TEXTRASH) $*-*

%.tex : %.Rnw
	$(R_HOME)/bin/R CMD Sweave $*

clean :
	$(RMOTHERTRASH)


###_+ Emacs local variables
## Local variables:
## allout-layout: (1 + : 0)
## End:
