-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (55 loc) · 2.08 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
R=R
# -> you can do R=R-devel make ....
PACKAGE=mews
# get VERSION from mews/DESCRIPTION
## ("::" = expand only once, but doesn't work in make <= 3.81)
VERSION := $(shell sed -n '/^Version: /s///p' mews/DESCRIPTION)
TARBALL := $(PACKAGE)_$(VERSION).tar.gz
ZIPFILE := =$(PACKAGE)_$(VERSION).zip
CPP_SRC := $(PACKAGE)/src/*.cpp
all:
make doc-update
make build-package
make install
make pdf
build-package: $(TARBALL)
$(TARBALL): $(PACKAGE)/NAMESPACE $(CPP_SRC)
$(R) CMD build --resave-data=no $(PACKAGE)
install: $(TARBALL)
$(R) CMD INSTALL --preclean $<
@touch $@
doc-update: $(PACKAGE)/R/*.R
echo "library(roxygen2);roxygenize(\"$(PACKAGE)\",roclets = c(\"collate\", \"rd\"))" | $(R) --slave
@touch doc-update
namespace-update :: $(PACKAGE)/NAMESPACE
$(PACKAGE)/NAMESPACE: $(PACKAGE)/R/*.R
echo "library(roxygen2);roxygenize(\"$(PACKAGE)\",roclets = c(\"namespace\"))" | $(R) --slave
## To enable quick compile, run from R:
## library(TMB); precompile(flags="-O0 -g")
quick-install: enum-update $(PACKAGE)/src/LSN.so
enum-update $(PACKAGE)/src/OU.so
$(R) CMD INSTALL $(PACKAGE)
$(PACKAGE)/src/LSN.so: $(PACKAGE)/src/LSN.cpp
cd $(PACKAGE)/src; echo "library(TMB); compile('LSN.cpp')" | $(R) --slave
$(PACKAGE)/src/OU.so: $(PACKAGE)/src/OU.cpp
cd $(PACKAGE)/src; echo "library(TMB); compile('OU.cpp')" | $(R) --slave
unexport TEXINPUTS
pdf: $(PACKAGE).pdf
$(PACKAGE).pdf: $(PACKAGE)/man/*.Rd
rm -f $(PACKAGE).pdf
$(R) CMD Rd2pdf --no-preview $(PACKAGE)
check:
$(R) CMD check $(PACKAGE)
## *NOT* using 'R --vanilla' : then cannot find testthat, TMB, etc they are installed into R's "system" library
test:
echo "devtools::test('mews')" | $(R) --slave
quick-check: quick-install ex-test
ex-test:
echo "library(mews); example(mews)" | $(R) --slave
unlock:
\rm -rf `Rscript --vanilla -e 'writeLines(.Library)'`/00LOCK-mews
# ------------------------------------------ = R's system library
# rm -rf ${R_LIBS}/00LOCK-mews
## ^^^^^^^ This only works if R_LIBS contains a single directory and the same that 'R CMD INSTALL' uses..
clean:
\rm -f install doc-update