summaryrefslogtreecommitdiff
path: root/Makefile.tpl
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-02-20 14:26:59 +0000
committerPaolo Bonzini <bonzini@gnu.org>2008-02-20 14:26:59 +0000
commitc62e151251d4b1d572b309c5343ef4856e9719f0 (patch)
treeef2bb4cee3f9d5f07a14dca440eeee5af53e5477 /Makefile.tpl
parent7193d18ebdbbec53829c43a2793811f098f921c4 (diff)
downloadbinutils-redhat-c62e151251d4b1d572b309c5343ef4856e9719f0.tar.gz
2008-02-20 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/32009 PR bootstrap/32161 * configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Compute here. * configure: Regenerate. * Makefile.def: Define stage_libcflags for all bootstrap stages. * Makefile.tpl (BOOT_LIBCFLAGS, STAGE2_LIBCFLAGS, STAGE3_LIBCFLAGS, STAGE4_LIBCFLAGS): New. (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Subst from autoconf, without $(SYSROOT_CFLAGS_FOR_TARGET) and $(DEBUG_PREFIX_CFLAGS_FOR_TARGET). (BASE_TARGET_EXPORTS): Append them here to C{,XX}FLAGS. (EXTRA_TARGET_FLAGS): Append them here to {LIB,}C{,XX}FLAGS. (configure-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags for target modules. Don't export LIBCFLAGS. (all-stage[+id+]-[+prefix+][+module+]): Pass stage_libcflags; pass $(BASE_FLAGS_TO_PASS) where [+args+] was passed, and [+args+] after the overridden CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET. (invocations of `all'): Replace $(TARGET_FLAGS_TO_PASS) with $(EXTRA_TARGET_FLAGS), $(FLAGS_TO_PASS) with $(EXTRA_HOST_FLAGS). * Makefile.in: Regenerate. config: 2008-02-20 Paolo Bonzini <bonzini@gnu.org> PR bootstrap/32009 * mh-ppc-darwin (BOOT_CFLAGS): Reenable.
Diffstat (limited to 'Makefile.tpl')
-rw-r--r--Makefile.tpl57
1 files changed, 31 insertions, 26 deletions
diff --git a/Makefile.tpl b/Makefile.tpl
index 12ad2a1ff0..6bc461bfdd 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -207,10 +207,10 @@ BASE_TARGET_EXPORTS = \
AR="$(AR_FOR_TARGET)"; export AR; \
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
CC="$(CC_FOR_TARGET)"; export CC; \
- CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+ CFLAGS="$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
- CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+ CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; \
GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
@@ -330,14 +330,19 @@ PICFLAG =
# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
# overrideable (for a bootstrap build stage1 also builds gcc.info).
-STAGE1_CFLAGS=@stage1_cflags@
STAGE1_CHECKING=@stage1_checking@
STAGE1_LANGUAGES=@stage1_languages@
+STAGE1_CFLAGS=@stage1_cflags@
STAGE2_CFLAGS=$(BOOT_CFLAGS)
STAGE3_CFLAGS=$(BOOT_CFLAGS)
STAGE4_CFLAGS=$(BOOT_CFLAGS)
+STAGE1_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+STAGE2_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+STAGE3_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+STAGE4_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+
do-compare = @do_compare@
do-compare3 = $(do-compare)
do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
@@ -376,18 +381,11 @@ COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
-# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
-# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
-# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
-# We want to ensure that TARGET libraries (which we know are built with
-# gcc) are built with "-O2 -g", so prepend those options when setting
-# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 -g $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) \
- $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
+CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
+CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
-CXXFLAGS_FOR_TARGET = -O2 -g $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) \
- $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
+
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
LDFLAGS_FOR_TARGET =
@@ -491,19 +489,20 @@ POSTSTAGE1_FLAGS_TO_PASS = \
# Flags to pass down to makes which are built with the target environment.
# The double $ decreases the length of the command line; those variables
# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
-# COMPILER_ prefixed variables are not passed down so we expand them here.
+# *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
+# so we expand them here.
EXTRA_TARGET_FLAGS = \
'AR=$$(AR_FOR_TARGET)' \
'AS=$(COMPILER_AS_FOR_TARGET)' \
'CC=$$(CC_FOR_TARGET)' \
- 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
+ 'CFLAGS=$$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
'CXX=$$(CXX_FOR_TARGET)' \
- 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+ 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
- 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
- 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
+ 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
+ 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
'NM=$(COMPILER_NM_FOR_TARGET)' \
'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
'RANLIB=$$(RANLIB_FOR_TARGET)' \
@@ -851,9 +850,11 @@ configure-stage[+id+]-[+prefix+][+module+]:
fi; \
[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
[+exports+][+ IF prev +] \
- [+poststage1_exports+][+ ENDIF prev +] \
+ [+poststage1_exports+][+ ENDIF prev +] [+ IF prefix +] \
+ CFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
+ CXXFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; [+ ELSE +] \
CFLAGS="[+stage_cflags+]"; export CFLAGS; \
- LIBCFLAGS="[+stage_cflags+]"; export LIBCFLAGS; \
+ CXXFLAGS="[+stage_cflags+]"; export CXXFLAGS; [+ ENDIF +] \
echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
cd [+subdir+]/[+module+] || exit 1; \
@@ -890,7 +891,8 @@ all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELS
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
[+exports+] \
(cd [+subdir+]/[+module+] && \
- $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
+ $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
+ $(TARGET-[+prefix+][+module+]))
@endif [+prefix+][+module+]
[+ IF bootstrap +]
@@ -910,8 +912,11 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
[+exports+][+ IF prev +] \
[+poststage1_exports+][+ ENDIF prev +] \
cd [+subdir+]/[+module+] && \
- $(MAKE) [+args+] \
- CFLAGS="[+stage_cflags+]" LIBCFLAGS="[+stage_cflags+]" [+
+ $(MAKE) $(BASE_FLAGS_TO_PASS) \
+ CFLAGS="[+stage_cflags+]" CXXFLAGS="[+stage_cflags+]" \
+ LIBCFLAGS="[+stage_libcflags+]" \
+ CFLAGS_FOR_TARGET="[+stage_libcflags+]" \
+ CXXFLAGS_FOR_TARGET="[+stage_libcflags+]" [+args+] [+
IF prev +][+poststage1_args+][+ ENDIF prev
+] [+extra_make_flags+] \
$(TARGET-stage[+id+]-[+prefix+][+module+])
@@ -961,7 +966,7 @@ clean-stage[+id+]-[+prefix+][+module+]:
[+ all prefix="" subdir="$(HOST_SUBDIR)"
exports="$(HOST_EXPORTS)"
poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
- args="$(FLAGS_TO_PASS)"
+ args="$(EXTRA_HOST_FLAGS)"
poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
.PHONY: check-[+module+] maybe-check-[+module+]
@@ -1059,7 +1064,7 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
exports="$(RAW_CXX_TARGET_EXPORTS)"
- args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
+ args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
[+ ELSE +]
[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
check_multilibs=true
@@ -1070,7 +1075,7 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
exports="$(NORMAL_TARGET_EXPORTS)"
- args="$(TARGET_FLAGS_TO_PASS)" +]
+ args="$(EXTRA_TARGET_FLAGS)" +]
[+ ENDIF +]
.PHONY: check-target-[+module+] maybe-check-target-[+module+]