/
OMakefile
179 lines (145 loc) · 5 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
IPROG=install -m 755 -o root -g root
IDATA=install -m 644 -o root -g root
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
# Default to native code unless COMPILE_NATIVE is defined otherwise
if $(not $(defined-env COMPILE_NATIVE))
COMPILE_NATIVE = yes
export
BYTE_ENABLED = false
NATIVE_ENABLED = $(if $(equal $(COMPILE_NATIVE), yes), true, false)
if $(not $(defined-env CARBON_DISTFILES))
CARBON_DISTFILES = /usr/groups/linux/distfiles
export
OCAMLDEP_MODULES_ENABLED = false
USE_OCAMLFIND = true
OCAMLFLAGS = -g -dtypes -thread -warn-error F
# c compiling stuff
OCAMLCFLAGS += -g
OCAMLOPTFLAGS = -ccopt -fPIC
CFLAGS+=-g -O2
if $(defined-env COMPILE_NATIVE)
CFLAGS+=-DCOMPILE_NATIVE
export
LDFLAGS+=-static
if $(not $(defined-env XEN_ROOT))
XEN_ROOT =
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=$(ROOT)/dist/staging/SDK
SDKWWW=$(ROOT)/dist/staging/SDKwww
DEBUGDIST=$(DIST)/staging/opt/xensource/debug
LIBEXEC=$(DIST)/staging/opt/xensource/libexec
CLEAN_OBJS = *.cmi *.cmo *.cmx *.cma *.cmxa *.annot *.run *.opt *.o *.a
export CLEAN_OBJS
#.PHONY: clean
#clean:
# rm -rf doc/
if $(not $(defined-env COMPILE_OCAML))
COMPILE_OCAML = yes
export
if $(not $(defined-env COMPILE_JS))
COMPILE_JS = yes
export
if $(not $(defined-env COMPILE_JAVA))
COMPILE_JAVA = yes
export
.SUBDIRS: ocaml scripts $(if $(equal $(COMPILE_JAVA), yes), java) $(if $(equal $(COMPILE_JS), yes), javascript)
# inherits COMPILE_XENSTUFF from the Makefile (NB don't set it here or else
# you can't build the fakeserver etc on a machine without Xen, e.g. an Apple)
if $(not $(defined-env COMPILE_XENSTUFF))
COMPILE_XENSTUFF = no
export
.PHONY: none
# Ocaml #############################################################################
OCAML_PHASE1=
OCAML_PHASE2= autogen_idl ocaml/idl/ocaml_backend/xapi_client.cmxa
# JS ################################################################################
JS_PHASE1=
JS_PHASE2=js_binding
JS_PHASE3=
# Java ##############################################################################
JAVA_PHASE1= XenServerConsole.jar
JAVA_PHASE2=
JAVA_PHASE3=
JS_PHASE1_TARGETS = $(if $(equal $(COMPILE_JS), yes), $(JS_PHASE1), none)
JS_PHASE2_TARGETS = $(if $(equal $(COMPILE_JS), yes), $(JS_PHASE2), none)
JS_PHASE3_TARGETS = $(if $(equal $(COMPILE_JS), yes), $(JS_PHASE3), none)
JAVA_PHASE1_TARGETS = $(if $(equal $(COMPILE_JAVA), yes), $(JAVA_PHASE1), none)
JAVA_PHASE2_TARGETS = $(if $(equal $(COMPILE_JAVA), yes), $(JAVA_PHASE2), none)
JAVA_PHASE3_TARGETS = $(if $(equal $(COMPILE_JAVA), yes), $(JAVA_PHASE3), none)
# Phase 3 targets divided into two depending on whether we're building the Xen stuff or not:
OCAML_PHASE3_XEN = \
ocaml/xapi/xapi \
ocaml/xenstored/xenstored \
ocaml/xstest/xstest \
ocaml/xstest/xsbench \
ocaml/xstest/xscheckperms \
allxenops \
ocaml/xenops-ts/runtest \
ocaml/xenguest/xenguest \
ocaml/xenguest/dumpcore \
ocaml/xiu/xiu \
ocaml/xapi/fakeguestagent \
ocaml/xapi/quicktestbin \
ocaml/xsrpc/xsrpc \
ocaml/xsrpc/xsrpcd-util \
ocaml/guest/agent \
ocaml/license/v6testd \
ocaml/license/v6d-reopen-logs
OCAML_PHASE3_NOXEN = \
ocaml/auth/testauthx \
ocaml/xe-cli/xe \
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/stresstest \
ocaml/xapi/binpack \
ocaml/idl/datamodel \
ocaml/idl/html_build \
ocaml/db_process/xapi-db-process \
ocaml/vncproxy/vncproxy \
ocaml/xapi/rrddump \
ocaml/perftest/perftest \
ocaml/perftest/histogram \
ocaml/perftest/cumulative_time \
ocaml/lvhdrt/lvhdrt \
ocaml/mpathalert/mpathalert \
ocaml/multipathrt/multipathrt
OCAML_PHASE3 = $(if $(equal $(COMPILE_XENSTUFF), yes), $(OCAML_PHASE3_XEN) $(OCAML_PHASE3_NOXEN), $(OCAML_PHASE3_NOXEN))
OCAML_PHASE1_TARGETS = $(if $(equal $(COMPILE_OCAML), yes), $(OCAML_PHASE1), none)
OCAML_PHASE2_TARGETS = $(if $(equal $(COMPILE_OCAML), yes), $(OCAML_PHASE2), none)
OCAML_PHASE3_TARGETS = $(if $(equal $(COMPILE_OCAML), yes), $(OCAML_PHASE3), none)
#####################################################################################
# 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)