-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
111 lines (70 loc) · 2.85 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
include Swift/src/make.include
# All files that go into package
PKG_FILES = $(shell find Swift -not -path '*/.svn*')
PKG_FILES += Swift/DESCRIPTION
PKG_FILES += Swift/NAMESPACE
PKG_FILES += Swift/src/Makefile Swift/src/make.include Swift/src/geturl.sh
PKG_FILES += $(shell find Swift/src/ -name '*.shasum')
PKG_FILES += $(shell find Swift/src/swift-patches -not -path '*/.svn*')
PACKAGE_DEPS = $(PKG_FILES) Makefile
# Extract the version number from the R package description file
# There should be a line in the file of the form:
# Version: (major).(minor)
SWIFTR_VERSION=$(shell sed -n 's/^Version:[ \t]*\([0-9][0-9]*\.[0-9\.]*\)[ \t]*$$/\1/p' Swift/DESCRIPTION)
GEN_PKG_NAME=Swift_$(SWIFTR_VERSION).tar.gz
FULL_PKG=Swift_$(SWIFTR_VERSION)_full.tar.gz
CRAN_PKG=Swift_$(SWIFTR_VERSION)_cran.tar.gz
COG_SRC = cog-svn
SWIFT_SRC = $(COG_SRC)/modules/swift
SWIFT_DIST = $(SWIFT_SRC)/dist/swift-svn
SWIFT_INST = Swift/inst/swift
SWIFT_PATCH_DIR = Swift/src/swift-patches
all: $(FULL_PKG) $(CRAN_PKG)
build: $(FULL_PKG)
install: $(FULL_PKG)
R CMD INSTALL $(FULL_PKG)
installcran: $(CRAN_PKG)
R CMD INSTALL $(CRAN_PKG)
check: $(FULL_PKG)
R CMD check $(FULL_PKG)
checkcran: $(CRAN_PKG)
R CMD check $(CRAN_PKG)
test: install
Rscript Swift/tests/runtests.R
testcran: installcran
Rscript Swift/tests/runtests.R
clean:
rm -f ./$(FULL_PKG)
rm -f ./$(CRAN_PKG)
rm -rf ./$(SWIFT_INST)
rm -rf ./$(COG_SRC)
$(CRAN_PKG): $(PACKAGE_DEPS) $(SWIFT_SRC_NAME).shasum
- if [ -d .svn -a -x "`which svn`" ]; then svn info > Swift/svninfo; fi
make -C Swift/src removeall
cp $(SWIFT_SRC_NAME).shasum Swift/src
R CMD build Swift
mv $(GEN_PKG_NAME) $(CRAN_PKG)
$(FULL_PKG): $(PACKAGE_DEPS) $(SWIFT_SRC)/.built
- if [ -d .svn -a -x "`which svn`" ]; then svn info > Swift/svninfo; fi
make -C Swift/src removebuild # remove everything aside from final Swift
mkdir -p Swift/inst
rm -Rf ./$(SWIFT_INST)
cp -r $(SWIFT_DIST) $(SWIFT_INST)
- if [ -d .svn -a -x "`which svn`" ]; then svn info > Swift/svninfo; fi
R CMD build Swift
mv $(GEN_PKG_NAME) $(FULL_PKG)
swiftsrc: $(SWIFT_SRC_NAME).shasum $(SWIFT_SRC_NAME).tar.gz
$(SWIFT_SRC_NAME).tar.gz:
sh checkout-swift.sh $(SWIFT_SRC_NAME) $(SWIFT_PATCH_DIR)/$(SWIFT_SRC_PATCH) $(SWIFT_SRC_TAG) $(COG_SRC_TAG)
cp -r $(SWIFT_PATCH_DIR) $(SWIFT_SRC_NAME)/SwiftR-patches
tar --exclude='.svn' -cvvzf $(SWIFT_SRC_NAME).tar.gz $(SWIFT_SRC_NAME)
rm -rf ./$(SWIFT_SRC_NAME)
$(SWIFT_SRC_NAME).shasum: $(SWIFT_SRC_NAME).tar.gz
shasum $(SWIFT_SRC_NAME).tar.gz > $(SWIFT_SRC_NAME).shasum
$(SWIFT_SRC)/.built: $(COG_SRC)/.checkedout
(cd $(SWIFT_SRC) && ant dist && touch .built)
$(COG_SRC)/.checkedout: checkout-swift.sh
sh checkout-swift.sh $(COG_SRC) $(SWIFT_PATCH_DIR)/$(SWIFT_SRC_PATCH) $(SWIFT_SRC_TAG) $(COG_SRC_TAG)
touch $(COG_SRC)/.checkedout
checkversion:
echo SwiftR version is $(SWIFTR_VERSION) according to Swift/DESCRIPTION file