From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,206547e68a60b0e7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: How to cache output of the compiler aka ccache Date: 17 Mar 2005 14:40:48 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1111085641.211767.56950@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: shell01-e.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1111088448 6009 69.38.147.31 (17 Mar 2005 19:40:48 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 17 Mar 2005 19:40:48 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:9557 Date: 2005-03-17T14:40:48-05:00 List-Id: 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