help-make
[Top][All Lists]
Advanced

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

Re: A function to print instead of $(warning ) or $(error )


From: Pete Johnson
Subject: Re: A function to print instead of $(warning ) or $(error )
Date: Wed, 23 Feb 2005 17:54:21 -0800


On Feb 23, 2005, at 8:03 AM, John Graham-Cumming 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.

-Pete





reply via email to

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