Subject: Re: Should make use 'sh -ec "..."' ?
To: David Laight <david@l8s.co.uk>
From: Greg A. Woods <woods@weird.com>
List: tech-toolchain
Date: 11/14/2003 22:46:32
[ On Friday, November 14, 2003 at 23:04:12 (+0000), David Laight wrote: ]
> Subject: Should make use 'sh -ec "..."' ?
>
> NetBSD make seems to run commands using sh -ec "commands".

Yes, and it always should do so (unless '-k' is given :-)

> Actually it is probably enough to replace the above with:
> 
> obj: ${__objdir} ${MAKEOBJDIRPREFIX}
> 
> ${__objdir}:
> 	mkdir -p ${.TARGET}

Yes, I think you might be right, and I find that doing so might shave as
much as ~10% off the CPU time for "make obj", at least for a trivial
test of just running it in the "bin" sub-directory on a system where
source is on NFS....

It might be nice if there were a "special" source (e.g. ".MUST_BE_DIR")
that allowed make to test if the target was a directory or not and if
not then consider it out of date, then maybe something more like the
following would be somewhat safer:

	obj: ${__objdir} ${MAKEOBJDIRPREFIX}

	${MAKEOBJDIRPREFIX}: .MUST_BE_DIR
		@echo "MAKEOBJDIRPREFIX: ${.TARGET} does not exist, bailing..."
		@false

	${__objdir}:	.MUST_BE_DIR
		rm -f ${.TARGET}
		mkdir -p ${.TARGET}

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>