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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Similar to this question, but basically you can use shell commands inside a Makefile. So the following is perfectly legal:
Edit for a small disclaimer: IIRC,
bashdoesn’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.