Subject: Re: Problem in new toolchain builds (need comments)
To: James Chacon <jchacon@genuity.net>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-toolchain
Date: 10/24/2001 08:52:14
On Wed, 24 Oct 2001, James Chacon wrote:
: Ok, got it. It's about 20 lines of changes plus a new file in the top level.
:
: I moved the USE_NEW_TOOLCHAIN/USETOOLS checks to there in my version but
: I'm not wedded to this structure so much as the idea works. AS Todd also
: pointed out, once you find a valid _SRC_TOP_ you can use it to infer
: BSDSRCDIR as well.
This looks good, except that I'd prefer not to add a new file at the top
level and pull stuff away from <bsd.*.mk>. All the USETOOLS logic was put
in <bsd.own.mk> specifically so it could be turned on (with proper
determination of whether a platform should be using the new toolchain by
default), even for a separately checked out subtree. The definitions of
USE_NEW_TOOLCHAIN and USETOOLS need to stay where they are.
With that said, here's my suggestions for changes:
: -# Temporary; this will become default when all platforms have migrated.
: -.if defined(USE_NEW_TOOLCHAIN) && ${USE_NEW_TOOLCHAIN} == "no"
: -.undef USE_NEW_TOOLCHAIN # unset
: -.else
: -.if ${MACHINE_ARCH} == "i386" || \
: - ${MACHINE_ARCH} == "sparc64"
: -USE_NEW_TOOLCHAIN=yes # set
.endif
Re-add the above block.
: +.if !defined(_SRC_TOP_)
: +# Find Makefile.build
: +_SRC_TOP_!= MF="${.CURDIR}"; \
: + while `/usr/bin/true`; \
: + do \
: + echo $${MF} >&2; \
: + if [ -f "$${MF}/Makefile.build" ]; then \
Change this to look like:
if [ -f "$${MF}/build.sh" ] && [ -d "$${MF}/tools" ]; then \
(yes, this deliberately looks for both a file and a directory as a
failsafe, and in particular, locates the "tools" directory so that the
tools build structure is known to exist)
: + echo "$${MF}/"; \
: + break; \
: + fi; \
: + dir1=`cd $${MF}; pwd`; \
: + dir2=`cd $${MF}/..; pwd`; \
: + if [ "$$dir1" = "$$dir2" ]; then \
: + echo ""; \
: + break; \
: + else \
: + MF="$${MF}/.."; \
: + fi; \
: + done
: +MAKE+= _SRC_TOP_=${_SRC_TOP_:Q}
: .endif
: +
: +.if ${_SRC_TOP_} != ""
: +.include "${_SRC_TOP_}/Makefile.build"
: .endif
In place of the above three lines, use:
.if (${_SRC_TOP_} != "") && defined(USE_NEW_TOOLCHAIN)
USETOOLS?= yes
.endif
USETOOLS?= no
(note that this uses conditionals completely; there's no more :=
assignments, which cleans things up a bit)
: MAKE+= USETOOLS=${USETOOLS:Q}
:
: .if defined(USE_NEW_TOOLCHAIN)
: MAKE+= USE_NEW_TOOLCHAIN=${USE_NEW_TOOLCHAIN:Q}
: .endif
Don't move this to <bsd.own.mk>. Let these be set by normal variable means.
With these changes, this looks acceptable to me.
--
-- Todd Vierling <tv@wasabisystems.com> * Wasabi NetBSD: Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/