This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/59365] Configure script does not pass CFLAGS/CXXFLAGS down to subtargets @ stage1
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 02 Dec 2013 11:00:00 +0000
- Subject: [Bug other/59365] Configure script does not pass CFLAGS/CXXFLAGS down to subtargets @ stage1
- Auto-submitted: auto-generated
- References: <bug-59365-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59365
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to djfd from comment #7)
> just noticed. there is ./config/mt-ospace file with the contents
That is a prebuilt target config. You can do the same for you need too.
FOR_TARGET is the target libraries options that are used.
GCC Makefile options are different from most Makefiles due to not all options
supplied work for the first or later stages. Think you start with something
besides GCC which don't take say -fmyoption but the new GCC does. You cannot
simply set CFLAGS to -fmyoption as that won't work. The other way around is the
same issue. This is why CFLAGS is only done for host libraries.
> # Build libraries optimizing for space, not speed.
> CFLAGS_FOR_TARGET = -g -Os
> CXXFLAGS_FOR_TARGET = -g -Os
>
> it is resulting to next lines in Makefile:
> #### host and target specific makefile fragments come in here.
> CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
> # Build libraries optimizing for space, not speed.
> CFLAGS_FOR_TARGET = -g -Os
> CXXFLAGS_FOR_TARGET = -g -Os
> ###
>
> BUT at that moment we have already C(XX)?FLAGS_for target set earlier:
> CFLAGS_FOR_TARGET = -g --sysroot=/
> CXXFLAGS_FOR_TARGET = -g --sysroot=/
>
> thus, when we choose to optimize target libraries for size, our custom flags
> will be overwritten. Maybe it would be better to have ./config/mt-ospace
> like this:
> # Build libraries optimizing for space, not speed.
> CFLAGS_FOR_TARGET += -g -Os
> CXXFLAGS_FOR_TARGET += -g -Os
>
> (append instead of replace)