-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
55 lines (43 loc) · 1.27 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
objects := $(wildcard R/*.R) DESCRIPTION
version := $(shell egrep "^Version" DESCRIPTION | awk '{print $$NF}')
pkg := $(shell egrep "^Package" DESCRIPTION | awk '{print $$NF}')
tar := $(pkg)_$(version).tar.gz
tinytest := $(wildcard inst/tinytest/*.R)
checkLog := $(pkg).Rcheck/00check.log
rmd := $(wildcard vignettes/*.Rmd)
vignettes := $(patsubst %.Rmd,%.html,$(rmd))
.PHONY: check
check: $(checkLog)
.PHONY: build
build: $(tar)
.PHONY: install
install: $(tar)
R CMD INSTALL $(tar)
.PHONY: preview
preview: $(vignettes)
.PHONY: pkgdown
pkgdown:
Rscript -e "library(methods); pkgdown::build_site();"
$(tar): $(objects)
@$(RM) -rf src/RcppExports.cpp R/RcppExports.R
@Rscript -e "library(methods);" \
-e "Rcpp::compileAttributes()" \
-e "devtools::document();"
@$(MAKE) updateTimestamp
R CMD build .
$(checkLog): $(tar) $(tinytest)
R CMD check --as-cran $(tar)
vignettes/%.html: vignettes/%.Rmd
Rscript -e "library(methods); rmarkdown::render('$?')"
## update copyright year in HEADER, R script and date in DESCRIPTION
.PHONY: updateTimestamp
updateTimestamp:
@bash misc/update_timestamp.sh
## make tags
.PHONY: TAGS
TAGS:
Rscript -e "utils::rtags(path = 'R', ofile = 'TAGS')"
gtags
.PHONY: clean
clean:
@$(RM) -rf *~ */*~ *.Rhistroy *.tar.gz src/*.so src/*.o *.Rcheck/ .\#*