-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
56 lines (40 loc) · 1.45 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
PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGDATE := $(shell sed -n "s/Date: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGSRC := $(shell basename `pwd`)
GITDATE=$(shell (git log -1 --date=short --pretty=format:"%ad"))
GITVERS=$(shell (date -d `git log -1 --date=short --pretty=format:"%ad"` +%Y%m%d))
R_FILES := $(wildcard $(PKGSRC)/R/*.R)
HELP_FILES := $(wildcard $(PKGSRC)/man/*.Rd)
all: build
.PHONY: all release roxygen
README.md: DESCRIPTION
sed -i 's/Version: *\([^ ]*\)/Version: $(PKGVERS)/' README.md
sed -i 's/Date: *\([^ ]*\)/Date: $(PKGDATE)/' README.md
NEWS: NEWS.md
sed 's/^# / /' NEWS.md > NEWS
sed -i 's/^##//' NEWS
docs: $(HELP_FILES) README.md
R --vanilla --silent -e "options(repos='http://cran.r-project.org'); pkgdown::build_site(preview=FALSE)"
roxygen: $(HELP_FILES)
$(HELP_FILES): $(R_FILES)
R --vanilla --silent -e "library(devtools);" \
-e "document(roclets='rd')"
update:
sed -i 's/Date: *\([^ ]*\)/Date: $(GITDATE)/' DESCRIPTION
release: build docs
build:
cd ..;\
R --vanilla CMD build $(PKGSRC) --compact-vignettes="gs+qpdf" --resave-data
buildNV: README.md NEWS
cd ..;\
R --vanilla CMD build $(PKGSRC) --no-build-vignettes
install: build
cd ..;\
R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz
check: build
cd ..;\
R --vanilla CMD check $(PKGNAME)_$(PKGVERS).tar.gz --as-cran
clean:
cd ..;\
rm -rf $(PKGNAME).Rcheck $(PKGNAME)_$(PKGVERS).tar.gz