Subject: Re: Problem in new toolchain builds (need comments)
To: Todd Vierling <tv@wasabisystems.com>
From: James Chacon <jchacon@genuity.net>
List: tech-toolchain
Date: 10/23/2001 22:05:20
>
>On Tue, 23 Oct 2001, James Chacon wrote:
>
>: I'm not trying to just argue here, but read back on my thoughts here on
>: maintaince. This will bite people unless this gets ingrained that they
>: have to get out the "Makefile.inc wand" and sprinkle it across any new
>: imports.
>
>This will be documented.  I've been writing a pretty involved paper
>describing all of these types of intricacies.  But anyway, I'll pull away
>from this issue for a moment to address the following:

Documnted or not, the build process cannot become so intricate almost no
one can fix issues without having to track down the 1-2 people who might
be able to wrap their head around it. It's quickly getting there. No matter
how much you document, making it overly layered still is asking for problems.

>
>: Add a new Makefile at the top-level called Makefile.build. Put the bsd.own.mk
>: rules in which check/set USE_NEW_TOOLCHAIN and then turn on USETOOLS.
>: i.e. the top 20 lines or so before it starts setting toolchain vars.
>:
>: Then to access it all bsd.own.mk needs is something that can recurse back
>: till it finds a Makefile.build and pulls it in, or reaches /. A != rule can
>: accomplish this easily enough (I roughed it out in sh already and other than
>: some tuning works fine.
>
>Well, this is possible, provided that the shell rule is executed exactly
>*once* by propagating the value to sub-makes.  There's a way to do this;
>something like the following should work (untested):

Agreed. I didn't want it recursing everytime. I also want it to work whenever
you start a make no matter where in the tree you're at. Both of these are
solved by this.

>
>.ifndef SRCTOP
>SRCTOP!=	[shellcode here]
>MAKEFLAGS+=	SRCTOP=${SRCTOP:Q}
>.endif
>
>As an aside, you'd automagically also get the location of the top of the
>source tree, if you add a `pwd` resolver into the end of the script.  It
>could even be used to set BSDSRCDIR implicitly, come to think of it....
>
>Feel free to try implementing this and let me know what you come up with.  A
>check that looks for a file named "build.sh" and a directory named "tools"
>in the same dir should give you a usable result.

Already there (the shell code is done. I need to run a make build/tests to
make sure I didn't muck anything up).

James