comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: How to cache output of the compiler aka ccache
Date: 17 Mar 2005 14:40:48 -0500
Date: 2005-03-17T14:40:48-05:00	[thread overview]
Message-ID: <wcc3buurrgf.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1111085641.211767.56950@f14g2000cwb.googlegroups.com

i-google-iasuhdkajsh@rf.risimo.net writes:

> Hi
> 
> I have a 1mio LOC project and it takes multiple hours to
> build and rebuild. The C/C++ world has a nice tools (ccache
> is well known here) which cache the output of the compiler.
> This especially speeds up the time for a "make clean;make".
> 
> Is there such a thing for Ada in general and gcc's gnat
> specially? Any other way to speed up the compilation?

Well, I had never heard of ccache before, so I just went and read about
it.  I am rather mystified by the *point* of it.  I mean, if I don't
want to recompile stuff that hasn't changed, I just don't type "make
clean".  If for some reason I want to rebuild everything from scratch, I
type "make clean" (or rm -rf build_area or whatever) -- but then ccache
*defeats* that, and does *not* rebuild everything from scratch.
I don't see the point of that.  It seems like a contradiction -- I want
to rebuild everything from scratch while avoiding rebuilding everything!

The only thing I can think of is that if your makefile is buggy
(missing dependences) it won't rebuild some things that depend
on some .h files, and you'll get mysterious bugs.  So rebuilding from
scratch is more reliable.  And ccache actually decides whether to run
the compiler *reliably* (whereas 'make' does not).  Is *that* why
people use ccache?

Don't people automatically generate the make-file dependences for C code
these days?  It seems crazy to try to keep the make file in synch with
the #includes by hand!

Anyway, the buggy make file problem does not happen with Ada.  All Ada
compilers come with a build tool that reliably decides what needs to be
recompiled, and does it.  In AdaMagic, it's called adabuild.  In GNAT
it's called gnatmake.  Also, if you try to link an Ada program where the
parts are inconsistently compiled you will get an error at link time.
You never need to invoke the compiler directly -- just use the build
tool.

If you're writing a make file for an Ada program, you should *not* put
in dependencies for the Ada code!  Instead, use a .PHONY rule to
unconditionally invoke the build tool.  Don't type "make clean"
(except perhaps in your nightly test script, where you don't have
to wait for it), but trust the builder to decide what needs recompiling
and to keep things consistent.

You don't even need to use 'make' with Ada at all, if all you want to do
is rebuild.  But it's convenient to have make-file targets like "rebuild
if necessary and run the regression tests".

- Bob



  reply	other threads:[~2005-03-17 19:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17 18:54 How to cache output of the compiler aka ccache i-google-iasuhdkajsh
2005-03-17 19:40 ` Robert A Duff [this message]
2005-03-17 20:04   ` Ludovic Brenta
2005-03-17 21:27     ` Marius Amado Alves
2005-03-18  1:24       ` Ludovic Brenta
2005-03-18  2:08         ` Robert A Duff
2005-03-17 19:47 ` Ludovic Brenta
2005-03-18 19:22   ` Simon Wright
2005-03-18 20:04     ` Randy Brukardt
2005-03-18 22:10       ` Florian Weimer
2005-03-19  3:25       ` Larry Kilgallen
2005-03-18  6:58 ` i-google-iasuhdkajsh
2005-03-18 13:33   ` Robert A Duff
2005-03-18 14:01     ` Vinzent 'Gadget' Hoefler
2005-03-18 14:41       ` Florian Weimer
2005-03-18 15:08         ` Vinzent 'Gadget' Hoefler
2005-03-18 16:24           ` Florian Weimer
2005-03-21  8:16             ` Vinzent 'Gadget' Hoefler
2005-03-21  8:54               ` Florian Weimer
2005-03-21 11:26                 ` Vinzent 'Gadget' Hoefler
2005-03-18  8:07 ` Martin Krischik
2005-03-18 18:50 ` i-google-iasuhdkajsh
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox