-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
68 lines (57 loc) · 1.46 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
61
62
63
64
65
66
67
68
# Prepare Package for Release
#
# System requirements:
# pdfcrop - http://pdfcrop.sourceforge.net/ - tinytex::tlmgr_install("pdfcrop")
# inkscape - https://inkscape.org/
# svgcleaner - https://github.com/RazrFalcon/svgcleaner
# pandoc - https://pandoc.org/
# phantomjs - https://phantomjs.org/
# optipng - http://optipng.sourceforge.net/
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGSRC := $(shell basename `pwd`)
all: install check clean
.PHONY: all
docs:
R -q -e 'pkgload::load_all()'
R -q -e 'roxygen2::roxygenize()'
R -q -e 'pkgbuild::clean_dll()'
.PHONY: docs
build: docs
cd ..
R CMD build --no-build-vignettes $(PKGSRC)
.PHONY: build
install: build
cd ..
R CMD INSTALL --build $(PKGNAME)_$(PKGVERS).tar.gz
.PHONY: install
check:
cd ..
R CMD check --no-build-vignettes --as-cran $(PKGNAME)_$(PKGVERS).tar.gz
.PHONY: check
clean:
cd ..
rm -f -r $(PKGNAME).Rcheck/
rm -f sysdata.rda
rm -f -r figures
.PHONY: clean
datasets:
cd data-raw
Rscript build-datasets.R
[ -f sysdata.rda ] && mv -f sysdata.rda ../R/
.PHONY: datasets
tables: install
cd data-raw
Rscript render-tables.R
rm -r ../man/figures
mv -f figures ../man/
.PHONY: tables
readme:
R -q -e 'rmarkdown::render('\''README.Rmd'\'')'
.PHONY: readme