(Makefile) Evaluate inequality
-
Makefile syntax alone only supports equal / not equal
-
Hence combine with shell command. E.g. to see if
VAL_A > VAL_B
:ifeq ($(shell test $(VAL_A) -gt $(VAL_B); echo $$?), 0) # ...DO SOMETHING... endif
$?
designates the return value of the last shell cmd (in this casetest ...
)$?
has an extra $ sign to escape the $ for evaluation by shelltest
returns 0 if true, else 1VAL_A
,VAL_B
can instead be constant values
References:
Written on March 25, 2021