On Mon, 27 Nov 2006 01:48:57 -0600
Brian Lewis <[EMAIL PROTECTED]> wrote:

> I'd like a user-defined function to say x="M"$(N), increment N, and
> return x. I know how to write user-defined functions, but I don't
> understand how they can cause side effects like the incrementing of
> the variable N. In case it isn't clear, this function would return M0
> the first time, M1 the second time, etc. User-defined functions in
> make seem functional. Maybe I can use semicolons? Is the value of a
> function the value of its last expression? Thanks.

This is what I came up with. I'm surprised it worked. Sorry for the noise.

generate_module_name = \
    x = M$(shell printf "%02u" $(CURRENT_MODULE_NUM)) \
    $(eval CURRENT_MODULE_NUM = $(shell expr $(CURRENT_MODULE_NUM) + 1)) \
    $(x)


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to