Is there a simple way to do math in GMake? I am currently doing
something like this.
# GNUmakefile
os_math = $(shell echo "$(1)" | bc)
os_add = $(call os_math,$(1)+$(2))
ge = $(shell [[ "$(1)" -ge "$(2)" ]] && echo t)
range = $(if $(call ge,$(strip $(2)),$(strip $(1))),$(call range,$(call
os_add,$(1),1),$(2),$(3) $(1)),$(strip $(3)))
VAR=$(call range,1,10)
all:
@echo VAR=$(VAR)
# end GNUmakefile
An strace of gmake running on the above example shows how painfully slow
this code will make a build which uses it at all. (How many times will
os_add fork? Yikes.) I would like to know if the above can be done
using only GMake primitives? Maybe? Please?
I'll also appreciate hearing any other suggestions or optimizations.
Can any clever mailgroup participant think of a nonrecursive way to
write the range function?
Thanks,
Ken
ps. I'd love to beta test Guile support.
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make