1
# -*- mode: Makefile; -*-
3
# A debug build of Xen and tools?
6
XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
7
-e s/i86pc/x86_32/ -e s/amd64/x86_64/)
8
XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH)
9
XEN_OS ?= $(shell uname -s)
15
# Tools to run on system hosting the build
17
HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
18
HOSTCFLAGS += -fno-strict-aliasing
20
DISTDIR ?= $(XEN_ROOT)/dist
23
# Allow phony attribute to be listed as dependency rather than fake target
26
include $(XEN_ROOT)/config/$(XEN_OS).mk
27
include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
29
SHAREDIR ?= $(PREFIX)/share
30
DOCDIR ?= $(SHAREDIR)/doc/xen
31
MANDIR ?= $(SHAREDIR)/man
33
ifneq ($(EXTRA_PREFIX),)
34
EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
35
EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
42
PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
43
# The above requires that PREFIX contains *no spaces*. This variable is here
44
# to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
45
# https://bugs.launchpad.net/ubuntu/+bug/362570
47
# cc-option: Check if compiler supports first option, else fall back to second.
48
# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
49
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
50
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
52
# cc-option-add: Add an option to compilation flags, but only if supported.
53
# Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
54
cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3)))
55
define cc-option-add-closure
56
ifneq ($$(call cc-option,$$($(2)),$(3),n),n)
61
# cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
62
# Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
63
cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
64
'{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
65
then echo y; else echo n; fi ;)
67
# cc-ver-check: Check compiler is at least specified version, else fail.
68
# Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
69
cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
70
define cc-ver-check-closure
71
ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
72
override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1;
77
define absolutify_xen_root
78
case "$(XEN_ROOT)" in \
79
/*) XEN_ROOT=$(XEN_ROOT) ;; \
80
*) xen_root_lhs=`pwd`; \
81
xen_root_rhs=$(XEN_ROOT)/; \
82
while [ "x$${xen_root_rhs#../}" != "x$$xen_root_rhs" ]; do \
83
xen_root_rhs="$${xen_root_rhs#../}"; \
84
xen_root_rhs="$${xen_root_rhs#/}"; \
85
xen_root_rhs="$${xen_root_rhs#/}"; \
86
xen_root_lhs="$${xen_root_lhs%/*}"; \
88
XEN_ROOT="$$xen_root_lhs/$$xen_root_rhs" ;; \
93
define buildmakevars2shellvars
95
XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
100
buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
101
define buildmakevars2file-closure
105
echo "SBINDIR=\"$(SBINDIR)\"" >> $(1); \
106
echo "BINDIR=\"$(BINDIR)\"" >> $(1); \
107
echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(1); \
108
echo "LIBDIR=\"$(LIBDIR)\"" >> $(1); \
109
echo "SHAREDIR=\"$(SHAREDIR)\"" >> $(1); \
110
echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1); \
111
echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1); \
112
echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1); \
113
echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1)
120
CFLAGS += -fno-strict-aliasing
124
CFLAGS += -Wall -Wstrict-prototypes
126
# -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
127
# result of any casted expression causes a warning.
128
CFLAGS += -Wno-unused-value
130
$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
131
$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
133
LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
134
CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
136
# Enable XSM security module. Enabling XSM requires selection of an
137
# XSM security module (FLASK_ENABLE or ACM_SECURITY).
142
XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles
143
# All the files at that location were downloaded from elsewhere on
144
# the internet. The original download URL is preserved as a comment
145
# near the place in the Xen Makefiles where the file is used.
147
# GIT protocol can be faster than HTTP, if your firewall lets it through.
148
# QEMU_REMOTE=git://xenbits.xensource.com/qemu-xen-unstable.git
149
QEMU_REMOTE=http://xenbits.xensource.com/git-http/qemu-xen-4.0-testing.git
151
# Specify which qemu-dm to use. This may be `ioemu' to use the old
152
# Mercurial in-tree version, or a local directory, or a git URL.
153
# CONFIG_QEMU ?= ../qemu-xen.git
154
CONFIG_QEMU ?= $(QEMU_REMOTE)
156
QEMU_TAG := xen-4.0.0
157
#QEMU_TAG ?= f1d909f0f854194f5a40d850886d1413fb8b63c2
158
# Wed Mar 24 17:16:51 2010 +0000
159
# Make hweight32 function static
161
OCAML_XENSTORED_REPO=http://xenbits.xensource.com/ext/xen-ocaml-tools.hg
163
# Build OCAML version of xenstored instead of the in-tree C version?
164
# This will cause $(OCAML_XENSTORED_REPO) to be cloned.
165
CONFIG_OCAML_XENSTORED ?= n
167
# Optional components
170
LIBXENAPI_BINDINGS ?= n
175
-include $(XEN_ROOT)/.config