bug-make
[Top][All Lists]
Advanced

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

[bug #63172] Using --just-print, -n on a target that uses a multiline ma


From: Paul D. Smith
Subject: [bug #63172] Using --just-print, -n on a target that uses a multiline macro function will print as a single line
Date: Sun, 9 Oct 2022 14:06:29 -0400 (EDT)

Update of bug #63172 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

This behavior is expected, because make processes recipes like this: first the
make variables and functions are expanded, then the results are printed to the
screen, then the command is invoked.

In your example, the handling of the backslash/newlines is done during the
expansion of the call function (just like any other expansion).  So by the
time make gets around to the second step, printing the command, they have
already been removed.

You can play a trick, if you know that this function will only be used inside
a recipe, and "hide" the backslash so it's not considered a backslash-newline
and removed during the first step:


x =
define test_function
        echo $(1) \$x
                $(2) \$x
                $(3)
endef


Now the first step will not consider that an escaped newline and won't remove
the backslash, but the "$x" expands to the empty string so after expansion it
IS a backslash-newline.  Now when make gets to the second step the backslash
is still there, then it's removed by the shell:


$ make
echo 1 \
        2 \
        3
1 2 3



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63172>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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