aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-12-13 00:49:52 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-12-13 00:49:52 +0000
commit26e8ef3fe840597fbd4670d9e2ba4b58496fa9e3 (patch)
tree9e7f5f84901c9a37ed709bbed71e57a3ff1f86fc /Makefile
parent0e7470486de1e87a95014ead7d412a81296f5914 (diff)
downloadsrc-26e8ef3fe840597fbd4670d9e2ba4b58496fa9e3.tar.gz
src-26e8ef3fe840597fbd4670d9e2ba4b58496fa9e3.zip
Unbreak the MAKEOBJDIRPREFIX variable check by avoiding bugs in make(1).
When make flags are passed to make in the environment, the string is chopped up in an (argc,argv) vector. This happens in brk_string() and the chopped up string is stored in static buffer. When this includes something like "-V BINMAKE", then a pointer into the static buffer is put on the variables list for evaluation later. However, brk_string() is used for more than just chopping up the MAKEFLAGS env. variable, so it's very likely that the static buffer is clobbered. In fact, this is exactly what happens. The result is that _MAKEOBJDIRPREFIX gets assigned whatever garbage the child make happens to emit, causing the test to fail. Like this: pluto2% cd /usr/src pluto2% make -V BINMAKE "/q/6.x/src/Makefile", line 94: MAKEOBJDIRPREFIX can only be set in environment, not as a global (in /etc/make.conf) or command-line variable. pluto2% make -dv -V BINMAKE | & grep _MAKEOBJDIRPREFIX Global:_MAKEOBJDIRPREFIX = } The fix is to not use MAKEFLAGS for this, but simple pass the flags as arguments. Ideally make(1) should be fixed but that's beyond the scope of my attention span. This fixes release.
Notes
Notes: svn path=/head/; revision=138768
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 1 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 229149142ac2..3f0d754cc498 100644
--- a/Makefile
+++ b/Makefile
@@ -86,8 +86,7 @@ TGTS+= ${BITGTS}
PATH= /sbin:/bin:/usr/sbin:/usr/bin
MAKEOBJDIRPREFIX?= /usr/obj
-_MAKEOBJDIRPREFIX!= /usr/bin/env -i \
- PATH=${PATH} MAKEFLAGS="${.MAKEFLAGS}" ${MAKE} \
+_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} ${.MAKEFLAGS} \
-f /dev/null -V MAKEOBJDIRPREFIX dummy
.if !empty(_MAKEOBJDIRPREFIX)
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\