tags:

views:

46

answers:

1

Hi,

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

Seems like quite a common thing to want to do, what's the best way of doing this?

Thanks, Dan

+1  A: 

Similar to this question, but basically you can use shell commands inside a Makefile. So the following is perfectly legal:

foo:
    if [ ${value} -gt 2 ] ; then \
         #Do stuff;\
    fi

Edit for a small disclaimer: IIRC, bash doesn't understand floating point arithmetic. It can interpret them as strings, but it might make things a little weird. Make sure you take this into consideration.

eldarerathis