help-make
[Top][All Lists]
Advanced

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

Re: multiple wildcards in a static pattern rule


From: Paul D. Smith
Subject: Re: multiple wildcards in a static pattern rule
Date: Thu, 30 Oct 2003 18:28:04 -0500

%% Noel Yap <address@hidden> writes:

  ny>   2. using '&&' halves the number of shells per target created;
  ny>      ';' would do the same thing but would have the consequence of
  ny>      allowing the 'cp' to execute if the umask failed.

Actually, this is not so.

GNU make takes advantage of the "as if" rule and avoids invoking a shell
at all if the command to run is "simple enough", where "simple enough"
means there is no redirection, piping, globbing, or shell metacharacters
of any kind.

So, actually, for simple commands like this:

  >> $(ROOT)etc/dir1/%: $(ROOT)etc/dir1/%: %
  >>        cp $< $@
  >>        chmod 644 $@

it will be faster to do it this way since GNU make will fork/exec the
two commands directly rather than invoking a shell to do it.


FWIW! :)

-- 
-------------------------------------------------------------------------------
 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




reply via email to

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