-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (36 loc) · 1.25 KB
/
Makefile
File metadata and controls
48 lines (36 loc) · 1.25 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
# Generic Makefile that can live in the same directory as an R package.
PKGNAME = $(shell awk '{if(/Package:/) print $$2}' DESCRIPTION)
VERSION = $(shell awk '{if(/Version:/) print $$2}' DESCRIPTION)
PKG = $(PKGNAME)_$(VERSION).tar.gz
# Helpful for debugging:
$(info R package is: $(PKG))
RFILES = $(wildcard R/*.R)
TESTFILES = $(wildcard tests/testthat/test*.R)
VIGNETTES = $(wildcard vignettes/*.Rmd)
GRAPHVIZ_PNGS = $(addsuffix .png, $(basename $(wildcard vignettes/*.dot)))
TEMPLATES = $(wildcard inst/templates/*.R)
#GEN_SCRIPT_OUTPUT = $(addsuffix .log, $(wildcard tests/testthat/scripts/script*.R))
## Log files that go with each test
#%.R.log: %.R
# Rscript $<
# User local install
install: $(PKG)
R CMD INSTALL $<
#NAMESPACE: $(RFILES)
test: $(TESTFILES) $(GEN_SCRIPT_OUTPUT)
make install
cd tests && Rscript testthat.R && cd ..
$(PKG): $(RFILES) $(TESTFILES) $(TEMPLATES) $(VIGNETTES) DESCRIPTION
R -e "devtools::document()"
rm -f $(PKG) # Otherwise it's included in build
R CMD build . --no-build-vignettes
check: $(PKG)
R CMD check $(PKG) --as-cran --run-dontrun
docs: $(VIGNETTES) $(GRAPHVIZ_PNGS)
make install
R -e "tools::buildVignettes(dir = '.')"
clean:
rm -rf vignettes/*.html $(PKG) *.Rcheck
# Graphviz images
%.png: %.dot
dot -Tpng $< -o $@