help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

recursive functions in a Makefile


From: Dylan Cuthbert
Subject: recursive functions in a Makefile
Date: Thu, 23 May 2002 09:48:53 +0900

Hello there, I wonder if anyone can help me out,

I tried my hand at a little Makefile meta-programming only to have the
Makefile give me an error:

reverse_words  = $(if $(1),$(call reverse_words,$(wordlist 2,$(words
$(1)),$(1))) $(firstword $(1)))
MESSAGE = this is a message to be reversed
REVERSE = $(call reverse_words, $(MESSAGE))

I get the error:

*** Recursive variable `reverse_words' references itself (eventually).
Stop.

I *know* it references itself but I use the Makefile $(if statement to
prevent infinite loops. (in a similar way to specialization in c++ template
meta-programming)

It seems that this error is a little over-zealous in its scope and if
removed would increase the ability of Makefiles enormously.

Regards

---------------------------------
Q-Games, Dylan Cuthbert.
http://www.q-games.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]