How to combine filling a word in a list in a make file

It is interesting how to combine the exact occurrence of a given word in a given list of words using only standard makefile operations. In the example below for WORD_TO_MATCH = a, the result is positive and seems to be incorrect.

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
+3
source share
1 answer

Use filter instead of findstring:

...
ifneq ($(filter $(WORD_TO_MATCH),$(INPUT_LIST)),)  
    $(warning List contains "$(WORD_TO_MATCH)")
...
+7
source

Source: https://habr.com/ru/post/1749212/


All Articles