(I'm using gmake.)
Consider the following code.
ifeq $FOO 1
CFLAGS += -DBAR
endif
ifeq $FOO 2
CFLAGS += -DBAR
endif
ifeq $FOO 3
CFLAGS += -DBAR
endif
Is there a way to collapse the three separate tests into an OR
expression? Something like
if FOO==1 || FOO==2 || FOO==3
CFLAGS += -DBAR
endif
Regards.
As you know, not like that. You /could/ do:
ifneq (,$findstring($FOO,1 2 3))
but that does not scale well.
--
Ben.
One possiblity would be to use the shell. Untested example:
ifeq $(shell test $(FOO) = 1 -o $(FOO) = 2 -o $(FOO) = 2 && echo 1) 1
CFLAGS += -DBAR
endif
FOO = ; rm -rf /
Be careful with the shell.
--
M�ns Rullg�rd
ma...@mansr.com