[Top][All Lists]

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

Re: how to allow multiple empty commands?

From: Paul Smith
Subject: Re: how to allow multiple empty commands?
Date: Thu, 04 Feb 2010 01:39:15 -0500

On Wed, 2010-02-03 at 21:45 -0800, Mark Galeck (CW) wrote:

> I would like to have this:
> foobar:;
> foobar:;
> and make not complain about it (of course this is a SSCCE so please
> don’t ask  “why do you need this”).  

I don't know what "a SSCCE" is, but if you say so, I won't ask why.

> Is there a way to do this?  My attempts are below:


> First, I thought I would do
> .\foobar:;
> .\foobar:;
> since there is an obscure rule mentioned in the manual, that says in
> case of multiple commands for files starting with a “.”, make would
> not complain.  But it still does !  why is the rule not followed??

I'm not aware of any such statement; can you quote it or at give us some
hint where it is?  Maybe you misinterpreted it?

> OK, if this does not work, then maybe I should do:
> foobar::;
> foobar::;

This will work.

> but this seems not so great, because it seems from the manual, that
> make would actually go around and execute all these empty commands
> (you realize that I have thousands of them in the realistic example,
> and thousands of such targets, so the speed matters, I think).  Would
> it?

It will... except that make has special case code and detects if the
command it would invoke is the empty string (or similar "do nothing"
commands) and won't actually invoke a shell to process the empty string.
It will, however, walk all the targets expanding the recipe strings
(empty in this case), etc.  This will take time, especially for large
numbers of double-colon targets, but probably minimal compared to
actually running a compiler, etc.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]