On Feb 23, 2005, at 5:54 PM, Pete Johnson wrote:

This works for me in GNU Make 3.80:

        define foo
        multi
        line message
        output
        endef

        define newline


endef

        space :=
        space += #

        safe-char := |
        make-list-at-newline = $(subst $(newline),$(space),$(subst
        $(space),$(safe-char),$1))
        output-message = $(foreach m,$(call make-list-at-newline,$1),
        $(shell echo $(subst $(safe-char),$(space),$m) 1>&2))

        $(call output-message,$(foo))
        $(call output-message,single line)

One problem with this (aside from output going to stderr and one process per line of output) is that shell meta-characters in the string need to be quoted. We can do this by putting quotes around the arguments to echo, but we also need to back-quote any quote characters inside. This seems pretty convoluted.

And after more experimenting, I don't see how to quote tabs because I can't get them into a variable or literal, and multiple newlines get collapsed into a single newline. It just kind of snowballs out of control.


-Pete



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

Reply via email to