-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (39 loc) · 1.42 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
# h/t to @jimhester and @yihui for this parse block:
# https://github.com/yihui/knitr/blob/dc5ead7bcfc0ebd2789fe99c527c7d91afb3de4a/Makefile#L1-L4
# Note the portability change as suggested in the manual:
# https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Writing-portable-packages
PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGSRC := $(shell basename `pwd`)
RM = rm -rf
RCMD = R --vanilla CMD
RSCRIPT = Rscript --vanilla
all: check clean
docs:
@ $(RSCRIPT) -e "roxygen2::roxygenise()"
readme:
@ $(RSCRIPT) \
-e "Sys.setenv(RSTUDIO_PANDOC='/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools')" \
-e "options(cli.width = 80L)" \
-e "rmarkdown::render('README.Rmd', quiet = TRUE)"
@ $(RM) README.html
test:
@ $(RSCRIPT) \
-e "Sys.setenv(ON_JENKINS = 'true', TZ = 'America/Denver')" \
-e "devtools::test(reporter = 'summary', stop_on_failure = TRUE)"
test_file:
@ $(RSCRIPT) \
-e "Sys.setenv(TZ = 'America/Denver')" \
-e "devtools::load_all()" \
-e "testthat::test_file('$(FILE)', reporter = 'progress', stop_on_failure = TRUE)"
build: docs
@ cd ..;\
$(RCMD) build --resave-data $(PKGSRC)
check: build
@ cd ..;\
$(RCMD) check --no-manual $(PKGNAME)_$(PKGVERS).tar.gz
install:
@ R CMD INSTALL --use-vanilla --preclean --resave-data .
clean:
@ cd ..;\
$(RM) $(PKGNAME)_$(PKGVERS).tar.gz $(PKGNAME).Rcheck