Hello,

I'm developing a complex makefile system which uses $(call) and
$(eval) extensively to minimize the work needed to customize makefiles
to the project, and instead use a library of rules and rule patterns.
The rules and rule patterns are more complex than a mere suffix
replacement.

To debug these complex makefiles, I need to see the expanded value of
variables after $(call) has been used, to verify that $(eval) is in
fact evaluating the correct string.

The problem is that $(shell echo $(your_var_here) >> debug.txt)  fails
if $(your_var_here) contains newlines, which it usually will if it's
designed to be $(eval)'d.

Here's a demo of the problem:
---8<---
define single_line
Line 1
endef

define multi_line
Line 1
Line 2
endef

X_IGNORE:=$(shell echo "Multi Line: " $(multi_line) >> debug.txt)
X_IGNORE:=$(shell echo "Single Line: " $(single_line) >> debug.txt)
--->8---

This will produce a file debug.txt looking like this:

---8<---
Single Line:  Line 1
--->8---

The "Multi Line" shell eval completely and silently fails.

One could hope that quoting "$(multi_line)" would result in the full
text, including embedded newlines, would be appended to debug.txt.
However, make's lexer for double-quoted strings doesn't like embedded
newlines that come from the expansion of contained variables.

Any advice on how to solve this problem? Other ways to debug complex makefiles?

-- Barry


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

Reply via email to