forked from oar-team/oar3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
188 lines (149 loc) · 5.92 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#/usr/bin/make
# $Id$
export SHELL=/bin/bash
# Modules that can be builded
MODULES = server user node monika drawgantt-svg doc api www-conf common common-libs database
# TODO TOREMOVE monika drawgantt api www-conf database api
MODULES_LIST= $(patsubst %,% |, $(MODULES))|
OPTIONS_LIST= OARCONFDIR | OARUSER | OAROWNER | PREFIX | MANDIR | OARDIR | BINDIR | SBINDIR | DOCDIR
# Define the makefile targets
TARGETS_SUFFIX = build clean install uninstall
TARGETS_BUILD = $(MODULES:=-build)
TARGETS_CLEAN = $(MODULES:=-clean)
TARGETS_INSTALL = $(MODULES:=-install)
TARGETS_SETUP = $(MODULES:=-setup)
TARGETS_UNINSTALL = $(MODULES:=-uninstall)
TARGETS = $(TARGETS_BUILD) $(TARGETS_CLEAN) $(TARGETS_INSTALL) $(TARGETS_UNINSTALL) $(TARGETS_SETUP)
all: usage
build: $(TARGETS_BUILD)
install: $(TARGETS_INSTALL)
clean: $(TARGETS_CLEAN)
uninstall: $(TARGETS_UNINSTALL)
setup: $(TARGETS_SETUP)
tarball: .git
./misc/make_tarball
.git:
@echo "Must be used from a git repository!"
exit 1
usage:
@echo "Usage: make [ OPTIONS=<...> ] [MODULES-]{install|build|clean|uninstall|setup}"
@echo ""
@echo "Where MODULES := { $(MODULES_LIST:||=) }"
@echo ""
@echo " OPTIONS := { $(OPTIONS_LIST) }"
sanity-check:
@[ "`id root`" = "`id`" ] || echo "Warning: root-privileges are required to install some files !"
sanity-setup-check: sanity-check
@id $(OAROWNER) > /dev/null || ( echo "Error: User $(OAROWNER) does not exist!" ; exit -1 )
# Meta targets
$(TARGETS_BUILD): MODULE = $(patsubst %-build,%,$@)
$(TARGETS_BUILD): ACTION = build
$(TARGETS_INSTALL): MODULE = $(patsubst %-install,%,$@)
$(TARGETS_INSTALL): ACTION = install
$(TARGETS_SETUP): MODULE = $(patsubst %-setup,%,$@)
$(TARGETS_SETUP): ACTION = setup
$(TARGETS_UNINSTALL): MODULE = $(patsubst %-uninstall,%,$@)
$(TARGETS_UNINSTALL): ACTION = uninstall
$(TARGETS_CLEAN): MODULE = $(patsubst %-clean,%,$@)
$(TARGETS_CLEAN): ACTION = clean
$(TARGETS_INSTALL): sanity-check
$(MAKE) $(strip $(MODULE))-build
$(MAKE) -f Makefiles/$(strip $(MODULE)).mk install
$(TARGETS_UNINSTALL):
$(MAKE) -f Makefiles/$(strip $(MODULE)).mk uninstall
$(TARGETS_CLEAN):
$(MAKE) -f Makefiles/$(strip $(MODULE)).mk clean
$(TARGETS_BUILD):
$(MAKE) -f Makefiles/$(strip $(MODULE)).mk build
$(TARGETS_SETUP):
-$(MAKE) -s -f Makefiles/$(strip $(MODULE)).mk setup
# Dependencies
server-setup: common-setup common-libs-setup database-setup
server-install: sanity-check common-install common-libs-install database-install
server-clean: common-clean common-libs-clean database-clean
server-build: common-build common-libs-build database-build
server-uninstall: common-uninstall common-libs-uninstall database-uninstall
user-setup: common-setup common-libs-setup
user-install: sanity-check common-install common-libs-install
user-clean: common-clean common-libs-clean
user-build: common-build common-libs-build
user-uninstall: common-uninstall common-libs-uninstall
node-setup: common-setup
node-install: sanity-check common-install
node-clean: common-clean
node-build: common-build
node-uninstall: common-uninstall
drawgantt-setup: www-conf-setup
drawgantt-install: www-conf-install
drawgantt-clean: www-conf-clean
drawgantt-build: www-conf-build
drawgantt-uninstall: www-conf-uninstall
drawgantt-svg-setup: www-conf-setup
drawgantt-svg-install: www-conf-install
drawgantt-svg-clean: www-conf-clean
drawgantt-svg-build: www-conf-build
drawgantt-svg-uninstall: www-conf-uninstall
monika-setup: www-conf-setup
monika-install: www-conf-install
monika-clean: www-conf-clean
monika-build: www-conf-build
monika-uninstall: www-conf-uninstall
api-setup: common-setup common-libs-setup
api-install: sanity-check common-install common-libs-install
api-build: common-build common-libs-build
api-clean: common-clean common-libs-clean
api-uninstall: common-uninstall common-libs-uninstall
P_ACTIONS = build install clean
P_TARGETS = $(patsubst %,packages-%,$(P_ACTIONS))
packages-build: P_ACTION = build
packages-install: P_ACTION = install
packages-clean: P_ACTION = clean
$(P_TARGETS):
# oar-doc
$(MAKE) -f Makefiles/doc.mk $(P_ACTION) \
DESTDIR=$(PACKAGES_DIR)/oar-doc
# oar-common
mkdir -p $(PACKAGES_DIR)/oar-common/var/lib/oar
$(MAKE) -f Makefiles/common.mk $(P_ACTION) \
DESTDIR=$(PACKAGES_DIR)/oar-common
# oar-server
mkdir -p $(PACKAGES_DIR)/oar-server/var/lib/oar
$(MAKE) -f Makefiles/server.mk $(P_ACTION)\
SHAREDIR=/usr/share/oar/oar-server \
DESTDIR=$(PACKAGES_DIR)/oar-server
$(MAKE) -f Makefiles/database.mk $(P_ACTION)\
DESTDIR=$(PACKAGES_DIR)/oar-server \
SHAREDIR=/usr/share/oar/oar-server \
DOCDIR=/usr/share/doc/oar-server
# oar-node
mkdir -p $(PACKAGES_DIR)/oar-node/var/lib/oar
mkdir -p $(PACKAGES_DIR)/oar-node/etc/init.d
$(MAKE) -f Makefiles/node.mk $(P_ACTION)\
DESTDIR=$(PACKAGES_DIR)/oar-node
# oar-user
mkdir -p $(PACKAGES_DIR)/oar-user/var/lib/oar
$(MAKE) -f Makefiles/user.mk $(P_ACTION)\
DESTDIR=$(PACKAGES_DIR)/oar-user
# oar-web-status
$(MAKE) -f Makefiles/monika.mk $(P_ACTION) \
DESTDIR=$(PACKAGES_DIR)/oar-web-status \
DOCDIR=/usr/share/doc/oar-web-status \
SHAREDIR=/usr/share/oar/oar-web-status \
WWWDIR=/usr/share/oar-web-status
$(MAKE) -f Makefiles/drawgantt-svg.mk $(P_ACTION) \
DESTDIR=$(PACKAGES_DIR)/oar-web-status \
DOCDIR=/usr/share/doc/oar-web-status \
SHAREDIR=/usr/share/oar/oar-web-status \
WWWDIR=/usr/share/oar-web-status
$(MAKE) -f Makefiles/www-conf.mk $(P_ACTION) \
DESTDIR=$(PACKAGES_DIR)/oar-web-status \
DOCDIR=/usr/share/doc/oar-web-status \
SHAREDIR=/usr/share/oar/oar-web-status \
WWWDIR=/usr/share/oar-web-status
# oar-restful-api
$(MAKE) -f Makefiles/api.mk $(P_ACTION) \
DOCDIR=/usr/share/doc/oar-restful-api \
DESTDIR=$(PACKAGES_DIR)/oar-restful-api
# keyring
$(MAKE) -f Makefiles/keyring.mk $(P_ACTION) \
DESTDIR=$(PACKAGES_DIR)/oar-keyring