I'm trying to do this in a Makefile:
value = 2.0
if ${greaterthan ${value}, 1.50}
-> execute a rule
elseif ${lessthan ${value}, 0.50}
-> execute a rule
endif
It seems like quite a common thing to want to do. What's the best way of doing this?
+= is used for appending more text to variables e.g. objects=main.o foo.o bar.o. objects+=new.o. which will set objects to 'main.o foo.o bar.o new.o' = is for recursively expanded variable.
$$ means be interpreted as a $ by the shell. the $(UNZIP_PATH) gets expanded by make before being interpreted by the shell.
The ifeq directive begins the conditional, and specifies the condition. It contains two arguments, separated by a comma and surrounded by parentheses. Variable substitution is performed on both arguments and then they are compared.
$(CC) $(CFLAGS) -I$(LIB_PATH) -L$(LIB_PATH) -o $(PROGRAM) main. c -l$(LIB) `pkg-config ...` Basically, you need set the include path to the . h file with -I, then -L for the lib path and -l to set the lib name.
Try this
In this example VER is checked for greater than 4
ifeq ($(shell test $(VER) -gt 4; echo $$?),0)
IFLAGS += -I$(TOPDIR)/include
LIBS += -L$(TOPDIR)/libs -lpcap
endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With