I am trying to find how to use regular expressions in a makefile, for example:
foo:
ifeq ($(bar),^ver[0-9]+)
do something
else ($(baz),word)
do something else
endif
When i type,
foo bar = ver1.1.0
- must do "do something",
foo baz = word
- must do "do something else".
This doesn't work. Can someone help me to understand how to resolve my issue?
Make can't handle regular expressions, so it must delegate that work to the shell:
ZAP := $(shell [[ $(bar) =~ ver[0-9.]+$$ ]] && echo matched)
foo:
ifdef ZAP
@echo BLUE
else
@echo GREEN
endif