[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shortcut of ":" but not /bin/true
From: |
Paul D. Smith |
Subject: |
Re: shortcut of ":" but not /bin/true |
Date: |
Mon, 17 May 2004 17:20:27 -0400 |
%% David Boyce <address@hidden> writes:
db> Just wondering why GNU make (apparently) has logic built in to
db> skip creating a new process for the ":" shell builtin but not for
db> the "true" and "false" commands. Running truss on Solaris shows
db> that with the following Makefile:
db> % cat Makefile
db> .PHONY: all
db> all:
db> true
db> :
db> true
db> Is this just an accident of history or is there a reason why it's
db> ok to shortcut ":" but not "true"?
I wasn't around when the decision was made, but I think there is a
reason.
The thinking is (I suspect) that ":" is a shell builtin, and there's
nothing else it could possibly be. That is, if you're running a Bourne
shell (and GNU make does check for this--if you're not, it never chooses
the "fast path" in the first place) and you see ":" alone as the command
to run, you always know what it is.
With "true" and "false" that's not the case: typically (and certainly in
POSIX sh) these are not shell builtins, so it's possible that there are
some other programs named "true" or "false" that will be found on your
PATH before any standard system versions, that will behave differently
than traditional true and false.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
- shortcut of ":" but not /bin/true, David Boyce, 2004/05/17
- Re: shortcut of ":" but not /bin/true,
Paul D. Smith <=
- Re: shortcut of ":" but not /bin/true, David Boyce, 2004/05/17
- Re: shortcut of ":" but not /bin/true, David Boyce, 2004/05/17
- Re: shortcut of ":" but not /bin/true, Noel Yap, 2004/05/18
- Re: shortcut of ":" but not /bin/true, Paul D. Smith, 2004/05/18
- Re: shortcut of ":" but not /bin/true, Noel Yap, 2004/05/18
- Re: shortcut of ":" but not /bin/true, David Boyce, 2004/05/18
- Re: shortcut of ":" but not /bin/true, Paul D. Smith, 2004/05/18
- Re: shortcut of ":" but not /bin/true, David Boyce, 2004/05/18
- Re: shortcut of ":" but not /bin/true, Paul D. Smith, 2004/05/18