[m-dev.] Clean targets and optimisation files

Warwick Harvey wharvey at cs.monash.edu.au
Fri Aug 6 12:20:40 AEST 1999


Fergus wrote:
> On 05-Aug-1999, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> > Is there any particular reason why `mmake clean' deletes `.trans_opt' files 
> > but not `.opt' files?  (`mmake realclean' is required for the latter.)
> 
> Not that I know of.
> 
> I think it should probably be changed to reflect the documentation
> in the Mercury User's Guide, which says that only `mmake realclean'
> deletes `.opt' and `.trans_opt' files.
> 
> But, I'm not sure that `mmake clean' is really very useful.

But I want it to be useful...  :-)

> > I can understand why `.int', `.d' files, etc. are not removed by `mmake 
> > clean',
> 
> Hmm... maybe you can explain it for me then ;-)
> 
> > but cannot see why `.opt' files aren't.
> 
> I think `.opt' files are not removed for the same reason that
> `.int' files are not removed.  That is, why should `.int' files be
> treated differently to `.opt' files in this respect?

Because `.int' and `.d' files only depend on the "interfaces" of a module, 
and often stay the same when one is modifying the module (and you want them 
to do so), whereas `.opt' files can vary with almost any change to a module?

I think I see your point.  I think one can argue that `.opt' files are like 
`.int' files in some respects (e.g. grade-independent), but like `.c' files 
in others (e.g. dependent on internal implementation details of the module).

I had thought that one or two more levels of "clean" might be useful, but 
upon further reflection it appears not (except as a work-around to a bug, 
but the right solution there is to fix the bug... ;-).  I now think all one 
really needs is:

1 - remove absolutely everything that can be regenerated

2 - remove everything that is grade-dependent

(1) obviously should be handled by "mmake realclean".  (2) is what "mmake 
foo.change_clean" does, except that it also deletes `.d', `.dep' and `.dv' 
files (which is a nuisance if you just want to change grades).

The change_clean targets are intended for when one wants to either change 
grade or add intermodule optimisation.  For the former, you don't want to 
delete the `.d' etc. files, since they are unchanged, and annoying to have 
to rebuild.  For the latter (i.e. you just want to turn on intermodule 
optimisation, nothing else) then a simple "mmake depend" suffices: when one 
runs "mmake" again to rebuild, the optimisation files are generated, and 
anything which depends on them is rebuilt --- which was why one wanted to 
delete them in the first place.

So I guess I'm arguing that a target for when one turns on intermodule 
optimisation is not particularly useful, while having one which deletes just 
the grade-dependent files (and not the dependency files) is.

That said, I think the best name for a grade-dependent clean is "mmake 
gradeclean", so I don't care if the `changeclean' target hangs around as is.

(Yes, I'm happy to implement the gradeclean targets, because I'd use them 
all the time.)

Oh, I also mentioned a bug: with my hacking of private_builtin.m for the 
type_ctor_info stuff I've been noticing that gmake seems to go off into 
never-never land if the `.trans_opt' (and maybe `.opt') file changes and a 
parallel make is being done.  That is, gmake sits there consuming 100% CPU 
when invoked with `-j2', but works fine when invoked without it.  Once the 
opt files are regenerated with a single-threaded mmake, interrupting it and 
running a parallel mmake works fine.  I'll try to investigate this some more 
and figure out what's going on when I get a chance.

Warwick

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list