WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Improved cross-compilation support.

ChangeSet 1.1341, 2005/03/22 09:00:30+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Improved cross-compilation support.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 Config.mk                 |   33 +++++++++++++++++++++++++++++++++
 Makefile                  |    1 +
 tools/Rules.mk            |    5 ++---
 tools/libxc/Makefile      |    2 +-
 tools/libxutil/Makefile   |    2 --
 tools/misc/Makefile       |    1 -
 tools/xentrace/Makefile   |    1 -
 xen/Rules.mk              |    8 ++------
 xen/arch/x86/Rules.mk     |    9 +++------
 xen/tools/figlet/Makefile |    4 ++--
 10 files changed, 44 insertions(+), 22 deletions(-)


diff -Nru a/Config.mk b/Config.mk
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/Config.mk 2005-03-22 05:03:37 -05:00
@@ -0,0 +1,33 @@
+# -*- mode: Makefile; -*-
+# Currently supported architectures: x86_32, x86_64
+XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
+XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
+
+#
+# Tool configuration Makefile fragment
+#
+HOSTCC     = gcc
+HOSTCFLAGS = -Wall -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
+NM         = $(CROSS_COMPILE)nm
+STRIP      = $(CROSS_COMPILE)strip
+OBJCOPY    = $(CROSS_COMPILE)objcopy
+OBJDUMP    = $(CROSS_COMPILE)objdump
+
+
+ifneq ($(EXTRA_PREFIX),)
+EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
+EXTRA_LIB += $(EXTRA_PREFIX)/lib
+endif
+
+LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
+CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
+
+CFLAGS += -g
+
+
diff -Nru a/Makefile b/Makefile
--- a/Makefile  2005-03-22 05:03:37 -05:00
+++ b/Makefile  2005-03-22 05:03:37 -05:00
@@ -27,6 +27,7 @@
 export XEN_TARGET_ARCH SUBARCH
 endif
 
+include Config.mk
 include buildconfigs/Rules.mk
 
 .PHONY:        all dist install xen tools kernels docs world clean mkpatches 
mrproper
diff -Nru a/tools/Rules.mk b/tools/Rules.mk
--- a/tools/Rules.mk    2005-03-22 05:03:37 -05:00
+++ b/tools/Rules.mk    2005-03-22 05:03:37 -05:00
@@ -1,11 +1,10 @@
 #  -*- mode: Makefile; -*-
 
+include $(XEN_ROOT)/Config.mk
+
 XEN_XC             = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 XEN_LIBXUTIL       = $(XEN_ROOT)/tools/libxutil
-
-XEN_COMPILE_ARCH  ?= $(shell uname -m | sed -e s/i.86/x86_32/)
-XEN_TARGET_ARCH   ?= $(XEN_COMPILE_ARCH)
 
 ifeq ($(XEN_TARGET_ARCH),x86_32)
 CFLAGS  += -m32 -march=i686
diff -Nru a/tools/libxc/Makefile b/tools/libxc/Makefile
--- a/tools/libxc/Makefile      2005-03-22 05:03:37 -05:00
+++ b/tools/libxc/Makefile      2005-03-22 05:03:37 -05:00
@@ -105,6 +105,6 @@
        ln -sf $< $@
 
 libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-       $(CC) $(CFLAGS) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ 
-L../libxutil -lxutil -lz
+       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o 
$@ $^ -L../libxutil -lxutil -lz
 
 -include $(DEPS)
diff -Nru a/tools/libxutil/Makefile b/tools/libxutil/Makefile
--- a/tools/libxutil/Makefile   2005-03-22 05:03:37 -05:00
+++ b/tools/libxutil/Makefile   2005-03-22 05:03:37 -05:00
@@ -7,8 +7,6 @@
 
 include $(XEN_ROOT)/tools/Rules.mk
 
-CC = gcc
-
 LIB_SRCS :=
 LIB_SRCS += allocate.c
 LIB_SRCS += enum.c
diff -Nru a/tools/misc/Makefile b/tools/misc/Makefile
--- a/tools/misc/Makefile       2005-03-22 05:03:37 -05:00
+++ b/tools/misc/Makefile       2005-03-22 05:03:37 -05:00
@@ -5,7 +5,6 @@
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CC        = gcc
 CFLAGS   += -Wall -Werror -O3 
 
 INCLUDES += -I $(XEN_XC)
diff -Nru a/tools/xentrace/Makefile b/tools/xentrace/Makefile
--- a/tools/xentrace/Makefile   2005-03-22 05:03:37 -05:00
+++ b/tools/xentrace/Makefile   2005-03-22 05:03:37 -05:00
@@ -6,7 +6,6 @@
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CC       = gcc
 CFLAGS  += -Wall -Werror -O3
 
 CFLAGS  += -I $(XEN_XC)
diff -Nru a/xen/Rules.mk b/xen/Rules.mk
--- a/xen/Rules.mk      2005-03-22 05:03:37 -05:00
+++ b/xen/Rules.mk      2005-03-22 05:03:37 -05:00
@@ -7,9 +7,7 @@
 domu_debug  ?= n
 crash_debug ?= n
 
-# Currently supported architectures: x86_32, x86_64
-XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/)
-XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
+include $(BASEDIR)/../Config.mk
 
 # Set ARCH/SUBARCH appropriately.
 override COMPILE_SUBARCH := $(XEN_COMPILE_ARCH)
@@ -39,10 +37,8 @@
 ALL_OBJS += $(BASEDIR)/drivers/pci/driver.o
 ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
 
-HOSTCC     = gcc
-HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer 
 
-test-gcc-flag = $(shell gcc -v --help 2>&1 | grep -q " $(1) " && echo $(1))
+test-gcc-flag = $(shell $(CC) -v --help 2>&1 | grep -q " $(1) " && echo $(1))
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
diff -Nru a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk     2005-03-22 05:03:37 -05:00
+++ b/xen/arch/x86/Rules.mk     2005-03-22 05:03:37 -05:00
@@ -1,10 +1,7 @@
 ########################################
 # x86-specific definitions
 
-CC := gcc
-LD := ld
-
-CFLAGS  := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
+CFLAGS  += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
 CFLAGS  += -iwithprefix include -Wall -Werror -Wno-format -pipe
 CFLAGS  += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls
 
@@ -24,13 +21,13 @@
 
 ifeq ($(TARGET_SUBARCH),x86_32)
 CFLAGS  += -m32 -march=i686
-LDFLAGS := -m elf_i386 
+LDFLAGS += -m elf_i386 
 endif
 
 ifeq ($(TARGET_SUBARCH),x86_64)
 CFLAGS  += -m64 -mno-red-zone -fpic -fno-reorder-blocks
 CFLAGS  += -fno-asynchronous-unwind-tables
-LDFLAGS := -m elf_x86_64
+LDFLAGS += -m elf_x86_64
 endif
 
 # Test for at least GCC v3.2.x.
diff -Nru a/xen/tools/figlet/Makefile b/xen/tools/figlet/Makefile
--- a/xen/tools/figlet/Makefile 2005-03-22 05:03:37 -05:00
+++ b/xen/tools/figlet/Makefile 2005-03-22 05:03:37 -05:00
@@ -1,8 +1,8 @@
 
-CC := gcc
+include ../../Config.mk
 
 figlet: figlet.c
-       $(CC) -o $@ $<
+       $(HOSTCC) -o $@ $<
 
 clean:
        rm -f *.o figlet


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Improved cross-compilation support., BitKeeper Bot <=