PATCH: LDFLAGS handling in V3

Mark Mitchell mark@codesourcery.com
Mon Jan 2 20:54:00 GMT 2006


Daniel Jacobowitz wrote:

> Why not define LTLDFLAGS to be the libtool analogue of LDFLAGS;
> directly based on the user supplied LDFLAGS, and subdirectories can put
> their own additions into a separate variable, just as we do for
> CFLAGS and LDFLAGS already?  Then the top level can set this, once,
> instead of duplicating it.
> 
> I don't feel strongly about this.  I suppose it could have unintuitive
> results if you ran make in a subdirectory and specified LDFLAGS.  But
> eventually _someone_'s got to copy whatever change we make here to
> every other subdirectory which uses libtool.

I'm going to start by checking my patch (after one more round of testing
with your $SHELL modification), given Alexandre's approval, and your
lack of explicit disapproval. :-)

I'm not sure exactly what to do next.  My immediate goal (being able to
build GCC, G++, and libstdc++ with LDFLAGS_FOR_TARGET=--sysroot=/foo)
will be accomplished, but you're right that it would be nice to extend
this to more libraries.

I'm not sure what the best approach is for the automake directories; for
example, libffi/Makefile.in (as generated from libffi/Makefile.am) uses
LDFLAGS, but there is no mention of LDFLAGS in libffi/Makefile.am.  So,
I guess we would have to redefine LDFLAGS, with something like:

  LDFLAGS := $(shell $(SHELL) libtool-ldflags $(LDFLAGS))

or, in your suggested formulation:

  LDFLAGS = $(LTLDFLAGS)

placed appropriately in Makefile.am.

Perhaps the best solution would be for libtool-ldflags to become part of
the libtool distribution and for automake to use it automatically.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Libstdc++ mailing list