bug-make
[Top][All Lists]
Advanced

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

overzealous @command within canned command sequence in 3.79.1


From: E. Jay Berkenbilt
Subject: overzealous @command within canned command sequence in 3.79.1
Date: Fri, 22 Jun 2001 13:46:26 -0400

With the following Makefile:

----
define thing
        echo 1
        @echo 2
        echo 3
endef

test:
        $(thing)
----

run make.  In version 3.79.1, the output is

echo 1
1
2
3

In version 3.77, the output is the expected

echo 1
1
2
echo 3
3

The behavior in 3.79.1 does not agree with the behavior described in
the manual in the mode "Defining Canned Command Sequences" as quoted
below:

>     In command execution, each line of a canned sequence is treated just
>  as if the line appeared on its own in the rule, preceded by a tab.  In
>  particular, `make' invokes a separate subshell for each line.  You can
>  use the special prefix characters that affect command lines (`@', `-',
>  and `+') on each line of a canned sequence.  *Note Writing the Commands
>  in Rules: Commands.  For example, using this canned sequence:
>
>       define frobnicate
>       @echo "frobnicating target $@"
>       frob-step-1 $< -o address@hidden
>       frob-step-2 address@hidden -o $@
>       endef
>
>  `make' will not echo the first line, the `echo' command.  But it _will_
>  echo the following two command lines.
>
>     On the other hand, prefix characters on the command line that refers
>  to a canned sequence apply to every line in the sequence.  So the rule:
>
>       frob.out: frob.in
>               @$(frobnicate)
>
>  does not echo _any_ commands.  (*Note Command Echoing: Echoing, for a
>  full explanation of `@'.)

Based on what happens with slightly more complex examples, it seems
that once the first @command is encountered within a canned command
sequence, no further commands are echoed within the rest of the
command sequence.  For example, the following:

----
define thing
        echo 1
        @echo 2
        echo 3
endef

all: test1 test2

test1:
        $(thing)
        echo 4

test2:
        echo 5
----

results in

echo 1
1
2
3
echo 4
4
echo 5
5

I have not investigated further or looked at the source.  I also have
no built versions of make between 3.77 and 3.79.1 to test against.
Please let me know if you are unable to reproduce this bug so I can
investigate further.

My version of gnu make 3.79.1 is as distributed with RedHat Linux 7.1,
ix86.

--
E. Jay Berkenbilt <address@hidden>
http://www.ql.org/q/



reply via email to

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