summaryrefslogtreecommitdiffstats
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-12-22 22:00:01 +0000
committerru <ru@FreeBSD.org>2004-12-22 22:00:01 +0000
commit3a1bb12c828f9bb4b003f8f8fb2a55d3d78b575d (patch)
tree597b940c5fc02428e9576acb112388cd534812b3 /Makefile.inc1
parent04b2362b0f7f3cad647d6adfac62447e69310d98 (diff)
downloadFreeBSD-src-3a1bb12c828f9bb4b003f8f8fb2a55d3d78b575d.zip
FreeBSD-src-3a1bb12c828f9bb4b003f8f8fb2a55d3d78b575d.tar.gz
Further fix the case mentioned in rev. 1.302. The
intent was (and still is) that if a user has say CPUTYPE=i686 set in /etc/make.conf, we don't print the assignment type warning unless TARGET_CPUTYPE is overridden. Unfortunately, the implementation was buggy, and only recent changes to bsd.cpu.mk that swapped canonical and alias values of some CPU types made the bug apparent. Here's what happens here. - CPUTYPE=i686 is set in /etc/make.conf, - bsd.cpu.mk reset it to "pentiumpro", - Makefile.inc1 compares this canonical value with the result of the following test, make -f /dev/null CPUTYPE=pentiumpro -V CPUTYPE and expects the result to be "pentiumpro" too, but "i686" is returned, here's why. We have two CPUTYPE variables, global, set to "i686" in /etc/make.conf, and command-line (of a higher precedence), set to "pentiumpro". The following part of bsd.cpu.mk, . elif ${CPUTYPE} == "i686" CPUTYPE = pentiumpro which is responsible for converting aliases to canonical values, sees the value of the CPUTYPE command-line variable first, "pentiumpro", and no conversion is done -- the net effect is that CPUTYPE global stays with its old value "i686", and "make -V CPUTYPE" (which prints variables in the global context) returns "i686". The fix was to pass the CPUTYPE in the test above as an environment variable instead of as a command line variable, i.e., CPUTYPE=pentiumpro make -f /dev/null -V CPUTYPE This time, CPUTYPE global is still set to "i686" initially (by /etc/make.conf), and an envieronment variable CPUTYPE (of a lower precedence) is set to "pentiumpro". The .elif sees it's set to "i686" and resets it to "pentiumpro", and so "make -V" returns "pentiumpro". NB: these various types of make(1) variables can be very painful, especially when combined with "make -V".
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc14
1 files changed, 2 insertions, 2 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 03180cb..679d963 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -112,8 +112,8 @@ _TARGET_CPUTYPE=${TARGET_CPUTYPE}
.else
_TARGET_CPUTYPE=dummy
.endif
-_CPUTYPE!= MAKEFLAGS= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
- CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
+_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
+ -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
.error CPUTYPE global should be set with ?=.
.endif
OpenPOWER on IntegriCloud