Bdecaf,
, 2.0 - .
, " , Makefiles ". , , make R:
knitr makefile ( ) , . makefile , , .
maker, Makefile for R. , Karl Broman ( , , , - ( ).
- ,
, , . , R, .
, .
.
:
, Sweave knitr, GNU make.
, , , . R script LaTeX . BibTeX .
PDF - :
R , , .
GNU make . Makefile, ( pdflatex).
mypaper.pdf: mypaper.bib mypaper.tex Figs/fig1.pdf Figs/fig2.pdf
pdflatex mypaper
bibtex mypaper
pdflatex mypaper
pdflatex mypaper
Figs/fig1.pdf: R/fig1.R
cd R;R CMD BATCH fig1.R
Figs/fig2.pdf: R/fig2.R
cd R;R CMD BATCH fig2.R
, (), , ( ), , . , tab ( ).
: youd build fig1.pdf, fig1.R . , . fig1.R, fig1.pdf , mypaper.pdf .
: , cd , . :
Figs/fig1.pdf: R/fig1.R
cd R
R CMD BATCH fig1.R
You can, however, use \ for a continuation line, line so:
Figs/fig1.pdf: R/fig1.R
cd R;\
R CMD BATCH fig1.R
, (;).
GNU make
, GNU . make -version /, . ( Windows , make.)
make:
- .
- Makefile.
- , , make.
- , fig1.pdf mypaper.pdf, make fig1.pdf.
make, , , . , , .
, . ( . ).
, .
, R --vanilla. R_OPTS:
R_OPTS = -
$(R_OPTS) ( ${R_OPTS}, ), R -
cd R; R CMD BATCH $(R_OPTS) fig1.R
, , ; R, , .
, :
R_OPTS = - no-save --no-restore --no-init-file --no-site-file
--vanilla, --no-environ ( , .Renviron R_LIBS, , R-, ).
, , . , :
$@ the file name of the target
$< the name of the first prerequisite (i.e., dependency)
$^ the names of all prerequisites (i.e., dependencies)
$(@D) the directory part of the target
$(@F) the file part of the target
$(<D) the directory part of the first prerequisite (i.e., dependency)
$(<F) the file part of the first prerequisite (i.e., dependency)
,
Figs/fig1.pdf: R/fig1.R
cd R;R CMD BATCH fig1.R
Figs/fig1.pdf: R/fig1.R
cd $(<D);R CMD BATCH $(<F)
$(<D) , R . $(<F) , fig1.R .
, . , , , , , . .
, . , % , .
, . , , fig1.pdf fig2.pdf:
Figs/%.pdf: R/%.R
cd $(<D);R CMD BATCH $(<F)
. , (.. ) mypaper.pdf.
,
, Makefile .
R_OPTS=--vanilla
mypaper.pdf: mypaper.bib mypaper.tex Figs/fig1.pdf Figs/fig2.pdf
pdflatex mypaper
bibtex mypaper
pdflatex mypaper
pdflatex mypaper
Figs/%.pdf: R/%.R
cd $(<D);R CMD BATCH $(R_OPTS) $(<F)
: , , . : , GNU Make, , .
Make . github .
:
:
Makefile Yihui Xie s knitr R.
maker, Makefile for R.
R-
R.
R- - R- ,
, ,
( R-)
, .
R- ,
. ,
R, .
, .
R ( ,
Amazon).
.
R.
, .
R .
,
, , .
,
(, , ).
,
Hadley book,
?
- ,
R.
, .
:
- ( !),
,
(
) fork GitHub -,
.
github.
. tutorials
git/github,
GNU make,
knitr,
- GitHub,
,
.