Subject: make with MAKEOBJDIR failures
To: None <>
From: Juergen Hannken-Illjes <>
List: tech-toolchain
Date: 11/16/2001 16:31:32
Trying to build todays sources with MAKEOBJDIR set fails in:

	$ pwd

	$ /usr/obj/tools.i386/bin/nbmake-i386 install
	cd: can't cd to build
	*** Error code 2

	nbmake: stopped in /usr/src/tools/toolchain

The reason is the function `Check_Cwd_av' in usr.bin/make/main.c

The shell command

	@if [ ! -f .install_done ] || [ .build_done -nt .install_done ]; then \
		(cd build && ${MAKE} ${MAKE_ARGS} ${INSTALL_TARGET}); \

is run in .CURDIR instead of .OBJDIR. After taking a look into the
function `Check_Cwd_av' I suppose this should never be needed.

The example in the comment is simply bad style. Instead of

		${MAKE} includes

it should read

		cd ${.CURDIR} && ${MAKE} includes

The much too simple shell parser in `Check_Cwd_av' behaves wrong on
commands that are followed by commands like `if', `then' and so on.
I don't understand why the presence of a `cd' before the `make' causes
this check to stop either.

Would it be better to remove these checks and fix the Makefiles instead?

Juergen Hannken-Illjes - - TU Braunschweig (Germany)