Subject: Re: cleandir phase
To: Patrick Welche <>
From: Arto Huusko <>
List: current-users
Date: 02/11/2003 21:53:24
On Tue, 11 Feb 2003, Patrick Welche wrote:

> On Mon, Feb 10, 2003 at 07:46:24PM +0200, Arto Huusko wrote:
> > I've just started to learn using, and I found the following
> > odd behaviour (which may of course be my fault).
> ...
> > After got the make bootstrapped, it started the cleandir phase,
> > and:
> >
> > 1. How come it tries to clean the directories in the source tree (which is
> >    readonly, and doesn't matter anyway, since objdir is somewhere else).
> >    Is this my error?
> > 2. If 1 is fixed, should there be some intelligence that cleandir not be
> >    done if the objdir does not exist?
> Let's say I'm compiling "cat". bin/cat contains (apart from CVS directory)
> Makefile cat.1 cat.c


> If I just make, without an objdir, the objects (cat.cat1 cat.o cat) will just
> be made in bin/cat. Those objects will be removed by a cleandir from bin/cat.


> If you do have an objdir which is a symbolic link to a writeable partition
> (as you had bin/cat on a ro nfs partition), then those objects will appear
> in that objdir, and a clean would clean them.

Um. I'm not sure I follow you on this one. Do you mean that I would have
${BSDSRCDIR}/bin/cat/obj be a symbolic link to an objdir on a writeable

If you mean this, then you are not describing my situation. I call with the "-O objdir" argument. This creates a completely
separate object tree for me. And in that case:

> 1. you aren't deleting files from the read only partition because you do
>    have an objdir

Wrong. I have set "-O objdir", but the cleandir most certainly happened in the
read only source tree. I know this because I accidentally did cvs checkout
without -P, which caused usr.bin/ktrace to have a (empty) subdirectory called
ktrace, so cleandir bombed because it did "rm ktrace" in usr.bin/ktrace.

(Oh, and of course at the cleandir phase the (real) object tree did not even
exist, so...)

> 2. cleandir has to be done if you don't have an objdir, else the objects
>    would be left behind in the source directory.

Certainly, I can understand this.

However, I had an objdir and I was just wondering why cleandir was not done
there, but in the source directory. Of course, it didn't matter because
there was nothing to clean in the source...