Subject: Re: CVS commit: basesrc
To: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 12/04/1999 12:29:02
[[ moved to tech-userlevel, bcc'd to source-changes ]]

Bill Sommerfeld wrote:

> > Log Message:
> > Move the "${MAKE} obj" above the share/tmac stage so that the generated
> > files in that directory don't pollute the source tree before the obj
> > dirs are created.
> 
> I have two problems with this change.
> 
> 1) if MKOBJDIRS is "yes", and "MKSHARE" is no, object directories
> don't get built.

Gack - that's an oversight and can be fixed pretty easily.

>  2) The whole point of doing the "make obj" after the "make cleandir"
> was so that going from a non-obj build to an obj build in the same
> tree would clean up any "pollution" in the source tree before building
> all the obj dirs..  This change, if anything makes this transition
> worse.
> 
> My proposal: do things in the following order:
> 
> 	make cleandir
> 	make obj
> 	make share/tmac

In my case, I had a new source tree that I wanted to point to an
existing obj tree which is almost the opposite of what you were
trying to achieve.  I can see at least a couple of possiblities
here:

 * User hasn't been using obj dirs and wants too (your case)
	make cleandir
	make obj
	make share/tmac
 * User wants to add any missing obj dirs
	order doesn't matter
 * User wants to use new source tree with old obj dirs (my case)
	make obj
	make cleandir
	make share/tmac

So what about:

	.if MKSHARE
		make share/mk
	.endif
	.if !UPDATE
		make cleandir
	.endif
	.if MKOBJDIRS
		make obj
	.if !UPDATE
		make cleandir
	.endif
	.endif
	.if MKSHARE
		make share/tmac
	.endif

Does that catch everything?  It's an extra "make cleandir" but I'm
guessing that you wouldn't set MKOBJDIRS in /etc/mk.conf all the
time ... which leads to...

What would be nice is an update-objdir target that only builds a new obj
dir if one doesn't exist instead of blindly recreating the obj dir.  If
this were a standard part of "make build" just after "make share/mk" if
USEOBJDIRS or somesuch was set in /etc/mk.conf this would probably make
many peoples lives that just little bit easier...

Simon.