Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 181 lines (144 sloc) 5.067 kb
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
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

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)

DESTDIR=$(getenv DESTDIR, $(ROOT)/dist/staging)
RAW_BASE_PATH=$(shell scripts/base-path scripts/xapi.conf)
BASE_PATH=$(DESTDIR)$(RAW_BASE_PATH)
BIN_DIR=$(RAW_BASE_PATH)/bin
BIN_PATH=$(DESTDIR)$(BIN_DIR)
DEBUGDIST=$(BASE_PATH)/debug
LIBEXEC=$(BASE_PATH)/libexec

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
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= generate_constants autogen_idl
OCAML_PHASE2= $(if $(BYTE_ENABLED), ocaml/idl/ocaml_backend/xapi_client.cma) $(if $(NATIVE_ENABLED), 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 $(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/xapi/xapi_unit_test \
ocaml/xstest/xstest \
ocaml/xstest/xsbench \
ocaml/xstest/xscheckperms \
allxenops \
ocaml/xenguest/xenguest \
ocaml/xenguest/dumpcore \
ocaml/xiu/libxenctrl_xiu.so \
ocaml/xiu/xiu \
ocaml/xapi/fakeguestagent \
ocaml/xapi/quicktestbin \
ocaml/xapi/sparse_dd \
ocaml/xapi/monitor_fake_plugin \
ocaml/license/v6d \
ocaml/license/v6d-reopen-logs

OCAML_PHASE3_NOXEN = \
ocaml/ptoken/genptoken \
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/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 = $(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)

Something went wrong with that request. Please try again.