-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
54 lines (39 loc) · 1.39 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
PKG := $(shell head -1 DESCRIPTION | sed 's/Package: //' | cat)
DOCS_DIR = ../documentation/output
VERSION := $(shell sed -n 3p DESCRIPTION | sed 's/Version: //' | cat)
BINARY := $(PKG)_$(VERSION).tar.gz
RDA_FILES = $(wildcard data/*.rda)
RD_FILES = $(wildcard man/*.Rd)
R_ARGS := --no-site-file --no-environ --no-save \
--no-restore --no-resave-data --no-manual --quiet
R := R
.PHONY: all clean docs data
all: data $(RDA_FILES) $(RD_FILES) README.md README.Rmd build install
data: $(wildcard ../precinct-returns/*/*.rda)
cp $^ data/
man/%.Rd: $(DOCS_DIR)/%.Rd
cp $< $@
data/state_ids.rda: data-ext/state_ids.csv data-ext/state_ids.R
Rscript data-ext/state_ids.R
data/county_ids.rda: data-ext/county_ids.txt data-ext/county_ids.R
cd data-ext && Rscript county_ids.R
data/county_sub_ids.rda: data-ext/county_sub_ids.txt data-ext/county_sub_ids.R
cd data-ext && Rscript county_sub_ids.R
README.md: README.Rmd $(RDA_FILES)
Rscript -e "rmarkdown::render('README.Rmd')"
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)
install: $(BINARY)
$(R) CMD INSTALL --no-multiarch --with-keep.source $(BINARY)
install-code:
$(R) CMD INSTALL --no-multiarch --with-keep.source --no-docs .
docs:
Rscript --vanilla -e "devtools::document()"
site:
Rscript -e "pkgdown::build_site()"