Created
January 10, 2012 20:29
-
-
Save cboettig/1591001 to your computer and use it in GitHub Desktop.
knitr makefile (updated)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Makefile to use knitr in the vignette | |
all: knit | |
setvars: | |
ifeq (${R_HOME},) | |
R_HOME= $(shell R RHOME) | |
endif | |
RPROG= $(R_HOME)/bin/R | |
RSCRIPT=$(R_HOME)/bin/Rscript | |
pdfclean: | |
rm -f *.pdf | |
clean: | |
rm -f index.html | |
rm -f *.tex *.bbl *.blg *.aux *.out *.log *.spl *tikzDictionary | |
# Custom command for my local compile | |
knit: | |
$(RSCRIPT) --vanilla -e ".libPaths(c('~/R', .libPaths())); require(knitr); knit( 'knit_treebase.Rnw', 'treebase.Rnw');" | |
$(RPROG) CMD Sweave treebase.Rnw | |
pdflatex treebase | |
bibtool -s -d -x treebase.aux ~/Documents/Mendeley/bib/library.bib > treebase.bib | |
bibtex treebase # make the bibliography | |
pdflatex treebase | |
pdflatex treebase | |
rm -f *.bbl *blg *.aux *.out *.log *.spl | |
cp -f treebase.Rnw treebase.tex treebase.bib *.pdf .. | |
## Traditional compile | |
treebase.pdf: treebase.Rnw | |
$(RPROG) CMD Sweave treebase.Rnw | |
$(RSCRIPT) -e "tools::texi2dvi( 'treebase.tex', pdf = TRUE, clean = FALSE )" | |
bibtex treebase # make the bibliography | |
$(RSCRIPT) -e "tools::texi2dvi( 'treebase.tex', pdf = TRUE, clean = TRUE )" # compile and cleanup | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment