The previous post was missing some fragments, here is what it should have looked like:
-- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ [BUILD] CPPFLAGS, CFLAGS and LDFLAGS fixes * Set internal CPPFLAGS as EXTRA_CPPFLAGS, CFLAGS as EXTRA_CFLAGS, and LDFLAGS as EXTRA_LDFLAGS - Don't overwrite CPPFLAGS, LDLFAGS or CFLAGS from the environment - They are irrelevant for BUILD_CC - When cross-compiling for a ppc64 host on a non-ppc64 host, EXTRA_CFLAGS, which is included in BUILD_CPPFLAGS contains -mcall-aixdesc, which does not work on i386 at least * Use LDFLAGS when linking kexec - Append rather than overwrite in purgatory/Makefile The purpose of these changes is three-fold. * CPPFLAGS, CFLAGS and LDFLAGS from the environment really ought to be honoured. For one thing; * Without these changes, the confgiure taget in the toplevel makefile can't work * Without these changes, cross compiling does not work - well, I can't work out how to get it to work anyway. Signed-Off-By: Simon Horman <[EMAIL PROTECTED]> Index: kexec-tools-build-unstable/Makefile =================================================================== --- kexec-tools-build-unstable.orig/Makefile 2006-09-25 12:39:05.000000000 +0900 +++ kexec-tools-build-unstable/Makefile 2006-09-25 12:39:14.000000000 +0900 @@ -13,7 +13,7 @@ # Useful for building binary packages DESTDIR = -CPPFLAGS:= -I./include -I./util_lib/include \ +EXTRA_CPPFLAGS:= -I./include -I./util_lib/include \ -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"' \ $(DEFS) $(EXTRA_CFLAGS) @@ -54,8 +54,9 @@ # cc-option # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) -cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) +cc-option = $(shell if $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(1) -S -o /dev/null \ + -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else \ + echo "$(2)"; fi ;) # Utility function library # Index: kexec-tools-build-unstable/configure.ac =================================================================== --- kexec-tools-build-unstable.orig/configure.ac 2006-09-25 12:39:05.000000000 +0900 +++ kexec-tools-build-unstable/configure.ac 2006-09-25 12:39:14.000000000 +0900 @@ -50,7 +50,9 @@ if test "${host_alias}" ; then OBJDIR="$OBJDIR-${host_alias}" fi -EXTRA_CFLAGS="" + +EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS) $(EXTRA_CPPFLAGS)' +BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' # Check whether ppc64. Add -m64 for building 64-bit binary # Add -mcall-aixdesc to generate dot-symbols as in gcc 3.3.3 @@ -104,11 +106,6 @@ AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, inflateInit_, [AC_DEFINE(HAVE_ZLIB_H, 1) LIBS="$LIBS -lz"])) fi -dnl ---Hard codes - -CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS)' -BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' - dnl ---Sanity checks if test "$CC" = "no"; then AC_MSG_ERROR([cc not found]) fi if test "$CPP" = "no"; then AC_MSG_ERROR([cpp not found]) fi Index: kexec-tools-build-unstable/kexec/Makefile =================================================================== --- kexec-tools-build-unstable.orig/kexec/Makefile 2006-09-25 12:39:05.000000000 +0900 +++ kexec-tools-build-unstable/kexec/Makefile 2006-09-25 12:39:14.000000000 +0900 @@ -7,7 +7,7 @@ $(MKDIR) -p $(@D) $(BIN_TO_HEX) purgatory < $(PURGATORY) > $@ -KCFLAGS:= $(CFLAGS) -Ikexec/arch/$(ARCH)/include +KCFLAGS:= $(CFLAGS) $(EXTRA_CFLAGS) -Ikexec/arch/$(ARCH)/include KEXEC_C_SRCS:= kexec/kexec.c KEXEC_C_SRCS+= kexec/ifdown.c @@ -67,7 +67,8 @@ $(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB) mkdir -p $(@D) - $(CC) $(KCFLAGS) -o $@ $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS) + $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(KCFLAGS) -o $@ \ + $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS) $(KEXEC_MANPAGE): kexec/kexec.8 $(MKDIR) -p $(MANDIR)/man8 Index: kexec-tools-build-unstable/kexec_test/Makefile =================================================================== --- kexec-tools-build-unstable.orig/kexec_test/Makefile 2006-09-25 12:39:05.000000000 +0900 +++ kexec-tools-build-unstable/kexec_test/Makefile 2006-09-25 12:39:14.000000000 +0900 @@ -15,11 +15,11 @@ $(KEXEC_TEST_S_DEPS): $(OBJDIR)/%.d: %.S mkdir -p $(@D) - $(CC) -m32 $(CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@ + $(CC) -m32 $(CFLAGS) $(EXTRA_CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@ $(KEXEC_TEST_S_TEMPS): $(OBJDIR)/%.s: %.S mkdir -p $(@D) - $(CPP) $(CPPFLAGS) -DRELOC=$(RELOC) $< > $@ + $(CPP) $(CPPFLAGS) $(EXTRA_CPPFLAGS) -DRELOC=$(RELOC) $< > $@ $(KEXEC_TEST_S_OBJS): $(OBJDIR)/%.o: $(OBJDIR)/%.s mkdir -p $(@D) Index: kexec-tools-build-unstable/purgatory/Makefile =================================================================== --- kexec-tools-build-unstable.orig/purgatory/Makefile 2006-09-25 12:39:05.000000000 +0900 +++ kexec-tools-build-unstable/purgatory/Makefile 2006-09-25 12:39:14.000000000 +0900 @@ -8,13 +8,13 @@ # or headers. ifeq ($(ARCH),ppc64) -LDFLAGS = -melf64ppc +EXTRA_LDFLAGS = -melf64ppc endif PCFLAGS:=-Wall -Os \ -I$(shell $(CC) -print-file-name=include) \ -Ipurgatory/include -Ipurgatory/arch/$(ARCH)/include \ - $(CPPFLAGS) + $(CPPFLAGS) $(EXTRA_CPPFLAGS) PCFLAGS += $(call cc-option, -ffreestanding) PCFLAGS += $(call cc-option, -fnobuiltin) @@ -59,7 +59,7 @@ $(PURGATORY): $(PURGATORY_OBJS) $(UTIL_LIB) $(MKDIR) -p $(@D) - $(LD) $(LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) + $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) echo:: @echo "PURGATORY_C_SRCS $(PURGATORY_C_SRCS)" Index: kexec-tools-build-unstable/util_lib/Makefile =================================================================== --- kexec-tools-build-unstable.orig/util_lib/Makefile 2006-09-25 12:39:25.000000000 +0900 +++ kexec-tools-build-unstable/util_lib/Makefile 2006-09-25 12:39:40.000000000 +0900 @@ -11,11 +11,11 @@ $(UTIL_LIB_DEPS): $(OBJDIR)/%.d: %.c $(MKDIR) -p $(@D) - $(CC) $(CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@ $(UTIL_LIB_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d $(MKDIR) -p $(@D) - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< $(UTIL_LIB): $(UTIL_LIB_OBJS) $(MKDIR) -p $(@D) _______________________________________________ fastboot mailing list [email protected] https://lists.osdl.org/mailman/listinfo/fastboot
