Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 1 | Fix various _FOR_BUILD and related variables |
| 2 | |
| 3 | When doing a FOR_BUILD thing, you have to override CFLAGS with |
| 4 | CFLAGS_FOR_BUILD. And if you use C++, you also have to override |
| 5 | CXXFLAGS with CXXFLAGS_FOR_BUILD. |
| 6 | Without this, when building for mingw, you end up trying to use |
| 7 | the mingw headers for a host build. |
| 8 | |
| 9 | The same goes for other variables as well, such as CPPFLAGS, |
| 10 | CPP, and GMPINC. |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | |
| 14 | Signed-off-by: Peter Seebach <peter.seebach@windriver.com> |
| 15 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
| 16 | |
| 17 | diff --git a/Makefile.in b/Makefile.in |
| 18 | index 9370174..011c29a 100644 |
| 19 | --- a/Makefile.in |
| 20 | +++ b/Makefile.in |
| 21 | @@ -152,6 +152,7 @@ BUILD_EXPORTS = \ |
| 22 | CPP="$(CC_FOR_BUILD) -E"; export CPP; \ |
| 23 | CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ |
| 24 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ |
| 25 | + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ |
| 26 | CXX="$(CXX_FOR_BUILD)"; export CXX; \ |
| 27 | CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ |
| 28 | GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ |
| 29 | @@ -170,6 +171,9 @@ BUILD_EXPORTS = \ |
| 30 | # built for the build system to override those in BASE_FLAGS_TO_PASS. |
| 31 | EXTRA_BUILD_FLAGS = \ |
| 32 | CFLAGS="$(CFLAGS_FOR_BUILD)" \ |
| 33 | + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ |
| 34 | + CPP="$(CC_FOR_BUILD) -E" \ |
| 35 | + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \ |
| 36 | LDFLAGS="$(LDFLAGS_FOR_BUILD)" |
| 37 | |
| 38 | # This is the list of directories to built for the host system. |
| 39 | @@ -187,6 +191,7 @@ HOST_SUBDIR = @host_subdir@ |
| 40 | HOST_EXPORTS = \ |
| 41 | $(BASE_EXPORTS) \ |
| 42 | CC="$(CC)"; export CC; \ |
| 43 | + CPP="$(CC) -E"; export CPP; \ |
| 44 | ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \ |
| 45 | CFLAGS="$(CFLAGS)"; export CFLAGS; \ |
| 46 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ |
| 47 | @@ -711,6 +715,7 @@ BASE_FLAGS_TO_PASS = \ |
| 48 | "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ |
| 49 | "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ |
| 50 | "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \ |
| 51 | + "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \ |
| 52 | "EXPECT=$(EXPECT)" \ |
| 53 | "FLEX=$(FLEX)" \ |
| 54 | "INSTALL=$(INSTALL)" \ |
| 55 | diff --git a/Makefile.tpl b/Makefile.tpl |
| 56 | index 1ea1954..78a59c3 100644 |
| 57 | --- a/Makefile.tpl |
| 58 | +++ b/Makefile.tpl |
| 59 | @@ -154,6 +154,7 @@ BUILD_EXPORTS = \ |
| 60 | CC="$(CC_FOR_BUILD)"; export CC; \ |
| 61 | CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ |
| 62 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ |
| 63 | + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ |
| 64 | CXX="$(CXX_FOR_BUILD)"; export CXX; \ |
| 65 | CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ |
| 66 | GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ |
| 67 | @@ -172,6 +173,9 @@ BUILD_EXPORTS = \ |
| 68 | # built for the build system to override those in BASE_FLAGS_TO_PASS. |
| 69 | EXTRA_BUILD_FLAGS = \ |
| 70 | CFLAGS="$(CFLAGS_FOR_BUILD)" \ |
| 71 | + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ |
| 72 | + CPP="$(CC_FOR_BUILD) -E" \ |
| 73 | + CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \ |
| 74 | LDFLAGS="$(LDFLAGS_FOR_BUILD)" |
| 75 | |
| 76 | # This is the list of directories to built for the host system. |
| 77 | @@ -189,6 +193,7 @@ HOST_SUBDIR = @host_subdir@ |
| 78 | HOST_EXPORTS = \ |
| 79 | $(BASE_EXPORTS) \ |
| 80 | CC="$(CC)"; export CC; \ |
| 81 | + CPP="$(CC) -E"; export CPP; \ |
| 82 | ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \ |
| 83 | CFLAGS="$(CFLAGS)"; export CFLAGS; \ |
| 84 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ |
| 85 | diff --git a/gcc/Makefile.in b/gcc/Makefile.in |
| 86 | index cd5bc4a..98ae4f4 100644 |
| 87 | --- a/gcc/Makefile.in |
| 88 | +++ b/gcc/Makefile.in |
| 89 | @@ -762,7 +762,7 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS) |
| 90 | # Native linker and preprocessor flags. For x-fragment overrides. |
| 91 | BUILD_LDFLAGS=@BUILD_LDFLAGS@ |
| 92 | BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ |
| 93 | - -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS) |
| 94 | + -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD) |
| 95 | |
| 96 | # Actual name to use when installing a native compiler. |
| 97 | GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') |
| 98 | diff --git a/gcc/configure b/gcc/configure |
| 99 | index c7ac14b..5ac63e4 100755 |
| 100 | --- a/gcc/configure |
| 101 | +++ b/gcc/configure |
| 102 | @@ -11521,7 +11521,7 @@ else |
| 103 | CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ |
| 104 | CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ |
| 105 | LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ |
| 106 | - GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ |
| 107 | + GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ |
| 108 | ${realsrcdir}/configure \ |
| 109 | --enable-languages=${enable_languages-all} \ |
| 110 | --target=$target_alias --host=$build_alias --build=$build_alias |
| 111 | diff --git a/gcc/configure.ac b/gcc/configure.ac |
| 112 | index 50856e6..17a4dfd 100644 |
| 113 | --- a/gcc/configure.ac |
| 114 | +++ b/gcc/configure.ac |
| 115 | @@ -1633,7 +1633,7 @@ else |
| 116 | CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ |
| 117 | CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ |
| 118 | LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ |
| 119 | - GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \ |
| 120 | + GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ |
| 121 | ${realsrcdir}/configure \ |
| 122 | --enable-languages=${enable_languages-all} \ |
| 123 | --target=$target_alias --host=$build_alias --build=$build_alias |