Subject: Re: make's @ prefix doesn't work correctly in canned sequences
From: "Jorg Schaible" <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 29 Jun 2000 11:06:29 +0000

Did you try the new version 3.79.1 from gnu.org ? I just recognized, that it is available, but I have not tested it.

---------------------------------------- Message History ----------------------------------------

From: [email-masked] on 28/06/2000 22:31

To:   [email-masked]
cc:
Subject:  make's @ prefix doesn't work correctly in canned sequences

In the make utility, the '@' prefix (command echo
suppression) does not work correctly in canned sequences
(defined using the define/endef directive).

If the '@' prefix is placed on any command in the sequence,
command echo is suppressed for all remaining commands in the
sequence (even if the remaining commands don't have the '@'
prefix). This behavior is not in agreement with the
documentation, which says:

     -------------------------------------------------------
     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.
     For example, using this canned sequence:

          define frobnicate
          @echo "frobnicating target $@"
          frob-step-1 $< -o $@-step-1
          frob-step-2 $@-step-1 -o $@
          endef

     `make' will not echo the first line, the `echo' command.
     But it _will_ echo the following two command lines.
     -------------------------------------------------------

Using the example from the documentation (with minor
modifications for the DOS/Win command prompt) I've tested
several versions of make, with the following results:

Cygnus cygwin make
    3.79-3 --unix  : bad
    3.79-3 --win32 : bad

    3.77-? --unix  : OK
    3.77-? --win32 : Can't test; versions before 3.79-3 don't
                     properly handle canned sequences.

    3.75-? --unix  : OK
    3.75-? --win32 : Can't test.

Gnu make binary from unknown source (but not cygnus)
    3.77           : OK
    3.74+wrs-2     : OK

From my tests, I can't tell if the problem is in the FSF gnu
make code, or if the problem is in the Cygnus
additions/modifications. If the problem is in the FSF code,
you can forward this report to them if you'd like, or I can.

I haven't tested the behavior with the other prefixes ('+'
and '-'), but they may have the same problem.

Below, find a copy of the makefile, and a transcript of a
test session.

Regards-
    Scott Carter

PS - Thanks (again) for the quick response on the canned
sequence fix. If you fix this, if you'd like, you can send me
the fixed binary before you do the release, and I'll test it
a bit to see if I flush out any more problems.

--------------------- Transcript ---------------------------

 [ For this demonstration, I have sh.exe in my path. ]

D:\testmake>type makefile
# --- Filename: makefile

.PHONY : all

all: frob.out

define frobnicate
@echo frobnicating target $@
frob-step-1.bat $< -o $@-step-1
frob-step-2.bat $@-step-1 -o $@
endef

frob.out: frob.in
        $(frobnicate)

# --- Create some dummy files to make the example work.

frob.in: frob-step-1.bat frob-step-2.bat
        @echo This is $@ >$@

frob-step-1.bat: makefile
        @echo @echo ... Frob1-ing %1 ... done. > $@

frob-step-2.bat: makefile
        @echo @echo ... Frob2-ing %1 ... done. > $@

# EOF

D:\testmake>uname -a
CYGWIN_NT-4.0 SCARTER 1.1.2(0.21/3/2) 2000-06-06 22:20 i686 unknown
  [ OS: Windows NT 4.0 SP 5. ]
  [ I also tested on Windows 98 -- had similar (not
    identical) problem. ]

D:\testmake>echo %MAKE_MODE%
%MAKE_MODE%
  [ i.e., MAKE_MODE is not in the environment. ]

D:\testmake>make_3793c --unix
frobnicating target frob.out
... Frob1-ing frob.in ... done.
... Frob2-ing frob.out-step-1 ... done.
  [ bad ]

D:\testmake>make_3793c --win32
frobnicating target frob.out
... Frob1-ing frob.in ... done.
... Frob2-ing frob.out-step-1 ... done.
  [ bad ]

D:\testmake>make_377c --unix
frobnicating target frob.out
frob-step-1.bat frob.in -o frob.out-step-1
... Frob1-ing frob.in ... done.
frob-step-2.bat frob.out-step-1 -o frob.out
.. Frob2-ing frob.out-step-1 ... done.
  [ OK ]

D:\testmake>make_377c --win32
frobnicating target frob.out
STEMDRIVE=C:
make_377c: STEMDRIVE=C:: Command not found
make_377c: *** [frob.out] Error 127
  [ bad -- Chokes on canned sequence. ]

D:\testmake>make_375c --unix
frobnicating target frob.out
frob-step-1.bat frob.in -o frob.out-step-1
... Frob1-ing frob.in ... done.
frob-step-2.bat frob.out-step-1 -o frob.out
.. Frob2-ing frob.out-step-1 ... done.
  [ OK ]

D:\testmake>make_377g
frobnicating target frob.out
frob-step-1.bat frob.in -o frob.out-step-1
... Frob1-ing frob.in ... done.
frob-step-2.bat frob.out-step-1 -o frob.out
... Frob2-ing frob.out-step-1 ... done.
  [ OK ]

D:\testmake>make_374
frobnicating target frob.out
frob-step-1.bat frob.in -o frob.out-step-1
... Frob1-ing frob.in ... done.
frob-step-2.bat frob.out-step-1 -o frob.out
... Frob2-ing frob.out-step-1 ... done.
  [ OK ]

--
Want to unsubscribe from this list?
Send a message to [email-masked]

--
Want to unsubscribe from this list?
Send a message to [email-masked]