Subject: Re: Problem in new toolchain builds (need comments)
To: Simon J. Gerraty <sjg@crufty.net>
From: James Chacon <jchacon@genuity.net>
List: tech-toolchain
Date: 10/24/2001 10:28:43
>
>>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
I knew this could be made smaller. I wasn't worried about the shell code so
much as getting it working. I knew it could be smaller.
>
>>+MAKE+= _SRC_TOP_=${_SRC_TOP_:Q}
>
>Also I'm not at all keen on appending to MAKE.
>Use .MAKEFLAGS or
Doesn't work. MAKEFLAGS gets passed in, but doesn't get evaluated so it's
pointless. Check the source, only $MAKE gets re-evaluated on a new make.
Line 721 or so of main.c in usr.bin/make
>.MAKEOVERRIDES+= _SRC_TOP_
>will do the trick.
Didn't try that. $MAKE works and reading the source MAKEOVERRIDES doesn't
get evaluated either.
James