help-make
[Top][All Lists]
Advanced

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

shortcut of ":" but not /bin/true


From: David Boyce
Subject: shortcut of ":" but not /bin/true
Date: Mon, 17 May 2004 15:58:38 -0400

Just wondering why GNU make (apparently) has logic built in to skip creating a new process for the ":" shell builtin but not for the "true" and "false" commands. Running truss on Solaris shows that with the following Makefile:

% cat Makefile
.PHONY: all

all:
        true
        :
        true

GNU make 3.80 execs the following processes:

12220:  execve("/opt/sfw/bin/gmake", 0xFFBFF32C, 0xFFBFF334)  argc = 1
12222:  execve("/usr/bin/true", 0x0004C980, 0x00052E70)  argc = 2
12224:  execve("/usr/bin/true", 0x0004C980, 0x00052E70)  argc = 2

Is this just an accident of history or is there a reason why it's ok to shortcut ":" but not "true"?

This comes up because it's not uncommon for Makefiles to use macro-ized commands such as

        RANLIB := true

I recently observed a build system which ran "true" twice for every source file it compiled. Of course the workaround is obvious but in many cases Makefiles are generated by configure. For instance I just checked the Solaris build of Perl 5.8.3 under gmake with truss - it runs /usr/bin/true 561 times!

Looks like the code to deal with ":" is around job.c:1016, BTW.

Thanks,
David Boyce





reply via email to

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