Tim Murphy writes: > Hi, > > I'm implementing some new GNU make functions as loadable modules and I just > wondered if anyone had thoughts about how it would be best to implement > some of them. > > The one I'm looking at now is meant to be a way to add integers. > > My major use would be to e.g. implement a counter so I'm mostly thinking of > being able to do COUNTER:=$(add $(COUNTER),1) > > i.e. $(add x,y). One might also implement a range function recursively > with this e.g. $(call range,1,10) returning "1 2 3 4 5 6 7 8 9" > > I'm thinking that the numbers could be integers so $(add x,-1) would > decrement. > > As I was implementing this, however, I thought: why not add a list of > numbers? > > e.g. > $(add 1 2 3 -1 1) > > This might turn out to be much more generally useful. e.g. adding a list > of file sizes together or something similar. Is this a good idea? > > I also think that some numeric comparison functions might be handy e.g. > $(gt x,y) and $(lt x,y) plus the other obvious variations. Is there > anything else worth putting in?
Perhaps your question is generalized about functions, but in case you are planning to implementat arithmetic, please know that the Gnu Make Standard Library (so named by the author) has arithmetic functions. -- Irony: Visiting Karl Marx's grave, in a private cemetery, costs 4 Euros. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make