Very helpful ideas - thanks to all 3 of you. I had not known, or
remembered anyway, that $(subst) operates on a string rather than a
list of whitespace-separated tokens. I think I'll go with that for
now. For completeness, and the archives, I've put a few direct
responses inline below.
I should say up front that the -z example was just that; there may be
other such issues down the road. I'm looking for the most general way
to remove whitespace-containing text and so far $(subst) looks best.
At 08:56 PM 1/4/2007, Philip Guenther wrote:
Option 1)
don't put a space between the -z and its argument to begin with, then use
$(filter-out)
This unfortunately doesn't work because the space is required (at
least by the Sun linker). However, it gave me the idea to use
-Wl,-z,ignore instead which has the same semantics and is viewd by
make as one token. So this is a possibility for any flag which can be
reduced to the -W style.
Option 2)
don't put the unwanted arguments in the general variable but
rather keep them
in another variable for use with just those targets that need them
Yes, this is the "right" solution from a software engineering
perspective. The problem here is that there's a human engineering
aspect as well; people need to be assured that regardless of how
flexible the underlying build technology is, they will always be able
to slice and dice a particular command line as needed without
infrastructure-level work. I had thought $(filter-out) was sufficient
for this 'checklist item' until someone pointed out the -z counter-example.
Option 3)
$(subst -z foo,,$(args))
...but that fails if there are multiple spaces or a tab between
the -z and 'foo'
Option 4)
$(subst -z foo,,$(strip $(args))
...but that replaces *all* internal whitespace in $(args) with
single spaces
Fortunately this build system is generating its Makefiles so we can
be certain that command line formats are entirely regular.
Thanks,
David Boyce
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make