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]
Other format: [Raw text]

Re: mistake in gcc/Makefile.in


19 August 2002 17:53, Alexandre Oliva wrote:
> > CFLAGS = -g
> > in gcc/Makefile.in *overrides* shell variable CFLAGS
>
> That's on purpose.  A number of compilers used to miscompile GCC if
> optimization was enabled.  Compiling stage1 without optimization helps
> avoid that.

Thanks, now I'm understood that point.

(Sorry for my possibly stupid complain...)

But as explained in gcc/Makefile.in, options which are passed to stage1 
compilation is STAGE1_CFLAGS, not CFLAGS (which is for *the user* to override 
to). And there is third variable BOOT_CFLAGS which passed to stages 2,3,4. 
(BOOT_CFLAGS is the value of CFLAGS to pass to the stage2,3,4)

For stage1 (STAGE1_CFLAGS) it's ok, but (in my case) gcc/Makefile.in overrides 
CFLAGS and BOOT_CFLAGS for other stages too. May be I'm wrong, but I'll try 
to explain.
Say, I want to compile gcc (stage3) with CFLAGS="-O2 -march=i686".
My commands:

[~]% tar -zxf gcc-3.2.tar.gz
[~]% mkdir gcc-build
[~]% cd gcc-build
[~/gcc-build]% export CFLAGS="-O2 -march=i686"
[~/gcc-build]% ../gcc-3.2/configure --prefix=/opt/gcc-3.2 --enable-shared 
--with-gnu-as --with-gnu-ld --disable-multilib --enable-threads=posix 
--enable-languages=c

Now we have ./Makefile, in which CFLAGS set up correctly (CFLAGS="-O2 
-march=i686"), but there are no strings in ./gcc/Makefile with "march=i686"!
And in ./gcc/Makefile:
CFLAGS = -g
STAGE1_CFLAGS = -g
BOOT_CFLAGS = -g -O2

And then, if I do make bootstrap, stage2,3 is going with "-g -O2", not with 
"-O2 -march=i686"!

I'm don't clearly understand automake/autoconf tools and can't now find where 
error occurs :-(


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