help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: how to filter-out a word sequence?


From: Dave Korn
Subject: RE: how to filter-out a word sequence?
Date: Fri, 5 Jan 2007 01:15:47 -0000

On 05 January 2007 01:05, David Boyce wrote:

> My build model has a common link line which contains a number of -z
> options (-z is a way of passing keywords to the linker on Linux and
> Solaris). For instance:
> 
>       $(CC) -o program -z combreloc -z noversion -z defs ...
> 
>   The problem is that occasionally a target will need one of these
> removed as a special case. But of course using $(filter-out -z
> foo,...) will remove *all* the -z flags, leaving the other keywords
> hanging there alone, while quoting the string like $(filter-out "-z
> foo",...) doesn't match anything. Does anybody know a reasonable way
> to remove a whitespace-containing string? I can think of ways
> involving $(shell) with but would prefer to do it all within the make
> process. Another complication is that, because this needs to be
> compatible with clearmake's GNU-compatibility mode, I'm limited to
> those features available since GNU make 3.76 or so.

  Filter out the word name, then patsubst any "-z -z" sequences into a single
"-z"?

/tmp $ cat foo.mk

LDFLAGS:=-z combreloc -z noversion -z defs

LDFLAGS_LESS_1:=$(filter-out noversion,$(LDFLAGS))
LDFLAGS_LESS:=$(patsubst -z -z,-z,$(LDFLAGS_LESS_1))

all:
        @echo 1 is $(LDFLAGS_LESS_1)
        @echo result is $(LDFLAGS_LESS)
        @echo done

/tmp $ make -f foo.mk
1 is -z combreloc -z -z defs
result is -z combreloc -z defs
done
/tmp $


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

[Prev in Thread] Current Thread [Next in Thread]