Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (57 loc) · 2.37 KB
/
Copy pathMakefile
File metadata and controls
73 lines (57 loc) · 2.37 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Makefile for adaptiveFTS — common development and CRAN-submission tasks.
#
# Usage: `make <target>` (requires R, Rscript and the C++ toolchain on PATH).
# Override the interpreters if they are not on PATH, e.g.
# make check R="/c/Program Files/R/R-4.2.1/bin/x64/R.exe" \
# RSCRIPT="/c/Program Files/R/R-4.2.1/bin/x64/Rscript.exe"
PKG := $(shell sed -n 's/^Package: //p' DESCRIPTION)
VERSION := $(shell sed -n 's/^Version: //p' DESCRIPTION)
TARBALL := $(PKG)_$(VERSION).tar.gz
R ?= R
RSCRIPT ?= Rscript
.PHONY: help deps document test build check check-cran install coverage \
lint vignettes pkgdown clean cran submit
help:
@echo "adaptiveFTS $(VERSION) — make targets:"
@echo " deps install development dependencies"
@echo " document regenerate Rd files and NAMESPACE with roxygen2"
@echo " test run the testthat suite (devtools::test)"
@echo " build build the source tarball ($(TARBALL))"
@echo " install install the package from source"
@echo " check R CMD check --as-cran on the built tarball"
@echo " cran document + build + check --as-cran (pre-submission gate)"
@echo " coverage test-coverage report (covr)"
@echo " lint lintr::lint_package() (informational)"
@echo " vignettes build the vignettes"
@echo " pkgdown build the documentation website"
@echo " submit submit to CRAN (devtools::submit_cran; interactive)"
@echo " clean remove build artefacts"
deps:
$(RSCRIPT) -e 'pkgs <- c("devtools","roxygen2","testthat","covr","lintr","pkgdown","rcmdcheck","rhub"); ip <- rownames(installed.packages()); for (p in pkgs) if (!(p %in% ip)) install.packages(p)'
document:
$(RSCRIPT) -e 'roxygen2::roxygenise()'
test:
$(RSCRIPT) -e 'devtools::test()'
build: document
$(R) CMD build .
install:
$(R) CMD INSTALL .
check: build
$(R) CMD check --as-cran "$(TARBALL)"
# Full local pre-submission gate: regenerate docs, build, and run --as-cran.
cran: document
$(R) CMD build .
$(R) CMD check --as-cran "$(TARBALL)"
coverage:
$(RSCRIPT) -e 'covr::report(covr::package_coverage())'
lint:
$(RSCRIPT) -e 'print(lintr::lint_package())'
vignettes:
$(RSCRIPT) -e 'devtools::build_vignettes()'
pkgdown:
$(RSCRIPT) -e 'pkgdown::build_site()'
submit:
$(RSCRIPT) -e 'devtools::submit_cran()'
clean:
rm -rf $(PKG).Rcheck $(PKG)_*.tar.gz docs
rm -f src/*.o src/*.so src/*.dll