Add new flags CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD
Andrew Hsieh [Thu, 17 Jan 2013 17:00:38 +0000 (09:00 -0800)]
In canadian cross build CFLAGS/LDFLAGS may contain flags good
for "host" but not valid for "build".  Define new flags.  eg.

  # flags common to both "host" and "build"
  CFLAGS_FOR_BUILD="-O2 -s -Wno-error"
  LDFLAGS_FOR_BUILD=

  # additional flags for "host"
  CFLAGS="$CFLAGS_FOR_BUILD $HOST_CFLAGS"
  LDFLAGS="$LDFLAGS_FOR_BUILD $HOST_LDFLAGS"

Change-Id: I723d4fa2b62a3945922a027555f30997a66cce48

Makefile.in

index 605574f..9f78f6f 100644 (file)
@@ -190,10 +190,14 @@ endif
 
 # Define environment variables for canadian cross build.
 ifneq ($(cur_host),$(cur_build))
+CFLAGS_FOR_BUILD ?= $(CFLAGS)
+LDFLAGS_FOR_BUILD ?= $(LDFLAGS)
 canadian_build_env := \
        export CC_FOR_BUILD=$(cur_build)-gcc ; \
        export CC=$(cur_build)-gcc ; \
-       export CXX=$(cur_build)-g++ ;
+       export CXX=$(cur_build)-g++ ; \
+       export CFLAGS="$(CFLAGS_FOR_BUILD)" ; \
+       export LDFLAGS="$(LDFLAGS_FOR_BUILD)" ;
 
 CANADIAN_ROOT := $(PWD)/host-${cur_build}
 canadian_env := \