-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
36 lines (29 loc) · 1.16 KB
/
Makefile
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
# Determine package name and version from DESCRIPTION file
PKG_VERSION=$(shell grep -i ^version DESCRIPTION | cut -d : -d \ -f 2)
PKG_NAME=$(shell grep -i ^package DESCRIPTION | cut -d : -d \ -f 2)
# Roxygen version to check before generating documentation
ROXYGEN_VERSION=5.0.1
# Name of built package
PKG_TAR=$(PKG_NAME)_$(PKG_VERSION).tar.gz
# Install package
install:
cd .. && R CMD INSTALL $(PKG_NAME)
# Build documentation with roxygen
# 1) Check version of roxygen2 before building documentation
# 2) Remove old doc
# 3) Generate documentation
roxygen:
Rscript -e "library(roxygen2); stopifnot(packageVersion('roxygen2') == '$(ROXYGEN_VERSION)')"
rm -f man/*.Rd
cd .. && Rscript -e "library(roxygen2); roxygenize('$(PKG_NAME)')"
# Generate PDF output from the Rd sources
# 1) Rebuild documentation with roxygen
# 2) Generate pdf, overwrites output file if it exists
pdf: roxygen
cd .. && R CMD Rd2pdf --force $(PKG_NAME)
# Build and check package
check:
cd .. && R CMD build --no-build-vignettes $(PKG_NAME)
cd .. && _R_CHECK_CRAN_INCOMING_=FALSE R CMD check --as-cran \
--no-manual --no-vignettes --no-build-vignettes $(PKG_TAR)
.PHONY: install roxygen pdf check