* Set internal CPPFLAGS as EXTRA_CPPFLAGS
  - Don't overwrite CPPFLAGS 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 twofold. 

  * Firstly, CPPFLAGS, CFLAGS and LDFLAGS from the environment really ought
    to be honoured
  * Secondly, 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]>

diff --git a/Makefile b/Makefile
index efa8799..8a2863e 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ # a prefix to the install so it doesn't 
 # 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)
 
diff --git a/configure.ac b/configure.ac
index af8d9c7..4bbee75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,7 +106,7 @@ fi
 
 dnl ---Hard codes
 
-CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS)'
+CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS) $(EXTRA_CPPFLAGS)'
 BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)'
 
 dnl ---Sanity checks
diff --git a/kexec/Makefile b/kexec/Makefile
index f8c2f18..bf99b03 100644
--- a/kexec/Makefile
+++ b/kexec/Makefile
@@ -50,7 +50,7 @@ include $(KEXEC_DEPS)
 
 $(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB)
        mkdir -p $(@D)
-       $(CC) $(KCFLAGS) -o $@ $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS)
+       $(CC) $(LDFLAGS) $(KCFLAGS) -o $@ $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS)
 
 $(KEXEC_MANPAGE): kexec/kexec.8
         $(MKDIR) -p     $(MANDIR)/man8
diff --git a/kexec_test/Makefile b/kexec_test/Makefile
index 3e932d5..1bbdfbd 100644
--- a/kexec_test/Makefile
+++ b/kexec_test/Makefile
@@ -19,7 +19,7 @@ include $(KEXEC_TEST_DEPS)
 
 $(KEXEC_TEST_S_TEMPS): $(OBJDIR)/%.s: %.S 
        mkdir -p $(@D)
-       $(CPP) $(CPPFLAGS) -DRELOC=$(RELOC) $< > $@
+       $(CPP) $(EXTRA_CPPFLAGS) $(CPPFLAGS) -DRELOC=$(RELOC) $< > $@
 
 $(KEXEC_TEST_S_OBJS): $(OBJDIR)/%.o: $(OBJDIR)/%.s 
        mkdir -p $(@D)
diff --git a/purgatory/Makefile b/purgatory/Makefile
index 50ce99f..85062ba 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -8,13 +8,13 @@ # should keep us from accidentially incl
 # or headers.
 
 ifeq ($(ARCH),ppc64)
-LDFLAGS = -melf64ppc
+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)

--

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to