filter-out instead of filter

Guido Witmond guido at witmond.nl
Mon Jul 2 00:31:11 CEST 2018


On 07/01/2018 11:15 PM, Guido Witmond wrote:

> It seems that this code in depot/guido/bin/...<version>.build/etc/tools.conf expects SPECS to be 
> just x86_64 while specs.conf contains: SPECS += genode x86_64
>      ifeq ($(filter-out $(SPECS),x86_64),)
>      CROSS_DEV_PREFIX ?= /usr/local/genode-gcc/bin/genode-x86-
>      endif
> It left CROSS_DEV_PREFIX unset, falling back to the compiler in $PATH.


I've grepped the code and I found the idiom:
     'ifeq(filter-out $SPECS, X),<empty>)'
a few more times. If I'm not mistaken, it is true if $SPECS contains 
only X and false if SPECS contains two or more items even if including an X.

But it goes against the manual of make [1] where the first param is the 
pattern X and the second is the string 'text' to look up the string X.

I wonder why the code is not:
     'ifeq (filter (X,$(SPECS)),X)'
as that would signal a that an X is found in SPECS, irrespective of the 
rest in SPECS.

Cheers, Guido.

1: 
https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-Functions



More information about the users mailing list