Created
October 9, 2015 08:35
-
-
Save csgillespie/5f45077549790fcabae3 to your computer and use it in GitHub Desktop.
Example Makefile used when dealing with Sweave
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
## $* = filename without extension | |
## $@ = the output file | |
## $< = the input file | |
.SUFFIXES: .tex .pdf .Rnw .R | |
MAIN = lecture | |
INCLUDES = chapter1 chapter2 chapter3 | |
TEX = $(INCLUDES:=.tex) | |
RFILES = $(INCLUDES:=.R) | |
RNWFILES = $(INCLUDES:=.Rnw) | |
all: $(TEX) $(MAIN).pdf | |
$(MAIN).pdf: $(TEX) $(MAIN).tex | |
R: $(RFILES) | |
view: all | |
xpdf $(MAIN).pdf & | |
.Rnw.R: | |
R CMD Stangle $< | |
.Rnw.tex: | |
Rscript -e "require(highlight); \ | |
driver = HighlightWeaveLatex(boxes = TRUE);\ | |
Sweave('$*.Rnw', driver = driver ); " | |
.tex.pdf: | |
rubber --pdf $*.tex # Or use pdflatex | |
clean: | |
rm -fv $(MAIN).pdf $(TEX) $(RFILES) | |
rm -fv *.aux *.dvi *.log *.toc *.bak *~ *.blg *.bbl *.lot *.lof | |
rm -fv *.nav *.snm *.out *.pyc \#*\# _region_* _tmp.* *.vrb | |
rm -fv Rplots.pdf *.RData movie.csv.gz mygraph* | |
cleaner: | |
make clean | |
rm -fv ../graphics/*.pdf | |
rm -fvr auto/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment