-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (40 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
51 lines (40 loc) · 1.71 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
49
50
51
################################################################################
## Useful rules to build, check and install an R source package
##
## Copyright (C) 2012,2014-2018 Sebastian Meyer
################################################################################
## define variable for R to enable 'make check R=R-devel'
R := R
## package name and version (taken from DESCRIPTION)
PKG := $(strip $(shell grep "^Package:" DESCRIPTION | cut -f 2 -d ":"))
VERSION := $(strip $(shell grep "^Version:" DESCRIPTION | cut -f 2 -d ":"))
## roxygenise (update NAMESPACE and Rd files)
document:
$R --no-restore --no-save --no-init-file --slave -e "devtools::document()"
## build extra vignettes and copy results to inst/doc
extra_vignettes:
make -C vignettes/extra
cp -a -t inst/doc vignettes/extra/*.html
## build the package
build: document extra_vignettes
$R CMD build .
## package installation
install: build
$R CMD INSTALL ${PKG}_${VERSION}.tar.gz
## auxiliary functions ("canned recipes") for check rules
define check-report-warnings-in-examples
cd ${PKG}.Rcheck; \
nwarn=`grep -c "^Warning" ${PKG}-Ex.Rout`; \
if [ $$nwarn -gt 0 ]; then echo "\n\tWARNING: $$nwarn" \
"warning(s) thrown when running examples,\n" \
"\t see file ${PKG}.Rcheck/${PKG}-Ex.Rout\n"; fi
endef
## standard --as-cran check with remote checks disabled
check: build
_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE _R_CHECK_EXAMPLE_TIMING_THRESHOLD_=2 $R CMD check --as-cran --timings ${PKG}_${VERSION}.tar.gz
@$(check-report-warnings-in-examples)
## pkgdown documentation
docs:
$R --no-restore --no-save --no-init-file --slave -e "pkgdown::build_site()"
## almost all targets are "phony"
.PHONY: document extra_vignettes build install check docs