On 6/19/07, Stephan Beal <[EMAIL PROTECTED]> wrote: ...
When a $(warning) or $(error) is inside a 'define', it is evaluated even if it is part of a comment.
The above statement is nonsensical. If something is inside a define, is not inside a comment.
define bogo # $(warning this should not be evaluated here: (bogo $(1))) abc := $(1) endef $(foreach ARG,abc def ghi,$(eval $(call bogo,$(ARG))))
Okay, so you've defined a variable, 'bogo', whose value consists of two lines, the first of which has a '#' as its first non-whitespace character. It isn't a comment at that point, it's just a line with a leading '#'. So why isn't it being treated as a comment when you evaluate it? Answer: it *is*, but the expansion of the variables and functions in the value of 'bogo' takes place before 'eval' does anything. Consider this: define bogo2 # $(warning foo! $(1)) endef all: echo '$(bogo2)' echo '$(call bogo2,baz)' $ gmake -f m2 m2:6: foo! m2:6: foo! baz echo '# ' # echo '# ' # $ When $(bogo2) is expanded, whether directly or via $(call), make recursively expands the variables and functions inside its value. That's all without $(eval) being used at all.
As far as i understand, comments are comments, regardless of the context. ???
Not at all. A comment is only a comment when being read, either as part of the raw makefile or as the first step in eval's actual operation. (Then there are comments in the commands for rules, where if they're indented with a tab then make sees them as normal parts of the commands and passes them to the shell...which then will often ignore them based on *its* rules.) Philip Guenther _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make