[m-dev.] Clean targets and optimisation files

Warwick Harvey wharvey at cs.monash.edu.au
Tue Aug 17 16:23:46 AEST 1999


A week or so ago Fergus wrote:
> On 06-Aug-1999, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> > I now think all one really needs is:
> > 
> > 1 - remove absolutely everything that can be regenerated
> > 
> > 2 - remove everything that is grade-dependent
> 
> Well, there are other possibilities.
> See the "Standard targets" section of the "Makefile Conventions"
> section of the GNU Make manual for some more information on this
> topic.  This lists `clean', `mostlyclean', `maintainer-clean',
> and `distclean' targets and explains their semantics.

Yup, thanks for the reminder, it was good to read them again.  I'd been
thinking mainly in the context of a "standard" Mercury program build, but of
course there are more possibilities --- and certainly most of my Mercury
program builds are not "standard".  :-)

(Though I'm trying to fix this --- by redefining what "standard" is...  ;-)

> If you want to change the semantics for `change_clean' so that it doesn't
> delete the dependency files, rename it as `gradeclean', and
> modify the documentation which mentions `change_clean' to instead say
> to use `mmake gradeclean; mmake depend' then I'd be happy with that.
> 
> But it's important to minimize the number of different targets, so that
> users will be able to easily understand what they mean and easily remember
> which target they need to use.  Is there a reason why `gradeclean' needs
> to be different from `clean'?

Not really.  About the only thing I can think of is that it'd be cleaner
(sorry!) if `gradeclean' deleted libraries and executables, whereas you
probably (?) don't want that for `clean'.  But I think I could live with
using `clean' for `gradeclean' even if it didn't delete these files.

So I guess the proposal is:

foo.clean:
	-rm -rf $(foo.dirs)
	-rm -f $(foo.cs) foo_init.c
	-rm -f $(foo.ss) foo_init.s
	-rm -f $(foo.os) foo_init.o
	-rm -f $(foo.pic_os) foo_init.pic_o
	-rm -f $(foo.profs)
	-rm -f $(foo.nos)
	-rm -f $(foo.qls)
	-rm -f $(foo.errs)
	-rm -f $(foo.schemas)

(With corresponding additions to/deletions from the `realclean' target, and
the removal of the `change_clean' target.)

(Note the above fixes a bug in `mmake clean' for split libraries, which I've
just started looking at again: the first line is currently "-rm -rf foo.dir".)

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