Re: V3 [PATCH 5/5] gnulib: Support variables from the top level Makefile

H.J. Lu via Gdb-patches
2021-01-05T14:07:27Z

On Tue, Jan 5, 2021 at 5:27 AM Christian Biesinger
<cbiesinger@google.com> wrote:
>
> On Fri, Jan 1, 2021 at 1:07 AM H.J. Lu via Gdb-patches
> <gdb-patches@sourceware.org> wrote:
> >
> > On Thu, Dec 31, 2020 at 3:50 PM Joseph Myers <joseph@codesourcery.com> wrote:
> > >
> > > On Sat, 19 Dec 2020, H.J. Lu via Gcc-patches wrote:
> > >
> > > > Work around what appears to be a GNU make bug handling MAKEFLAGS
> > > > values defined in terms of make variables, as is the case for CC and
> > > > friends when we are called from the top level Makefile.
> > >
> > > This description, and the comment in Makefile.am repeating it, is rather
> > > unhelpful as it provides no way for a reader to know what the supposed bug
> > > is. Reviewers need to be able to work out whether the proposed workaround
> > > is correct or the right approach for working around the bug. Maintainers
> > > in future need to be able to tell what the bug is. So the comment needs
> > > to explain what the bug is and give a reference to a report for the bug in
> > > the GNU make bug tracker, so that subsequent maintainers can look at that
> > > bug to tell if the workaround is still needed at all.
> > >
> >
> > I just copied the same workaround from other directories in GCC.
>
> But could you explain under which circumstances the bug happens?
>

To rebuild a subdirectory with different CFLAGS/CXXFLAGS without
regenerating new Makefiles, like bootstrapping GCC and doing PGO
build in binutils/GDB, we pass new CFLAGS/CXXFLAGS from
toplevel Makefile to the subdirectory. Without this workaround, the old
CFLAGS/CXXFLAGS are used in the subdirectory. The same workaround
is used in subdirectories for bootstrapping GCC. My patch extends
it to GDB for PGO build.

--
H.J.