This patch applies the same organization to the tools/libxc Makefile
that we implemented in xen/. In particular:
- add a top-level config/ directory, containing one .mk file per
architecture.
- automatically define CONFIG_$(shell uname -s) under tools/. Maybe that
should be moved to the top-level Config.mk instead. John Levon said the
current "SRCS += $(SRCS_Linux)" was an accident; he intended to use
"$(SRCS_$(shell uname -s))" instead... so I just defined a CONFIG_
variable for it.
- define XEN_ROOT in a few places that weren't before, e.g. xen/tools/*.
This is needed to include the config/*.mk files.
The patch also renames "SRCS" and "BUILD_SRCS" to "CTRL_SRCS" and
"GUEST_SRCS", because I found the original naming extremely confusing
("don't we build all the sources?").
This has only been compile-tested on x86_32 (on Linux). Feedback
welcome.
--
Hollis Blanchard
IBM Linux Technology Center
Reorganize the build configuration, in particular for libxc portability.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
diff -r 1e3977e029fd Config.mk
--- a/Config.mk Mon May 08 19:21:41 2006 +0100
+++ b/Config.mk Wed May 10 16:57:30 2006 -0500
@@ -39,19 +39,7 @@ CFLAGS += -g
CFLAGS += -g
endif
-ifeq ($(XEN_TARGET_ARCH),x86_32)
-CFLAGS += -m32 -march=i686
-endif
-
-ifeq ($(XEN_TARGET_ARCH),x86_64)
-CFLAGS += -m64
-endif
-
-ifeq ($(XEN_TARGET_ARCH),x86_64)
-LIBDIR = lib64
-else
-LIBDIR = lib
-endif
+include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
ifneq ($(EXTRA_PREFIX),)
EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
diff -r 1e3977e029fd extras/mini-os/Makefile
--- a/extras/mini-os/Makefile Mon May 08 19:21:41 2006 +0100
+++ b/extras/mini-os/Makefile Wed May 10 16:57:30 2006 -0500
@@ -1,6 +1,7 @@ debug ?= y
debug ?= y
-include $(CURDIR)/../../Config.mk
+XEN_ROOT = ../..
+include $(XEN_ROOT)/Config.mk
# Set TARGET_ARCH
override TARGET_ARCH := $(XEN_TARGET_ARCH)
diff -r 1e3977e029fd tools/Rules.mk
--- a/tools/Rules.mk Mon May 08 19:21:41 2006 +0100
+++ b/tools/Rules.mk Wed May 10 16:57:30 2006 -0500
@@ -4,6 +4,8 @@ all:
all:
include $(XEN_ROOT)/Config.mk
+
+CONFIG-$(shell uname -s) := y
XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
XEN_LIBXC = $(XEN_ROOT)/tools/libxc
diff -r 1e3977e029fd tools/libxc/Makefile
--- a/tools/libxc/Makefile Mon May 08 19:21:41 2006 +0100
+++ b/tools/libxc/Makefile Wed May 10 16:57:30 2006 -0500
@@ -10,42 +10,32 @@ XEN_ROOT = ../..
XEN_ROOT = ../..
include $(XEN_ROOT)/tools/Rules.mk
-SRCS :=
-SRCS += xc_bvtsched.c
-SRCS += xc_core.c
-SRCS += xc_domain.c
-SRCS += xc_evtchn.c
-SRCS += xc_misc.c
-SRCS += xc_acm.c
-SRCS += xc_physdev.c
-SRCS += xc_private.c
-SRCS += xc_sedf.c
-SRCS += xc_tbuf.c
+CTRL_SRCS-y :=
+CTRL_SRCS-y += xc_bvtsched.c
+CTRL_SRCS-y += xc_core.c
+CTRL_SRCS-y += xc_domain.c
+CTRL_SRCS-y += xc_evtchn.c
+CTRL_SRCS-y += xc_misc.c
+CTRL_SRCS-y += xc_acm.c
+CTRL_SRCS-y += xc_physdev.c
+CTRL_SRCS-y += xc_private.c
+CTRL_SRCS-y += xc_sedf.c
+CTRL_SRCS-y += xc_tbuf.c
+CTRL_SRCS-$(CONFIG_X86) += xc_ptrace.c
+CTRL_SRCS-$(CONFIG_X86) += xc_ptrace_core.c
+CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
+CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
-ifeq ($(patsubst x86%,x86,$(XEN_TARGET_ARCH)),x86)
-SRCS += xc_ptrace.c
-SRCS += xc_ptrace_core.c
-SRCS += xc_pagetab.c
-endif
-
-SRCS_Linux += xc_linux.c
-
-SRCS += $(SRCS_Linux)
-
-BUILD_SRCS :=
-BUILD_SRCS += xc_linux_build.c
-BUILD_SRCS += xc_load_bin.c
-BUILD_SRCS += xc_load_elf.c
-BUILD_SRCS += xg_private.c
-
-ifeq ($(XEN_TARGET_ARCH),ia64)
-BUILD_SRCS += xc_ia64_stubs.c
-else
-BUILD_SRCS += xc_load_aout9.c
-BUILD_SRCS += xc_linux_restore.c
-BUILD_SRCS += xc_linux_save.c
-BUILD_SRCS += xc_hvm_build.c
-endif
+GUEST_SRCS-y :=
+GUEST_SRCS-y += xc_linux_build.c
+GUEST_SRCS-y += xc_load_bin.c
+GUEST_SRCS-y += xc_load_elf.c
+GUEST_SRCS-y += xg_private.c
+GUEST_SRCS-$(CONFIG_IA64) += xc_ia64_stubs.c
+GUEST_SRCS-$(CONFIG_PLAN9) += xc_load_aout9.c
+GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c
+GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_save.c
+GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c
CFLAGS += -Werror
CFLAGS += -fno-strict-aliasing
@@ -60,11 +50,11 @@ LDFLAGS += -L.
LDFLAGS += -L.
DEPS = .*.d
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
+CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y))
+CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
-LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS))
-PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS))
+GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y))
+GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y))
LIB := libxenctrl.a
LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
@@ -124,7 +114,7 @@ rpm: build
# libxenctrl
-libxenctrl.a: $(LIB_OBJS)
+libxenctrl.a: $(CTRL_LIB_OBJS)
$(AR) rc $@ $^
libxenctrl.so: libxenctrl.so.$(MAJOR)
@@ -132,12 +122,12 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(
libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
ln -sf $< $@
-libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
+libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR)
-shared -o $@ $^
# libxenguest
-libxenguest.a: $(LIB_BUILD_OBJS)
+libxenguest.a: $(GUEST_LIB_OBJS)
$(AR) rc $@ $^
libxenguest.so: libxenguest.so.$(MAJOR)
@@ -145,7 +135,7 @@ libxenguest.so.$(MAJOR): libxenguest.so.
libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
ln -sf $< $@
-libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS) libxenctrl.so
+libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR)
-shared -o $@ $^ -lz -lxenctrl
-include $(DEPS)
diff -r 1e3977e029fd xen/tools/Makefile
--- a/xen/tools/Makefile Mon May 08 19:21:41 2006 +0100
+++ b/xen/tools/Makefile Wed May 10 16:57:30 2006 -0500
@@ -1,5 +1,6 @@
-include $(BASEDIR)/../Config.mk
+XEN_ROOT = $(BASEDIR)/..
+include $(XEN_ROOT)/Config.mk
.PHONY: default
default:
diff -r 1e3977e029fd xen/tools/figlet/Makefile
--- a/xen/tools/figlet/Makefile Mon May 08 19:21:41 2006 +0100
+++ b/xen/tools/figlet/Makefile Wed May 10 16:57:30 2006 -0500
@@ -1,5 +1,6 @@
-include $(BASEDIR)/../Config.mk
+XEN_ROOT = $(BASEDIR)/..
+include $(XEN_ROOT)/Config.mk
figlet: figlet.c
$(HOSTCC) -o $@ $<
diff -r 1e3977e029fd config/ia64.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/ia64.mk Wed May 10 16:57:30 2006 -0500
@@ -0,0 +1,2 @@
+CONFIG_IA64 := y
+LIBDIR := lib
diff -r 1e3977e029fd config/x86_32.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/x86_32.mk Wed May 10 16:57:30 2006 -0500
@@ -0,0 +1,6 @@
+CONFIG_X86 := y
+CONFIG_PLAN9 := y
+CONFIG_HVM := y
+
+CFLAGS += -m32 -march=i686
+LIBDIR := lib
diff -r 1e3977e029fd config/x86_64.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/x86_64.mk Wed May 10 16:57:30 2006 -0500
@@ -0,0 +1,6 @@
+CONFIG_X86 := y
+CONFIG_PLAN9 := y
+CONFIG_HVM := y
+
+CFLAGS += -m64
+LIBDIR = lib64
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|