bug-make
[Top][All Lists]
Advanced

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

Bug#119663: make: shell function calls within rule commands are expanded


From: Manoj Srivastava
Subject: Bug#119663: make: shell function calls within rule commands are expanded too early
Date: Wed, 14 Nov 2001 21:44:13 -0600
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i386-debian-linux-gnu)

Hi,

        [ Please retain the CC: to address@hidden,
        so that the Debian bug tracking system has a record of your
        input. Thanks ]

The info documentation for the 'shell' function includes the following
paragraph:

     The commands run by calls to the `shell' function are run when the
  function calls are expanded.  In most cases, this is when the makefile
  is read in.  The exception is that function calls in the commands of
  the rules are expanded when the commands are run, and this applies to
  `shell' function calls like all others.

However, this exception does not appear to be true in at least the
current version of make. Consider the following makefile:
======================================================================
all:
        touch foo.bar
        /bin/ls -1 *.bar
        echo "fails=>$(shell ls -1 *.bar)"
        rm -f foo.bar
testing:
        @echo just testing
======================================================================
__> make -f Makefile 
/bin/ls: *.bar: No such file or directory
touch foo.bar
ls -1 *.bar
foo.bar
echo "fails=>"
fails=>
rm -f foo.bar
======================================================================

        Please note that the /bin/ls -1 inside the function is run
 before the touch command is run; and thus must run before the command
 set is actually run. However, I note that invoking the testing target
 does not cause the shell function to be executed.
======================================================================
__> make -f Makefile testing
just testing
======================================================================

        I think the documentation needs to be clarified to explain
 this behaviour (perhaps the shell functions are executed at the
 beginning of the command group, or as they are read in, not, as
 implied, strictly as they are executed).  Or perhaps I have no clue
 as to what is happening ;-).  I do think the behaviour appears to be
 misleading, given this experiment.


        manoj
-- 
 "Ho!  Ha-ha!  Guard!  Turn!  Parry!  Dodge!  Spin!  Ha!  Thrust!"
 --D. Duck
Manoj Srivastava   <address@hidden>  <http://www.debian.org/%7Esrivasta/>
1024R/C7261095 print CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



reply via email to

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