|
From: | David Boyce |
Subject: | Re: how to filter-out a word sequence? |
Date: | Fri, 05 Jan 2007 11:05:12 -0500 |
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 themin 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
[Prev in Thread] | Current Thread | [Next in Thread] |