Subject: Re: Problem in new toolchain builds (need comments)
To: None <>
From: Simon J. Gerraty <>
List: tech-toolchain
Date: 10/25/2001 00:54:03
> 1. Where is all this distinction documented? I can't fathom any of this from
> the man page. (nor the source especially from a cursory glance)

Its in the source.  The man page attempts to explain some of this but
since the man page is written by folk who typically wrote the source
they often assume too much is already understood.  I'm as guilty as

Much of the distinction between *MAKEFLAGS MFLAGS and MAKE is historic
and is only mentioned briefly at a couple of points within the source
and not at all in the man page.  Familiarity with other makes is
perhaps part of the assumptions mentioned above.

> 2. It doesn't work as one would expect. If you add the vars to any of either
> MAKEFLAGS, .MAKEFLAGS, .MAKEOVERRIDES, etc they all get passed to the followon
> makes. But they don't seem to get parsed apart again into var=value in the
> sub-makes.

I can only suggest you are doing something wrong:

$ cat ~/make-tests/find-top

.ifndef TOP
TOP!=	set -x; cd ${.CURDIR}; while :; do \
	    here=`pwd`; \
	    [ -f ${TOP_TAG} ] && { echo $$here; break; }; \
	    case $$here in /) break;; esac; \
	    cd ..; \

	@echo TOP=${TOP}

	${MAKE} -f ${MAKEFILE} all

$ mkdir -p /tmp/src/bin/cat
$ touch /tmp/src/.sandbox-env
$ cd /tmp/src/bin/cat
$ make -f ~/make-tests/find-top sub
+ cd /tmp/src/bin/cat
+ :
+ pwd
+ here=/tmp/src/bin/cat
+ [ -f .sandbox-env ]
+ cd ..
+ :
+ pwd
+ here=/tmp/src/bin
+ [ -f .sandbox-env ]
+ cd ..
+ :
+ pwd
+ here=/tmp/src
+ [ -f .sandbox-env ]
+ echo /tmp/src
+ break
make -f /users/sjg/make-tests/find-top all

it works the same with the two alternatives you see commented out too.
BTW I'm assuming your make(1) is reasonably up to date as .MAKEOVERRIDES
and POSIX compatible export of command line vars was only implemented
within the last 6 months. 

If I remove the .ifndef, then yes the shell code gets executed for
each sub-make, but that's why the .ifndef is there.

> If you set the 
> MAKE+=
> line to

If you use something other than just the name of the variable to
export (eg TOP=${TOP} cf. TOP) then yes things will not work.


Should work - does in my tests.  

Hope that helps