From e091d985174576d55708e53a49da909fe0c0d8b5 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 30 Mar 2014 22:24:45 +0000 Subject: [PATCH] Allow the build system to safely set MK_FOO to avoid the ambiguity when both WITH_FOO and WITHOUT_FOO are set. Use this where possible. Only disallow setting of MK_FOO on the command line. This was preferable to inventing a new mechanism or fixing the undef bug (bin/183762) which precludes users from turning off anything we turn off for parts of the build with WITHOUT_FOO prior to this. --- Makefile.inc1 | 18 +++++++++--------- share/mk/bsd.own.mk | 14 ++++++++++---- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 78187912ff1c..ee2c321c0f9a 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -247,7 +247,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ - -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ + MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \ -DNO_PIC -DNO_PROFILE -DNO_SHARED \ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS @@ -264,7 +264,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - -DWITHOUT_GDB -DNO_TESTS + MK_GDB=no -DNO_TESTS # kernel-tools stage KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ @@ -277,7 +277,7 @@ KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ - -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ + MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \ -DNO_PIC -DNO_PROFILE -DNO_SHARED \ -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD @@ -423,7 +423,7 @@ LIB32WMAKEFLAGS+= \ -DNO_TESTS LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ - -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML + MK_MAN=no MK_INFO=no MK_HTML=no LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \ ${IMAKE_INSTALL} .endif @@ -574,8 +574,8 @@ _libraries: @echo ">>> stage 4.2: building libraries" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; \ - ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ - -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries + ${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \ + -DNO_PROFILE -DNO_TESTS libraries _depend: @echo @echo "--------------------------------------------------------------" @@ -1881,9 +1881,9 @@ XDEV_CPUTYPE?=${CPUTYPE} XDEV_CPUTYPE?=${TARGET_CPUTYPE} .endif -NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ - -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ - -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_TESTS -DNO_WARNS \ +NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \ + MK_MAN=no MK_NLS=no -DNO_PROFILE \ + MK_KERBEROS=no MK_RESCUE=no -DNO_TESTS -DNO_WARNS \ TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 0b5ad340672f..e9279184c54c 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -229,10 +229,7 @@ COMPRESS_EXT?= .gz MAN \ PROFILE .if defined(NO_${var}) -.if defined(WITH_${var}) -.undef WITH_${var} -.endif -WITHOUT_${var}= +MK_${var}:=no .endif .endfor @@ -446,13 +443,16 @@ __DEFAULT_NO_OPTIONS+=FDT .error WITH_${var} and WITHOUT_${var} can't both be set. .endif .if defined(MK_${var}) +.if ${.MAKE.LEVEL} == 0 .error MK_${var} can't be set by a user. .endif +.else .if defined(WITHOUT_${var}) MK_${var}:= no .else MK_${var}:= yes .endif +.endif .endfor .undef __DEFAULT_YES_OPTIONS @@ -464,13 +464,16 @@ MK_${var}:= yes .error WITH_${var} and WITHOUT_${var} can't both be set. .endif .if defined(MK_${var}) +.if ${.MAKE.LEVEL} == 0 .error MK_${var} can't be set by a user. .endif +.else .if defined(WITH_${var}) MK_${var}:= yes .else MK_${var}:= no .endif +.endif .endfor .undef __DEFAULT_NO_OPTIONS @@ -620,8 +623,10 @@ MK_${vv:H}:= ${MK_${vv:T}} .error WITH_${var} and WITHOUT_${var} can't both be set. .endif .if defined(MK_${var}) +.if ${.MAKE.LEVEL} == 0 .error MK_${var} can't be set by a user. .endif +.else .if ${COMPILER_FEATURES:Mc++11} .if defined(WITHOUT_${var}) MK_${var}:= no @@ -635,6 +640,7 @@ MK_${var}:= yes MK_${var}:= no .endif .endif +.endif .endfor .if !${COMPILER_FEATURES:Mc++11}