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/24/2001 10:35:18
>
>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.
Actually USETOOLS and the checks for it, etc are still in bsd.own.mk.
What I pulled out were just the top level checks for when to turn it on.
Keeping these in bsd.*.mk is actually the problem...Those are never needed
except when building the source tree so the installed *.mk ones don't really
need all the checks in there, just the source tree based ones.
In any case it could be changed to a file test only, but I still prefer a known
unique file at the top level rather then depending on current layout
(build.sh and tools subdir).
>
>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)
The problem I had here was this wasn't overly clean. It's depending on a
certain amount of structure at the top level but either way probably works.
>: + 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)
Yep
>
>: 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.
These need to be added to $MAKE or they don't propogate to sub-makes. No other
way around it.
James