aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-08-26 13:24:57 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-08-26 22:59:02 +0200
commit7cc5df2ad1e2a1aa5c6d4d9f5865491c6b30ee2a (patch)
tree1fcfa114cc34dcfb7c9f647e95912a5e4ae08b5f /GNUmakefile
Initial commit
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile75
1 files changed, 75 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..482ec37
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,75 @@
+PKGSRC := $(shell basename $(CURDIR))
+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)
+
+.PHONEY: usage check clean roxygen sd
+
+usage:
+ @echo "Usage: make TARGET with TARGET being:"
+ @echo ""
+ @echo " clean - Clean up."
+ @echo " roxygen - Roxygenize."
+ @echo " build - Build source package."
+ @echo " quickcheck - Run check on the package."
+ @echo " check - Run CRAN check on the package."
+ @echo " install - Install the package."
+
+pkgfiles = DESCRIPTION \
+ README.html \
+ R/* \
+ inst/examples/*.R \
+ inst/staticdocs/index.r
+
+clean:
+ @echo "Cleaning up..."
+ rm -fR chents.Rcheck
+ @echo "DONE."
+
+roxygen:
+ @echo "Roxygenizing package..."
+ "$(R_HOME)/bin/Rscript" -e 'library(devtools); document(".")' 2>&1 | tee roxygen.log
+ @echo "DONE."
+
+$(TGZ): $(pkgfiles)
+ sed -i -e "s/Date:.*/Date: $(DATE)/" DESCRIPTION
+ @echo "Roxygenizing package..."
+ "$(R_HOME)/bin/Rscript" -e 'library(devtools); document(".")' 2>&1 | tee roxygen.log
+ @echo "Building package..."
+ git log --no-merges -M --date=iso > ChangeLog
+ "$(R_HOME)/bin/R" CMD build .
+ @echo "DONE."
+
+README.html: README.md
+ "$(R_HOME)/bin/Rscript" -e "rmarkdown::render('README.md', output_format = 'html_document')"
+
+build: $(TGZ)
+
+test: build
+ @echo "Running testthat tests..."
+ "$(R_HOME)/bin/Rscript" -e 'library(devtools); devtools::test(".")' 2>&1 | tee 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_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."
+
+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