from
http://stackoverflow.com/questions/6593605/how-to-do-arithmetic-operation-in-makefile
jcomeau@intrepid:/tmp$ cat Makefile
START=3
END=5
DIFF_SUB=$(shell echo $(END)-$(START)| bc)
test:@echo it took $(DIFF_SUB) seconds
jcomeau@intrepid:/tmp$ make
it took 2 seconds
If you're doing these inside the target, use your curly braces but double $s: $${DIFF_SUB}
jcomeau@intrepid:/tmp$ cat Makefile
START=3
END=5
DIFF_SUB=$(shell echo $(END)-$(START)| bc)
test:@echo it took $(DIFF_SUB) seconds
test2:@START=3&&
echo HELLO &&
END=7&&
DIFF_SUB=$$(($$END - $$START))&&
echo it took $${DIFF_SUB} seconds
jcomeau@intrepid:/tmp$ make test test2
it took 2 seconds
HELLO
it took 4 seconds