summaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2017-01-25 18:39:48 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2017-01-25 19:40:10 +0100
commit4f4cd07a9ef72c53bbfa53eda835f19dc9f9ad72 (patch)
treed0b43004be02826419563c204d181cef9d3ae76a /GNUmakefile
Initial commit
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile54
1 files changed, 54 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..36cb038
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,54 @@
+PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
+PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
+TGZ := $(PKGNAME)_$(PKGVERS).tar.gz
+R_HOME ?= $(shell R RHOME)
+DATE := $(shell date +%Y-%m-%d)
+
+.PHONY: check
+
+pkgfiles = DESCRIPTION \
+ .Rbuildignore \
+ docs/* \
+ docs/reference/* \
+ R/*
+
+roxygen:
+ @echo "Roxygenizing package..."
+ "$(R_HOME)/bin/Rscript" -e 'library(devtools); document()'
+ @echo "DONE."
+
+pd: roxygen
+ @echo "Building static documentation..."
+ "$(R_HOME)/bin/Rscript" -e 'pkgdown::build_site()'
+ @echo "DONE."
+
+$(TGZ): $(pkgfiles)
+ sed -i -e "s/Date:.*/Date: $(DATE)/" DESCRIPTION
+ @echo "Roxygenizing package..."
+ "$(R_HOME)/bin/Rscript" -e 'library(devtools); document()'
+ @echo "Building package..."
+ git log --no-merges -M --date=iso > ChangeLog
+ "$(R_HOME)/bin/R" CMD build . > build.log 2>&1
+ @echo "DONE."
+
+build: $(TGZ)
+
+check: build
+ @echo "Running CRAN check..."
+ "$(R_HOME)/bin/R" CMD check --as-cran $(TGZ)
+ @echo "DONE."
+
+install: build
+ @echo "Installing package..."
+ "$(R_HOME)/bin/R" CMD INSTALL --no-multiarch $(TGZ)
+ @echo "DONE."
+
+drat: build
+ "$(R_HOME)/bin/Rscript" -e "drat::insertPackage('$(TGZ)', commit = TRUE)"
+
+winbuilder: build
+ date
+ @echo "Uploading to R-release on win-builder"
+ 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/

Contact - Imprint