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