John Levon
2006-Oct-17 12:42 UTC
[Xen-devel] [PATCH] Introduce Makefile config fragments for OS-specific differences.
# HG changeset patch # User john.levon@sun.com # Date 1161088787 25200 # Node ID 9ab13bf0dc8189319f78c8c33a632337ee80f390 # Parent 833f04aee836304d5f232daf18576952bb436f1b Introduce Makefile config fragments for OS-specific differences. Signed-off-by: John Levon <john.levon@sun.com> diff --git a/Config.mk b/Config.mk --- a/Config.mk +++ b/Config.mk @@ -4,43 +4,19 @@ debug ?= n debug ?= n XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \ - -e s/ppc/powerpc/) + -e s/ppc/powerpc/ -e s/i86pc/x86_32/) XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH) XEN_TARGET_X86_PAE ?= n +XEN_OS ?= $(shell uname -s) # Tools to run on system hosting the build HOSTCC = gcc HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer -AS = $(CROSS_COMPILE)as -LD = $(CROSS_COMPILE)ld -CC = $(CROSS_COMPILE)gcc -CPP = $(CROSS_COMPILE)gcc -E -AR = $(CROSS_COMPILE)ar -RANLIB = $(CROSS_COMPILE)ranlib -NM = $(CROSS_COMPILE)nm -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump - DISTDIR ?= $(XEN_ROOT)/dist DESTDIR ?= / -INSTALL = install -INSTALL_DIR = $(INSTALL) -d -m0755 -INSTALL_DATA = $(INSTALL) -m0644 -INSTALL_PROG = $(INSTALL) -m0755 - -ifneq ($(debug),y) -# Optimisation flags are overridable -CFLAGS ?= -O2 -fomit-frame-pointer -CFLAGS += -DNDEBUG -else -# Less than -O1 produces bad code and large stack frames -CFLAGS ?= -O1 -fno-omit-frame-pointer -CFLAGS += -g -endif - +include $(XEN_ROOT)/config/$(XEN_OS).mk include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk ifneq ($(EXTRA_PREFIX),) @@ -57,9 +33,6 @@ CFLAGS += $(call test-gcc-flag,$(CC) LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) - -# Choose the best mirror to download linux kernel -KERNEL_REPO = http://www.kernel.org # If ACM_SECURITY = y, then the access control module is compiled # into Xen and the policy type can be set by the boot policy file diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,11 +1,6 @@ # # Grand Unified Makefile for Xen. # - -KERNELS ?= linux-2.6-xen -# You may use wildcards in the above e.g. KERNELS=*2.6* - -XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) ) # Export target architecture overrides to Xen and Linux sub-trees. ifneq ($(XEN_TARGET_ARCH),) diff --git a/config/Linux.mk b/config/Linux.mk new file mode 100644 --- /dev/null +++ b/config/Linux.mk @@ -0,0 +1,39 @@ +# -*- mode: Makefile; -*- + +AS = $(CROSS_COMPILE)as +LD = $(CROSS_COMPILE)ld +CC = $(CROSS_COMPILE)gcc +CPP = $(CROSS_COMPILE)gcc -E +AR = $(CROSS_COMPILE)ar +RANLIB = $(CROSS_COMPILE)ranlib +NM = $(CROSS_COMPILE)nm +STRIP = $(CROSS_COMPILE)strip +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump + +INSTALL = install +INSTALL_DIR = $(INSTALL) -d -m0755 +INSTALL_DATA = $(INSTALL) -m0644 +INSTALL_PROG = $(INSTALL) -m0755 + +LIB64DIR=lib64 + +ifneq ($(debug),y) +# Optimisation flags are overridable +CFLAGS ?= -O2 -fomit-frame-pointer +CFLAGS += -DNDEBUG +else +# Less than -O1 produces bad code and large stack frames +CFLAGS ?= -O1 -fno-omit-frame-pointer +CFLAGS += -g +endif + +# Choose the best mirror to download linux kernel +KERNEL_REPO = http://www.kernel.org + +KERNELS ?= linux-2.6-xen +# You may use wildcards in the above e.g. KERNELS=*2.6* + +XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) ) + +CONFIG_MBOOTPACK_OS = y diff --git a/config/SunOS.mk b/config/SunOS.mk new file mode 100644 --- /dev/null +++ b/config/SunOS.mk @@ -0,0 +1,31 @@ +# -*- mode: Makefile; -*- + +AS = $(CROSS_COMPILE)gas +LD = $(CROSS_COMPILE)gld +CC = $(CROSS_COMPILE)gcc +CPP = $(CROSS_COMPILE)gcc -E +AR = $(CROSS_COMPILE)gar +RANLIB = $(CROSS_COMPILE)granlib +NM = $(CROSS_COMPILE)gnm +STRIP = $(CROSS_COMPILE)gstrip +OBJCOPY = $(CROSS_COMPILE)gobjcopy +OBJDUMP = $(CROSS_COMPILE)gobjdump + +INSTALL = ginstall +INSTALL_DIR = $(INSTALL) -d -m0755 +INSTALL_DATA = $(INSTALL) -m0644 +INSTALL_PROG = $(INSTALL) -m0755 + +LIB64DIR=lib/amd64 + +ifneq ($(debug),y) +# Optimisation flags are overridable +CFLAGS ?= -O2 -fno-omit-frame-pointer +CFLAGS += -DNDEBUG +else +# Less than -O1 produces bad code and large stack frames +CFLAGS ?= -O1 -fno-omit-frame-pointer +CFLAGS += -g +endif + +CONFIG_MBOOTPACK_OS = n diff --git a/config/x86_32.mk b/config/x86_32.mk --- a/config/x86_32.mk +++ b/config/x86_32.mk @@ -3,7 +3,7 @@ CONFIG_MIGRATE := y CONFIG_MIGRATE := y CONFIG_XCUTILS := y CONFIG_IOEMU := y -CONFIG_MBOOTPACK := y +CONFIG_MBOOTPACK := $(CONFIG_MBOOTPACK_OS) CFLAGS += -m32 -march=i686 LIBDIR := lib diff --git a/config/x86_64.mk b/config/x86_64.mk --- a/config/x86_64.mk +++ b/config/x86_64.mk @@ -3,8 +3,8 @@ CONFIG_MIGRATE := y CONFIG_MIGRATE := y CONFIG_XCUTILS := y CONFIG_IOEMU := y -CONFIG_MBOOTPACK := y +CONFIG_MBOOTPACK := $(CONFIG_MBOOTPACK_OS) CFLAGS += -m64 LDFLAGS += -m64 -LIBDIR = lib64 +LIBDIR = $(LIB64DIR) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Oct-17 15:09 UTC
Re: [Xen-devel] [PATCH] Introduce Makefile config fragments for OS-specific differences.
On 17/10/06 13:42, "John Levon" <levon@movementarian.org> wrote:> -ifneq ($(debug),y) > -# Optimisation flags are overridable > -CFLAGS ?= -O2 -fomit-frame-pointer > -CFLAGS += -DNDEBUG > -else > -# Less than -O1 produces bad code and large stack frames > -CFLAGS ?= -O1 -fno-omit-frame-pointer > -CFLAGS += -g > -endifGenerally this patch is fine, but does the above chunk have to be made OS-specific? Does Solaris specifically have something against -fomit-frame-pointer? Also, moving KERNEL_REPO/KERNELS/XKERNELS seems unnecessary. There are still rules consuming those variables in the root Makefile, so leaving KERNELS/XKERNELS nearby makes sense to me. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John Levon
2006-Oct-17 15:22 UTC
Re: [Xen-devel] [PATCH] Introduce Makefile config fragments for OS-specific differences.
On Tue, Oct 17, 2006 at 04:09:22PM +0100, Keir Fraser wrote:> > -ifneq ($(debug),y) > > -# Optimisation flags are overridable > > -CFLAGS ?= -O2 -fomit-frame-pointer > > -CFLAGS += -DNDEBUG > > -else > > -# Less than -O1 produces bad code and large stack frames > > -CFLAGS ?= -O1 -fno-omit-frame-pointer > > -CFLAGS += -g > > -endif > > Generally this patch is fine, but does the above chunk have to be made > OS-specific? Does Solaris specifically have something against > -fomit-frame-pointer?Yes, it''s a fundamental principle that all the software we deliver can produce meaningful stack traces.> Also, moving KERNEL_REPO/KERNELS/XKERNELS seems unnecessary. There are still > rules consuming those variables in the root Makefile, so leaving > KERNELS/XKERNELS nearby makes sense to me.This is specifically to make sure that KERNELS is empty on Solaris. Otherwise, we have to add some $(XEN_OS) gook to $(XEN_ROOT)/Makefile. Hopefully these are going away soonish anyway ;) regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel