This repository has been archived by the owner on Oct 28, 2022. It is now read-only.
forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OMakefile
235 lines (197 loc) · 6.26 KB
/
OMakefile
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
SCRIPTS=$(shell pwd)/scripts
IPROG=$(SCRIPTS)/install.sh 755
IDATA=$(SCRIPTS)/install.sh 644
XEN_COMPILE_ARCH = $(shell uname -m | sed -e"s/i.86/x86_32/g")
if $(equal $(XEN_COMPILE_ARCH), x86_32)
LIBDIR = lib
export
else
LIBDIR = lib64
export
# By default compile to native code but not byte code unless specified otherwise
NATIVE_ENABLED=$(getenv COMPILE_NATIVE, true)
BYTE_ENABLED=$(getenv COMPILE_BYTE, false)
if $(not $(or $(NATIVE_ENABLED), $(BYTE_ENABLED)))
eprintln(At least one of native and bytecode compilation modes should be enabled)
exit(1)
export
CARBON_DISTFILES=$(getenv CARBON_DISTFILES, /usr/groups/linux/distfiles)
export
OCAMLDEP_MODULES_ENABLED = false
USE_OCAMLFIND = true
OCAMLFLAGS = -g -dtypes -thread -warn-error +a-4-6-9-27-28-29
# c compiling stuff
OCAMLCFLAGS += -g
OCAMLOPTFLAGS = -ccopt -fPIC
CFLAGS+=-g -O2
if $(NATIVE_ENABLED)
CFLAGS+=-DCOMPILE_NATIVE
export
LDFLAGS+=-static
if $(not $(defined-env XEN_ROOT))
XEN_ROOT =
export
if $(not $(defined-env DESTDIR))
DESTDIR =
export
if $(not $(defined-env VARDIR))
VARDIR=/var/lib/xcp
export
if $(not $(defined-env VARPATCHDIR))
VARPATCHDIR=/var/patch
export
if $(not $(defined-env ETCDIR))
ETCDIR=/etc/xensource
export
if $(not $(defined-env OPTDIR))
OPTDIR=/opt/xensource
export
if $(not $(defined-env PLUGINDIR))
PLUGINDIR=/etc/xapi.d/plugins
export
if $(not $(defined-env HOOKSDIR))
HOOKSDIR=/etc/xapi.d
export
if $(not $(defined-env INVENTORY))
INVENTORY=/etc/xensource-inventory
export
if $(not $(defined-env XAPICONF))
XAPICONF=/etc/xapi.conf
export
if $(not $(defined-env LIBEXECDIR))
LIBEXECDIR=/opt/xensource/libexec
export
if $(not $(defined-env SCRIPTSDIR))
SCRIPTSDIR=/etc/xensource/scripts
export
if $(not $(defined-env SHAREDIR))
SHAREDIR=/opt/xensource
export
if $(not $(defined-env WEBDIR))
WEBDIR=/opt/xensource/www
export
if $(not $(defined-env XHADIR))
XHADIR=/opt/xensource/xha
export
if $(not $(defined-env BINDIR))
BINDIR=/opt/xensource/bin
export
if $(not $(defined-env SBINDIR))
SBINDIR=/opt/xensource/bin
export
if $(not $(defined-env UDEVDIR))
UDEVDIR=/etc/udev
export
XEN_CFLAGS=-I$(XEN_ROOT)/usr/include
XEN_OCAML_LINK_FLAGS=-cclib -L$(XEN_ROOT)/usr/$(LIBDIR)
XEN_OCAML_CLIBS=
# For the Zurich chroot environment
CFLAGS+=-I$(shell ocamlc -where)
DIST=$(ROOT)/dist
SDK=$(DESTDIR)/usr/share/doc/xapi
SDKWWW=$(DESTDIR)/usr/share/doc/xapi/www
CLEAN_OBJS = *.cmi *.cmo *.cmx *.cma *.cmxa *.annot *.run *.opt *.o *.a *.cmt *.cmti
export CLEAN_OBJS
#.PHONY: clean
#clean:
# rm -rf doc/
COMPILE_OCAML=$(getenv COMPILE_OCAML, yes)
COMPILE_JS=$(getenv COMPILE_JS, yes)
COMPILE_JAVA=$(getenv COMPILE_JAVA, no)
PRODUCT_VERSION=$(getenv PRODUCT_VERSION, unknown)
PRODUCT_BRAND=$(getenv PRODUCT_BRAND, unknown)
BUILD_NUMBER=$(getenv BUILD_NUMBER, -1)
export
.SUBDIRS: ocaml scripts $(if $(COMPILE_JAVA), java) $(if $(COMPILE_JS), javascript)
export
.PHONY: none
# Ocaml #############################################################################
OCAML_PHASE1= autogen_idl
OCAML_PHASE2= \
$(if $(BYTE_ENABLED), ocaml/idl/ocaml_backend/xapi_client.cma) $(if $(NATIVE_ENABLED), ocaml/idl/ocaml_backend/xapi_client.cmxa) \
$(if $(BYTE_ENABLED), ocaml/rrdd/rrd_client.cma) $(if $(NATIVE_ENABLED), ocaml/rrdd/rrd_client.cmxa) \
ocaml/rrdd/xcp-rrdd ocaml/rrdd/rrdd_test
# JS ################################################################################
JS_PHASE1=
JS_PHASE2=js_binding
JS_PHASE3=
# Java ##############################################################################
JAVA_PHASE1= XenServerConsole.jar
JAVA_PHASE2=
JAVA_PHASE3=
JS_PHASE1_TARGETS = $(if $(COMPILE_JS), $(JS_PHASE1))
JS_PHASE2_TARGETS = $(if $(COMPILE_JS), $(JS_PHASE2))
JS_PHASE3_TARGETS = $(if $(COMPILE_JS), $(JS_PHASE3))
JAVA_PHASE1_TARGETS = $(if $(COMPILE_JAVA), $(JAVA_PHASE1))
JAVA_PHASE2_TARGETS = $(if $(COMPILE_JAVA), $(JAVA_PHASE2))
JAVA_PHASE3_TARGETS = $(if $(COMPILE_JAVA), $(JAVA_PHASE3))
# Phase 3 targets divided into two depending on whether we're building the Xen stuff or not:
OCAML_PHASE3_XEN = \
ocaml/xapi/xapi \
ocaml/xstest/xstest \
ocaml/xstest/xsbench \
ocaml/xstest/xscheckperms \
allxenops \
ocaml/xenops-cli/xn \
ocaml/xenops-cli/xenopstest \
ocaml/xenops/cancel_utils_test \
ocaml/xenguest/xenguest \
ocaml/xenguest/dumpcore \
ocaml/xapi/quicktestbin \
ocaml/xapi/sparse_dd \
ocaml/xapi/storage_impl_test \
ocaml/xapi/cancel_tests \
ocaml/license/v6d \
ocaml/network/xcp-networkd \
ocaml/network/networkd_db
#ocaml/xapi/monitor_fake_plugin
OCAML_PHASE3_NOXEN = \
ocaml/ptoken/genptoken \
ocaml/auth/testauth \
ocaml/auth/testauthx \
ocaml/xe-cli/xe \
ocaml/sm-cli/sm \
ocaml/sm-cli/smtest \
ocaml/xsh/xsh \
ocaml/xe-cli/rt/test_host \
ocaml/xe-cli/rt/gtclient \
ocaml/xe-cli/rt/gtserver_linux \
ocaml/xe-cli/rt/xgetip \
ocaml/xe-cli/rt/geneva/cli_test \
ocaml/xe-cli/rt/geneva/sm_stress \
ocaml/events/event_listen \
ocaml/console/console \
ocaml/graph/graph \
ocaml/rfb/rfb_randomtest \
ocaml/database/unit_test_marshall \
ocaml/database/block_device_io \
ocaml/toplevel \
ocaml/cdrommon/cdrommon \
ocaml/xapi/binpack \
ocaml/idl/datamodel \
ocaml/db_process/xapi-db-process \
ocaml/vncproxy/vncproxy \
ocaml/perftest/perftest \
ocaml/perftest/histogram \
ocaml/perftest/cumulative_time \
ocaml/lvhdrt/lvhdrt \
ocaml/mpathalert/mpathalert \
ocaml/multipathrt/multipathrt
# ocaml/xapi/rrddump
OCAML_PHASE3 = $(OCAML_PHASE3_XEN) $(OCAML_PHASE3_NOXEN)
OCAML_PHASE1_TARGETS = $(if $(COMPILE_OCAML), $(OCAML_PHASE1))
OCAML_PHASE2_TARGETS = $(if $(COMPILE_OCAML), $(OCAML_PHASE2))
OCAML_PHASE3_TARGETS = $(if $(COMPILE_OCAML), $(OCAML_PHASE3))
#####################################################################################
# phase1: build stdlib2
.PHONY: phase1
phase1: $(OCAML_PHASE1_TARGETS) $(JS_PHASE1_TARGETS) $(JAVA_PHASE1_TARGETS)
mkdir -p $(DIST) $(DIST)/bin
# phase2: build compilers and make autogenerated files
.PHONY: phase2
phase2: $(OCAML_PHASE2_TARGETS) $(JS_PHASE2_TARGETS) $(JAVA_PHASE2_TARGETS)
# phase3: use autogenerated files to make apps
.PHONY: phase3
phase3: $(OCAML_PHASE3_TARGETS) $(JS_PHASE3_TARGETS) $(JAVA_PHASE3_TARGETS)
.PHONY: test
test: ocaml/xenops/xenopsd ocaml/xenops-cli/xenopstest ocaml/xenops-cli/runtest.sh ocaml/test/suite ocaml/database/database_test ocaml/xenops/squeeze_test