-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (30 loc) · 826 Bytes
/
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
PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION)
PKGDATE = `date +%Y-%m-%d`
PKGYEAR = `date +%Y`
all: check
build:
mkdir -p builds
@rm -rf /tmp/$(PKGNAME)
cp -R ./ /tmp/$(PKGNAME)
# set tags
{ \
cd /tmp/$(PKGNAME) ;\
for f in `ls R/*.R man/*.Rd DESCRIPTION LICENSE`; do \
echo "processing $$f" ;\
sed \
-e "s/\$$version\$$\?/$(PKGVERS)/g" \
-e "s/\$$date\$$\?/$(PKGDATE)/g" \
-e "s/\$$year\$$\?/$(PKGYEAR)/g" \
< $$f > $$$$; \
mv $$$$ $$f; \
done; \
}
cd builds; R CMD build /tmp/$(PKGNAME)
@rm -rf /tmp/$(PKGNAME)
check: build
R CMD check builds/$(PKGNAME)_$(PKGVERS).tar.gz
install:
R CMD INSTALL --library=$(R_LIBS_USER) builds/$(PKGNAME)_$(PKGVERS).tar.gz
clean:
@rm -rf $(PKGNAME).Rcheck