-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
60 lines (44 loc) · 1.41 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
54
55
56
57
58
59
60
PKG := $(shell head -1 DESCRIPTION | sed 's/Package: //' | cat)
VERSION := $(shell sed -n 3p DESCRIPTION | sed 's/Version: //' | cat)
BINARY := $(PKG)_$(VERSION).tar.gz
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_PATH))))
R_ARGS := --no-site-file --no-environ --no-save \
--no-restore --no-resave-data --no-manual --quiet
ifneq (, $(findstring r-devel,$(CURRENT_DIR)))
R := Rdevel.sh
else
R := R
endif
all: clean docs data readme build check install site
quick: clean
clean:
@rm -rf src/*.so src/*.o *tar.gz *Rcheck*
build:
$(R) $(R_ARGS) CMD build .
build-cran:
$(R) CMD build . --no-resave-data --no-manual
check:
$(R) CMD check $(BINARY)
check-cran:
$(R) CMD check --as-cran $(BINARY)
check-quick $(BINARY):
$(R) $(R_ARGS) CMD build .
$(R) CMD check $(BINARY)
install: $(BINARY)
$(R) CMD INSTALL --no-multiarch --with-keep.source $(BINARY)
install-code:
$(R) CMD INSTALL --no-multiarch --with-keep.source --no-docs .
install-quick:
$(R) CMD INSTALL --no-multiarch --no-docs --no-html \
--with-keep.source .
readme: README.Rmd
$(R) --vanilla --slave -e "rmarkdown::render('README.Rmd')"
docs:
$(R) --vanilla --slave -e "devtools::document()"
data:
Rscript --vanilla --slave tools/example_objects.R
Rscript --vanilla --slave tools/test_objects.R
site:
$(R) --vanilla --slave -e "pkgdown::build_site()"
.PHONY: clean docs data