sim: split CPPFLAGS between build & host
Commit Message
In order to merge more common/ files into the top-level, we need to
add more host flags to CPPFLAGS, and that conflicts with our current
use with build-time tools. So split them apart like we do with all
other build flags to avoid the issue.
---
sim/Makefile.am | 5 ++++-
sim/Makefile.in | 5 ++++-
sim/arch-subdir.mk.in | 1 +
sim/common/local.mk | 1 +
sim/configure | 8 ++++++--
sim/m4/sim_ac_toolchain.m4 | 3 +++
6 files changed, 19 insertions(+), 4 deletions(-)
@@ -42,7 +42,10 @@ AM_CPPFLAGS = \
-I$(srcroot)/include \
$(SIM_INLINE)
-COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
+AM_CPPFLAGS_FOR_BUILD = \
+ -I$(srcroot)/include \
+ $(SIM_INLINE)
+COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
## Deps to add to the all-recursive target. These are built before descending
@@ -32,6 +32,7 @@ CC = @CC@
C_DIALECT = @C_DIALECT@
CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
@@ -19,6 +19,7 @@
## Most still lives in common/Make-common.in.
AM_CPPFLAGS += -I$(srcdir)/%D%
+AM_CPPFLAGS_FOR_BUILD += -I$(srcdir)/%D%
## This makes sure common parts are available before building the arch-subdirs
## which will refer to these.
@@ -32,18 +32,21 @@ if test "x$cross_compiling" = "xno"; then
: "${CC_FOR_BUILD:=\$(CC)}"
: "${RANLIB_FOR_BUILD:=\$(RANLIB)}"
: "${CFLAGS_FOR_BUILD:=\$(CFLAGS)}"
+ : "${CPPFLAGS_FOR_BUILD:=\$(CPPFLAGS)}"
: "${LDFLAGS_FOR_BUILD:=\$(LDFLAGS)}"
else
: "${AR_FOR_BUILD:=ar}"
: "${CC_FOR_BUILD:=gcc}"
: "${RANLIB_FOR_BUILD:=ranlib}"
: "${CFLAGS_FOR_BUILD:=-g -O}"
+ : "${CPPFLAGS_FOR_BUILD:=}"
: "${LDLFAGS_FOR_BUILD:=}"
fi
AC_SUBST(AR_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(RANLIB_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
+AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(LDFLAGS_FOR_BUILD)
AC_SUBST(CFLAGS)