public
Created

knitr makefile (updated)

  • Download Gist
Makefile
Makefile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
## 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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.