tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: make: Check_Cwd_av handle -C or remove?
On Fri, 18 Jan 2013, Simon Gerraty wrote:
I added the Check_Cwd_av logic at least 10 years ago, to avoid
the need to fix lots of makefiles which didn't work with
MAKEOBJDIRPREFIX.
If I understad correctly, that was a workaround for buggy
Makefiles that assumed that they could do
sometarget:
${MAKE} othertarget
when they should really have done
sometarget:
(cd ${.CURDIR} && ${MAKE} othertarget)
I suspect the need for it has passed. Building with separate
obj trees (via MAKEOBJDIRPREFIX etc), seems almost universal
now. Perhaps it is time to retire this check or perhaps disable
it by default?
I think that removing it would be fine. I don't think that it
was ever a good idea. In other words, I think that people who
write incorrect rules in their Makefiles should lose, not be
pampered by having make guess whether or not they meant to insert
cd ${.CURDIR}.
Anyway, the patch below teaches it to spot 'make -C somewhere'
as the equivalent of 'cd somewhere && make'.
... and to avoid the magic "cd ${.CURDIR}" that would have been
added for most cases where ${MAKE} appeared as the first word in a
command in the rules for a target.
I limited the check of make args to some small number, since
I at least tend to make -C one of the 1st args, and it is
rare that an extra 'cd ${.CURDIR}' will do harm. Setting
MAKE_CHECK_CWD_ARGS to 0 would check them all.
I don't like this. The special case code is just to help people
who write incorrect rules, so why optimise it for speed? Either
check all the args, or just remove the special code entirely.
--apb (Alan Barrett)
Home |
Main Index |
Thread Index |
Old Index