Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2004 09:01:03 -0500
From:      Louis LeBlanc <freebsd@keyslapper.org>
To:        freebsd-questions@freebsd.org
Cc:        Eric F Crist <ecrist@adtechintegrated.com>
Subject:   Re: What is the difference between ; and &&
Message-ID:  <20040108140103.GA45646@keyslapper.org>
In-Reply-To: <20040108134304.GA3863@happy-idiot-talk.infracaninophile.co.uk>
References:  <200401071736.42467.ecrist@adtechintegrated.com> <20040107233858.GM8322@submonkey.net> <20040108134304.GA3863@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On 01/08/04 01:43 PM, Matthew Seaman sat at the `puter and typed:
> On Wed, Jan 07, 2004 at 11:38:58PM +0000, Ceri Davies wrote:
> > On Wed, Jan 07, 2004 at 05:36:42PM -0600, Eric F Crist wrote:
> 
> > > make depend && make && make install
> 
> > [Of course, if the Makefile has it's dependencies correct, then a simple
> >  "make install" will achieve the same thing.]
> 
> Hmmm... Usually 'make depend' generates a dependency Makefile, which
> is .included'ed into the main Makefile on subsequent runs.  That means
> that
> 
>     make depend ; make all
> 
> has a different effect to:
> 
>     make depend all
> 
> Unless make(1) has been taught to keep tabs on it's included Makefiles
> and knows how to re-load them if their modification time changes.  As
> I understood it, that was a trick that gmake(1) could do but that BSD
> make couldn't.
> 
> 	Cheers,
> 
> 	Matthew

I've missed a bit of this thread, so this may be redundant . . .

The primary reason for using 'make depend && make && make install' is
to halt the whole procedure in the event of a failure at any point.
The '&&' separates the commands much the way ';' does, but makes the
execution of each one dependent upon the success of the previous.
This means that 'make' (the second command) will be executed if and
only if 'make depend' succeeds.  Likewise, 'make install' will only be
executed if and only if 'make' is executed and succeeds.

If there is a failure at any point, you won't have nearly so far to
backtrack to find the point of failure.

This is a fantastic method for 'scheduling' multiple build stages
without having to sit at the keyboard.

HTH
Lou
-- 
Louis LeBlanc               leblanc@keyslapper.org
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org                     ԿԬ

Hailing frequencies open, Captain.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040108140103.GA45646>