This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to pass CFLAGS to gcc when building gcc?


On Wed, Jun 27, 2001 at 02:54:20PM -0400, DJ Delorie wrote:
> 
> Have you tried "CC='xyz-gcc -mips2' ./configure" ?

That is ugly and doesn't work too well with rpm. I guess I may be
the only one who ever used the change I made almost 10 years when
I was building the first gcc 2.x Linux/x86 compiler :-). Anyway
here is an update for my last change. BTW, it only affects building
a native gcc with a cross compiler.


H.J.
----
2001-06-27  H.J. Lu  (hjl@gnu.org)

	* Makefile (CFLAGS_FOR_BUILD): New.
	(EXTRA_GCC_FLAGS): Add CFLAGS_FOR_BUILD.

	* gcc/build-make (CC): Removed.
	(HOST_CC): Set to $(CC_FOR_BUILD).
	(HOST_CFLAGS): Replace $(CFLAGS) with $(CFLAGS_FOR_BUILD).
	Fix a typo in comments.

	* gcc/configure.in: Set CFLAGS to $(CFLAGS_FOR_BUILD) when
	generating auto-build.h for canadian cross compile. Set CC
	to `"${CC_FOR_BUILD}"' instead of just `${CC_FOR_BUILD}'.
	Save/restore CFLAGS.
	* gcc/configure: Regenerated.

--- gcc-2.96-20000731/Makefile.in.build	Wed Jun 27 16:05:21 2001
+++ gcc-2.96-20000731/Makefile.in	Wed Jun 27 16:13:10 2001
@@ -87,6 +87,7 @@ CXXFLAGS = -g -O2
 
 LDFLAGS = 
 LIBCFLAGS = $(CFLAGS)
+CFLAGS_FOR_BUILD = $(CFLAGS)
 CFLAGS_FOR_TARGET = $(CFLAGS)
 LDFLAGS_FOR_TARGET = 
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
@@ -447,6 +448,7 @@ EXTRA_GCC_FLAGS = \
 	'RANLIB=$(RANLIB)' \
 	'WINDRES=$$(WINDRES_FOR_TARGET)' \
 	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
+	"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
 	"`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s/.*=$$/XFOO=/`" \
 	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s/.*=$$/XFOO=/`" \
 	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s/.*=$$/XFOO=/`" \
--- gcc-2.96-20000731/gcc/build-make.build	Wed Jun 27 16:05:21 2001
+++ gcc-2.96-20000731/gcc/build-make	Wed Jun 27 16:16:42 2001
@@ -1,17 +1,14 @@
-# We have to use the cross-compiler we just built to compile it.
-CC = gcc -b $(host)
-
 # Need those to compile binaries running on host machine.
 # It is configured by
 #
 # configure --host=target_cpu-target_os \
-#	--target=host=target_cpu-target_os --build=host_cpu-host_os
+#	--target=target_cpu-target_os --build=host_cpu-host_os
 #
 # That HOST stuff has to be taken care of very carefully.
 HOST_PREFIX=l-
 HOST_PREFIX_1=$(HOST_PREFIX)
-HOST_CC=$(CC) -b $(build)
-HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
+HOST_CC=$(CC_FOR_BUILD)
+HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)
 HOST_CLIB=
 HOST_LDFLAGS=$(LDFLAGS)
 HOST_CPPFLAGS=$(ALL_CPPFLAGS)
--- gcc-2.96-20000731/gcc/configure.in.build	Wed Jun 27 16:05:48 2001
+++ gcc-2.96-20000731/gcc/configure.in	Wed Jun 27 16:17:38 2001
@@ -4044,8 +4044,11 @@ else
 	/*) realsrcdir=${srcdir};;
 	*) realsrcdir=../${srcdir};;
 	esac
-	CC=${CC_FOR_BUILD} ${realsrcdir}/configure \
+	saved_CFLAGS="${CFLAGS}"
+	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+	${realsrcdir}/configure \
 		--target=$target --host=$build --build=$build
+	CFLAGS="${saved_CFLAGS}"
 
 	# We just finished tests for the build machine, so rename
 	# the file auto-build.h in the gcc directory.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]