forked from kidusasfaw/spatPomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
167 lines (122 loc) · 4.25 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
REXE = R --vanilla
RCMD = $(REXE) CMD
RCMD_ALT = R --no-save --no-restore CMD
RSCRIPT = Rscript --vanilla
PDFLATEX = pdflatex
BIBTEX = bibtex
MAKEIDX = makeindex
RM = rm -f
CP = cp
TOUCH = touch
INSTALL = install
PKG = $(shell perl -ne 'print $$1 if /Package:\s+((\w+[-\.]?)+)/;' DESCRIPTION)
VERSION = $(shell perl -ne 'print $$1 if /Version:\s+((\d+[-\.]?)+)/;' DESCRIPTION)
PKGVERS = $(PKG)_$(VERSION)
SOURCE=$(shell ls R/*R src/*.c src/*.h data/* tests/*R)
default:
@echo $(PKGVERS)
.PHONY: clean win wind tests check
dist manual vignettes: export R_QPDF=qpdf
dist manual vignettes: export R_GSCMD=gs
dist manual vignettes: export GS_QUALITY=ebook
dist manual vignettes: export R_HOME=$(shell $(REXE) RHOME)
check xcheck xxcheck: export FULL_TESTS=yes
xcheck tests: export R_PROFILE_USER=$(CURDIR)/.Rprofile
session htmldocs vignettes data tests manual: export R_LIBS=$(CURDIR)/library
xxcheck: export R_LIBS=$(CURDIR)/check
inst/include/%.h: src/%.h
$(CP) $^ $@
htmldocs: inst/doc/*.html
vignettes: manual install
$(MAKE) -C www/vignettes
news: www/NEWS.html
NEWS: inst/NEWS
inst/NEWS: inst/NEWS.Rd
$(RCMD) Rdconv -t txt $^ -o $@
www/NEWS.html: inst/NEWS.Rd
$(RCMD) Rdconv -t html inst/NEWS.Rd -o www/NEWS.html
session: install
exec $(REXE)
roxy: $(SOURCE)
## $(REXE) -e "pkgload::load_all(compile=FALSE); devtools::document(roclets=c('rd','collate','namespace'))"
$(REXE) -e "pkgbuild::compile_dll(); devtools::document(roclets=c('rd','collate','namespace'))"
dist: NEWS $(PKGVERS).tar.gz
$(PKGVERS).tar.gz: $(SOURCE)
$(RCMD) build --force --no-manual --resave-data --compact-vignettes=both --md5 .
binary: dist
mkdir -p plib
$(RCMD) INSTALL --build --library=plib --preclean --clean $(PKGVERS).tar.gz
rm -rf plib
pkg: $(SOURCE)
R CMD INSTALL ../$(PKG)
publish: dist manual news
$(RSCRIPT) -e 'drat::insertPackage("$(PKGVERS).tar.gz",repodir="../www",action="prune")'
-$(RSCRIPT) -e 'drat::insertPackage("$(PKGVERS).tgz",repodir="../www",action="prune")'
-$(RSCRIPT) -e 'drat::insertPackage("$(PKGVERS).zip",repodir="../www",action="prune")'
$(CP) $(PKG).pdf ../www/manuals
win: dist
curl -T $(PKGVERS).tar.gz ftp://win-builder.r-project.org/R-release/
wind: dist
curl -T $(PKGVERS).tar.gz ftp://win-builder.r-project.org/R-devel/
check: dist
mkdir -p check
$(RCMD) check --no-stop-on-test-error --library=check -o check $(PKGVERS).tar.gz
qcheck: dist
mkdir -p check
$(RCMD) check --library=check -o check --no-vignettes --no-tests $(PKGVERS).tar.gz
qqcheck: dist
mkdir -p check
$(RCMD) check --library=check -o check --no-codoc --no-examples --no-vignettes --no-manual --no-tests $(PKGVERS).tar.gz
xcheck: dist
mkdir -p check
$(RCMD_ALT) check --no-stop-on-test-error --as-cran --library=library -o check $(PKGVERS).tar.gz
xxcheck: xcheck
mkdir -p check
$(REXE) -d "valgrind --tool=memcheck --track-origins=yes --leak-check=full" < check/$(PKG).Rcheck/$(PKG)-Ex.R 2>&1 | tee $(PKG)-Ex.Rout
ycheck: dist
mkdir -p check
$(RCMD_ALT) check --run-dontrun --run-donttest --as-cran --library=library -o check $(PKGVERS).tar.gz
manual: install $(PKG).pdf
$(PKG).pdf: $(SOURCE)
$(RCMD) Rd2pdf --no-preview --pdf --force -o $(PKG).pdf .
$(RSCRIPT) -e "tools::compactPDF(\"$(PKG).pdf\")";
tests: install tests/*.R
export R_LIBS
$(MAKE) -C tests
install: library/$(PKG)
library/$(PKG): dist
mkdir -p library
$(RCMD) INSTALL --library=library $(PKGVERS).tar.gz
remove:
-$(RCMD) REMOVE --library=library $(PKG)
inst/doc/*.html: install
%.tex: %.Rnw
$(RSCRIPT) -e "library(knitr); knit(\"$*.Rnw\")"
%.R: %.Rnw
$(RSCRIPT) -e "library(knitr); purl(\"$*.Rnw\")"
%.pdf: %.tex
$(PDFLATEX) $*
-$(BIBTEX) $*
$(PDFLATEX) $*
$(PDFLATEX) $*
%.bbl: %.tex
-$(PDFLATEX) $*
$(BIBTEX) $*
%.idx: %.tex
-$(PDFLATEX) $*
%.ind: %.idx
$(MAKEIDX) $*
%.html: %.Rmd
PATH=/usr/lib/rstudio/bin/pandoc:$$PATH \
Rscript --vanilla -e "rmarkdown::render(\"$*.Rmd\")"
%.html: %.md
PATH=/usr/lib/rstudio/bin/pandoc:$$PATH \
Rscript --vanilla -e "rmarkdown::render(\"$*.md\")"
%.R: %.Rmd
Rscript --vanilla -e "knitr::purl(\"$*.Rmd\",output=\"$*.R\",documentation=2)"
clean:
$(RM) -r check
$(RM) src/*.o src/*.so src/symbols.rds www/vignettes/Rplots.*
$(RM) -r inst/doc/figure inst/doc/cache
$(RM) -r *-Ex.Rout *-Ex.timings *-Ex.pdf
$(RM) *.tar.gz $(PKGVERS).zip $(PKGVERS).tgz $(PKG).pdf