+ # The LDFLAGS we receive from the top-level Makefile are designed directly
+ # for the linker, so we must tell libtool to pass them along explicitly.
+ LIBTOOLLDFLAGS = `for ldflag in $(LDFLAGS); do echo "-Wl,$$ldflag"; done`
It would have to be more complex than this, to preserve quoting of
flags and avoid mangling of comma-containing ldflags
(-Xlinker/-XCClinker are safer in this regard). I'd really prefer to
defer such transformation to the user, given how tricky it is, or
implement it as a separate, reusable script, that takes care of all
issues, and that can even attempt to be clever and recognize some
GCC-specific flags, choosing the right -X*linker flag.