Subject: Re: Problem in new toolchain builds (need comments)
To: James Chacon <jchacon@genuity.net>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 10/24/2001 01:08:28
>Thoughts? Comments?
>+.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 \
>+ echo "$${MF}/"; \
>+ break; \
>+ fi; \
>+ dir1=`cd $${MF}; pwd`; \
>+ dir2=`cd $${MF}/..; pwd`; \
>+ if [ "$$dir1" = "$$dir2" ]; then \
>+ echo ""; \
>+ break; \
>+ else \
>+ MF="$${MF}/.."; \
>+ fi; \
>+ done
This is more complex than necessary. "while :" is all you need
for an infinite loop btw. Anyway, either simply use `dirname` on
your current guess or my preference:
_SRC_TOP_!= cd ${.CURDIR}; while :; do \
here=`pwd`; \
[ -f Makefile.build ] && { echo $$here; break; }; \
case $$here in /) break;; esac; \
cd ..; \
done
>+MAKE+= _SRC_TOP_=${_SRC_TOP_:Q}
Also I'm not at all keen on appending to MAKE.
Use .MAKEFLAGS or
.MAKEOVERRIDES+= _SRC_TOP_
will do the trick.
Thanks
--sjg