-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
53 lines (39 loc) · 1.57 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Makefile for generating R packages.
# 2011 Andrew Redd
#
# Assumes Makefile is in a folder where package contents are in a subfolder PP.
# Roxygen uses the roxygen2 package, and will run automatically on check and all.
PKG_VERSION=$(shell grep -i ^version DESCRIPTION | cut -d : -d \ -f 2)
PKG_NAME=$(shell grep -i ^package DESCRIPTION | cut -d : -d \ -f 2)
R_FILES := $(wildcard R/*.R)
SRC_FILES := $(wildcard src/*) $(addprefix src/, $(COPY_SRC))
PKG_FILES := DESCRIPTION NAMESPACE $(R_FILES) $(SRC_FILES)
.PHONY: tarball install check clean build
tarball: $(PKG_NAME)_$(PKG_VERSION).tar.gz
$(PKG_NAME)_$(PKG_VERSION).tar.gz: $(PKG_FILES)
R CMD build ../PP
mv $(PKG_NAME)_$(PKG_VERSION).tar.gz ..
check: $(PKG_NAME)_$(PKG_VERSION).tar.gz
R CMD check --as-cran --output=.. ../$(PKG_NAME)_$(PKG_VERSION).tar.gz
build: $(PKG_NAME)_$(PKG_VERSION).tar.gz
R CMD INSTALL --build ../$(PKG_NAME)_$(PKG_VERSION).tar.gz
install: $(PKG_NAME)_$(PKG_VERSION).tar.gz
R CMD INSTALL ../$(PKG_NAME)_$(PKG_VERSION).tar.gz
NAMESPACE: $(R_FILES)
Rscript -e "library(roxygen2);roxygenize('../PP')"
rhub: $(R_FILES)
Rscript -e "library(roxygen2);roxygenize('../PP')"
Rscript -e "library(rhub); check(platform = 'debian-gcc-devel')" > ../ruhub_deb.log
Rscript -e "library(rhub); check_with_sanitizers()" > ../ruhub_san.log
Rscript -e "library(rhub); check_on_windows()" > ../ruhub_win.log
clean:
-rm -f ../$(PKG_NAME)_*.tar.gz
-rm -r -f ../$(PKG_NAME).Rcheck
-rm -r -f man/*
-rm -r -f NAMESPACE
.PHONY: list
list:
@echo "R files:"
@echo $(R_FILES)
@echo "Source files:"
@echo $(SRC_FILES)