-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
139 lines (104 loc) · 3.68 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
CWD = $(shell pwd)
DEST ?= $(CWD)/install
BUILD ?= $(CWD)/build
ifeq ($(URPC_INST_DIR),)
PREPARE := ve-urpc
PREPAREINSTALL := ve-urpc-install
PREPAREVE := ve-urpc-ve
PREPAREINSTALLVE := ve-urpc-install-ve
PREPAREVH := ve-urpc-vh
PREPAREINSTALLVH := ve-urpc-install-vh
URPC_INST_DIR := $(DEST)
endif
PACKAGE := aveo
VENDOR := NEC HPC Europe
VERSION := $(shell cat VERSION)
TARBALL := $(PACKAGE)-$(VERSION).tar.gz
RELEASE := 1
RPMBUILD_DIR := $(HOME)/rpmbuild
include make_aveo.inc
MAKEVARS = DEST=$(DEST) BUILD=$(BUILD) URPC_INST_DIR=$(URPC_INST_DIR) PREF=$(PREF)
ALL: $(PREPARE) aveo tests doc
all-ve: $(PREPAREVE) aveo-ve
all-vh: $(PREPAREVH) aveo-vh
aveo:
make -C src $(MAKEVARS)
aveo-ve:
make -C src all-ve $(MAKEVARS)
aveo-vh:
make -C src all-vh $(MAKEVARS)
tests:
make -C test $(MAKEVARS)
test:
make -C test test $(MAKEVARS)
doc:
make -C doc
install: ALL $(PREPAREINSTALL)
make -C src install $(MAKEVARS)
make -C test install $(MAKEVARS)
install-ve: all-ve $(PREPAREINSTALLVE)
make -C src install-ve $(MAKEVARS)
install-vh: all-vh $(PREPAREINSTALLVH)
make -C src install-vh $(MAKEVARS)
# -- rules for RPM build
ifeq ($(VE_ARCH),ve3)
edit = sed -e "s,@PACKAGE@,$(PACKAGE)," -e "s,@VERSION@,$(VERSION)," \
-e "s,@VENDOR@,$(VENDOR)," \
-e "s,@PREFIX@,/opt/nec/ve/veos," \
-e "s,@SUBPREFIX@,/opt/nec/ve3," \
-e "s,@RELEASE@,$(RELEASE),"
# -e "s,@PREFIX@,/usr/local/ve/$(PACKAGE)-$(VERSION),"
else
edit = sed -e "s,@PACKAGE@,$(PACKAGE)," -e "s,@VERSION@,$(VERSION)," \
-e "s,@VENDOR@,$(VENDOR)," \
-e "s,@PREFIX@,/opt/nec/ve/veos," \
-e "s,@SUBPREFIX@,/opt/nec/ve," \
-e "s,@RELEASE@,$(RELEASE),"
# -e "s,@PREFIX@,/usr/local/ve/$(PACKAGE)-$(VERSION),"
endif
aveo.spec: aveo.spec.in
$(edit) $< > $@
aveorun.spec: aveorun.spec.in
$(edit) $< > $@
$(TARBALL): aveo.spec $(CWD)/prereqs/ve-urpc/.git
if [ -d $(PACKAGE)-$(VERSION) ]; then rm -rf $(PACKAGE)-$(VERSION); fi
mkdir -p $(PACKAGE)-$(VERSION)
cp -p aveo.spec $(PACKAGE)-$(VERSION)
cp -rl Makefile make_aveo.inc prereqs README.md scripts src doc test VERSION COPYING $(PACKAGE)-$(VERSION)
rm -rf $(PACKAGE)-$(VERSION)/prereqs/ve-urpc/.git/*
tar czvf $(TARBALL) $(PACKAGE)-$(VERSION)
rm -rf $(PACKAGE)-$(VERSION)
rpm: $(TARBALL) aveo.spec aveorun.spec
mkdir -p ${RPMBUILD_DIR}/SOURCES
cp $(TARBALL) ${RPMBUILD_DIR}/SOURCES
rpmbuild -D "%_topdir $(RPMBUILD_DIR)" -D "%_ve_arch ${VE_ARCH}" -ba aveo.spec
rpmbuild -D "%_topdir $(RPMBUILD_DIR)" -D "%_ve_arch ${VE_ARCH}" -ba aveorun.spec
.PHONY: aveo.spec aveorun.spec $(TARBALL) rpm
# --------------------------
# -- rules for prerequisites
$(CWD)/prereqs/ve-urpc/.git:
git clone https://github.com/SX-Aurora/ve-urpc.git prereqs/ve-urpc
ve-urpc: $(CWD)/prereqs/ $(CWD)/prereqs/ve-urpc/.git
make -C prereqs/ve-urpc BUILD=$(BUILD) DEST=$(URPC_INST_DIR)
ve-urpc-install: ve-urpc
make -C prereqs/ve-urpc install BUILD=$(BUILD) DEST=$(URPC_INST_DIR) PREF=$(PREF)
ve-urpc-ve: $(CWD)/prereqs/ $(CWD)/prereqs/ve-urpc/.git
make -C prereqs/ve-urpc all-ve BUILD=$(BUILD) DEST=$(URPC_INST_DIR)
ve-urpc-install-ve: ve-urpc-ve
make -C prereqs/ve-urpc install-ve BUILD=$(BUILD) DEST=$(URPC_INST_DIR) PREF=$(PREF)
ve-urpc-vh: $(CWD)/prereqs/ $(CWD)/prereqs/ve-urpc/.git
make -C prereqs/ve-urpc all-vh BUILD=$(BUILD) DEST=$(URPC_INST_DIR)
ve-urpc-install-vh: ve-urpc-vh
make -C prereqs/ve-urpc install-vh BUILD=$(BUILD) DEST=$(URPC_INST_DIR) PREF=$(PREF)
# --------------------------
clean:
make -C src clean $(MAKEVARS)
make -C test clean $(MAKEVARS)
make -C doc clean
make -C prereqs/ve-urpc clean BUILD=$(BUILD) DEST=$(URPC_INST_DIR)
rm -f $(TARBALL)
rm -f aveo.spec
rm -f aveorun.spec
realclean: clean
rm -rf $(BUILD) prereqs
.PHONY: aveo tests test install ve-urpc clean realclean doc