tags:

views:

17

answers:

1

I wonder how to match exact occurrence of a given word in the given list of words using only standard makefile operations. In the below example for WORD_TO_MATCH = a the result is positive and apparently wrong.

INPUT_LIST= aa bb

WORD_TO_MATCH = aa
#WORD_TO_MATCH = a

ifneq ($(findstring $(WORD_TO_MATCH),$(INPUT_LIST)),)
    $(warning List contains "$(WORD_TO_MATCH)")
else
    $(warning List doesnt contain "$(WORD_TO_MATCH)")
endif
A: 

Use filter instead of findstring:

...
ifneq ($(filter $(WORD_TO_MATCH),$(INPUT_LIST)),)  
    $(warning List contains "$(WORD_TO_MATCH)")
...
Andy