Mehrad's personal R package
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

58 lines
1.6 KiB

# inspired by:
# https://github.com/yihui/knitr/blob/master/Makefile
SHELL = /bin/sh
# prepare the package for release
PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGSRC := $(shell basename "`pwd`")
TODAY := $(shell date "+%F")
all: docs build check install
all-cran: docs build check-cran install
deps:
tlmgr install pgf preview xcolor;\
Rscript -e 'if (!is.element("devtools", installed.packages()[, 1])){ install.packages("devtools", repos="http://cran.rstudio.com") }';\
Rscript -e 'if (!is.element("Rd2roxygen", installed.packages()[, 1])){ install.packages("Rd2roxygen", repos="http://cran.rstudio.com") }';
build:
sed -i -E "s/^Date: [0-9]{4}-[0-9]{2}-[0-9]{2}/Date: $(TODAY)/m" DESCRIPTION
cd ..;\
R CMD build $(PKGSRC)
build-noman:
cd ..;\
R CMD build --no-manual --no-build-vignettes $(PKGSRC)
docs:
$(RM) -r man/;\
R -e 'devtools::document()'
install:
cd ..;\
R CMD REMOVE $(PKGNAME)_$(PKGVERS).tar.gz
R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz
check:
cd ..;\
R CMD check --no-vignettes $(PKGNAME)_$(PKGVERS).tar.gz \
| grep --color --extended-regexp 'ERROR|WARNING|NOTE|'
check-cran:
cd ..;\
R CMD check --as-cran $(PKGNAME)_$(PKGVERS).tar.gz \
| grep --color --extended-regexp 'ERROR|WARNING|NOTE|'
travis: build-noman
R CMD check $(PKGNAME)_$(PKGVERS).tar.gz --no-manual
clean:
cd ..;\
$(RM) --recursive --force $(PKGNAME).Rcheck/ ;\
$(RM) --recursive --force $(PKGNAME)_$(PKGVERS).tar.gz ;\
$(RM) --recursive --force $(PKGNAME)_$(PKGVERS)_R_x86_64-pc-linux-gnu.tar.gz