forked from flr/FLCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (38 loc) · 1.54 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
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: NEWS README.md roxygen build
README.md: DESCRIPTION
sed -i 's/Version: *\([^ ]*\)/Version: $(PKGVERS)/' README.md
sed -i 's/Date: *\([^ ]*\)/Date: $(PKGDATE)/' README.md
gh-pages: $(HELP_FILES) README.md
R --vanilla --silent -e "library(staticdocs);" \
-e "build_site('../$(PKGNAME)/', site_path='gh-pages', launch=FALSE)"; \
rm Rplots.pdf
git subtree push --prefix gh-pages origin gh-pages
# git push origin `git subtree split --prefix gh-pages master`:gh-pages --force
NEWS: NEWS.md
sed -e 's/^-/ -/' -e 's/^## *//' -e 's/^#/\t\t/' <NEWS.md | fmt -80 >NEWS
roxygen: $(R_FILES)
R --vanilla --silent -e "library(devtools);" \
-e "document(roclets='rd')"
update:
sed -i 's/Version: \([0-9]\.[0-9]*\.\)\([^ ]*\)/Version: \1$(GITVERS)/' DESCRIPTION
sed -i 's/Date: *\([^ ]*\)/Date: $(GITDATE)/' DESCRIPTION
build:
cd ..;\
R CMD build $(PKGSRC)
install: build
cd ..;\
R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz
check: NEWS README.md roxygen build
cd ..;\
R CMD check $(PKGNAME)_$(PKGVERS).tar.gz --as-cran
clean:
cd ..;\
rm -rf $(PKGNAME).Rcheck $(PKGNAME)_$(PKGVERS).tar.gz