aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorRanke Johannes <johannes.ranke@agroscope.admin.ch>2024-01-31 13:16:17 +0100
committerRanke Johannes <johannes.ranke@agroscope.admin.ch>2024-01-31 13:27:50 +0100
commitaed160d7f0eaf5865e2bd9bf6c4b1c9d7b13d911 (patch)
tree7ca136834857c12449f50a1e086a589cc9b79e2e /GNUmakefile
parent64f629efbe666bae56f48a309adf33d1eb09c358 (diff)
Reorganise data generation
- Use inst/data_generation for R code generating data as in some of my other packages - data/*.RData files were checked using https://github.com/jranke/dotfiles/blob/main/bin/rda_diff contents were not changed - Remove ChangeLog, the history is in the git logs - Update docs and some links contained therein - use \doi{} markup - Move logs to log directory
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile75
1 files changed, 27 insertions, 48 deletions
diff --git a/GNUmakefile b/GNUmakefile
index fae80e3..b987f41 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -2,80 +2,51 @@ PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
TGZ := $(PKGNAME)_$(PKGVERS).tar.gz
WINBIN := $(PKGNAME)_$(PKGVERS).zip
-R_HOME ?= $(shell R RHOME)
-DATE := $(shell date +%Y-%m-%d)
+RBIN ?= $(shell dirname "`which R`")
-.PHONEY: usage check clean
+.PHONEY: check
pkgfiles = \
.Rbuildignore \
- ChangeLog \
DESCRIPTION \
data/* \
- docs/* \
- docs/reference/* \
+ GNUmakefile \
+ inst/data_generation/* \
inst/testdata/* \
README.html \
R/* \
tests/testthat.R \
tests/testthat/*
-clean:
- @echo "Cleaning up..."
- rm -fR pfm.Rcheck
- @echo "DONE."
+all: build
-roxygen:
- @echo "Roxygenizing package..."
- "$(R_HOME)/bin/Rscript" -e 'devtools::document()'
- @echo "DONE."
+roxy:
+ Rscript -e "roxygen2::roxygenize(roclets = c('rd', 'collate', 'namespace'))"
README.html: README.md
- "$(R_HOME)/bin/Rscript" -e "rmarkdown::render('README.md', output_format = 'html_document', output_options = list(mathjax = NULL))"
-
-pd: roxygen
- @echo "Building static documentation..."
- # suppressWarnings to get rid of mbcsToSbcs warnings when plotting the 'µ' character
- "$(R_HOME)/bin/Rscript" -e 'suppressWarnings(pkgdown::build_site(lazy=TRUE))'
- @echo "DONE."
+ "$(RBIN)/Rscript" -e "rmarkdown::render('README.md', output_format = 'html_document', output_options = list(mathjax = NULL))"
$(TGZ): $(pkgfiles)
- sed -i -e "s/Date:.*/Date: $(DATE)/" DESCRIPTION
- @echo "Roxygenizing package..."
- "$(R_HOME)/bin/Rscript" -e 'devtools::document()'
- @echo "Building package..."
- "$(R_HOME)/bin/R" CMD build . > build.log 2>&1
- @echo "DONE."
+ "$(RBIN)/R" CMD build . 2>&1 | tee log/build.log
+
+build: roxy $(TGZ)
-build: $(TGZ)
+install: build
+ "$(RBIN)/R" CMD INSTALL $(TGZ)
$(WINBIN): build
@echo "Building windows binary package..."
- "$(R_HOME)/bin/R" CMD INSTALL $(TGZ) --build
+ "$(RBIN)/R" CMD INSTALL $(TGZ) --build
@echo "DONE."
winbin: $(WINBIN)
-test: build
- @echo "Running testthat tests..."
- NOT_CRAN=true "$(R_HOME)/bin/Rscript" -e 'options(cli.dynamic = TRUE); devtools::test()' 2>&1 | tee test.log
- sed -i -e "s/\r.*\r//" test.log
- @echo "DONE."
-
-quickcheck: build
- @echo "Running check..."
- "$(R_HOME)/bin/R" CMD check $(TGZ)
- @echo "DONE."
-
-check: build
- @echo "Running CRAN check..."
- _R_CHECK_CRAN_INCOMING_REMOTE_=false "$(R_HOME)/bin/R" CMD check --as-cran $(TGZ)
- @echo "DONE."
+check: roxy build
+ _R_CHECK_CRAN_INCOMING_REMOTE_=false "$(RBIN)/R" CMD check --as-cran --no-tests $(TGZ) 2>&1 | tee log/check.log
-install: build
- @echo "Installing package..."
- "$(R_HOME)/bin/R" CMD INSTALL --no-multiarch $(TGZ)
- @echo "DONE."
+test: install
+ "$(RBIN)/Rscript" -e 'options(cli.dynamic = TRUE); devtools::test()' 2>&1 | tee log/test.log
+ sed -i -e "s/.*\r.*\r//" log/test.log
drat: build
"$(R_HOME)/bin/Rscript" -e "drat::insertPackage('$(TGZ)', commit = TRUE)"
@@ -89,3 +60,11 @@ winbuilder: build
curl -T $(TGZ) ftp://anonymous@win-builder.r-project.org/R-release/
@echo "Uploading to R-devel on win-builder"
curl -T $(TGZ) ftp://anonymous@win-builder.r-project.org/R-devel/
+
+pd: roxy
+ # In earlier versions, we used suppressWarnings to get
+ # rid of mbcsToSbcs warnings when plotting the 'µ' character
+ Rscript -e 'pkgdown::build_site(lazy = TRUE, run_dont_run = TRUE)'
+
+pd_all: roxy
+ Rscript -e 'pkgdown::build_site(lazy = FALSE, run_dont_run = TRUE)'

Contact - Imprint