bsd.own.mk - just let WITHOUT_* take precedence

Justin T. Gibbs gibbs at scsiguy.com
Wed Feb 20 19:51:21 UTC 2013


On Oct 25, 2012, at 1:27 PM, David O'Brien <obrien at FreeBSD.org> wrote:

> On Wed, Oct 24, 2012 at 10:45:08AM -0500, Brooks Davis wrote:
>>> Note that our Handbook () still has:
>>>    <!-- XXXTR: WITH_CTF has been reported to leave a user with a
>>>         broken system when used with buildworld.  Until this is
> ...
>>> We really need to make this as easy as possible for users and get the
>>> docs matching reality.
>> 
>> I believe this is largely wrong and outdated.
> 
> Yes I also feel that way.  But didn't want to take that out until there
> is consensus on this build issue.
> 
> -- 
> -- David  (obrien at FreeBSD.org)


Issues still remain regarding the interaction of WITH_*/WITHOUT_*,
NO_*, and MK_*.  On -stable, which appears to mostly match the state
of -head in this regard, we're running with the following changes
in order to allow WITH_CTF to be specified on the command line of
a build.  Is this the correct approach for solving this issue?

Thanks,
Justin

Change 657233 by justing at justing_ns1_spectrabsd on 2013/02/15 15:58:19

	Ensure debug (-g) symbols are included in CTF'ed binaries
	if requested by the user (e.g. CFLAGS+=-g in make.conf).
	
	share/mk/sys.mk:
		sys.mk is included before the parsing of any user
		specified Makefile.  For this reason, the user's
		specification of CFLAGS, if any, is not visible
		when it is processed.  Even for files like make.conf
		that are included by sys.mk, CFLAGS is set after it
		is consulted in the setup of CTFFLAGS.

		Instead of using a parse time test for the presence
		of "-g" in CFLAGS to control debug symbol inclusion
		during CTF processing, add "${CFLAGS:M-g}"
		unconditionally to CTFFLAGS since this will be
		evaluated on demand as make builds targets.

	share/mk/bsd.lib.mk:
	share/mk/bsd.prog.mk:
		Remove per-build-type manipulation of CTFFLAGS to include
		-g.  sys.mk's definition does this already.

Affected files ...

... //SpectraBSD/stable/share/mk/sys.mk#4 edit

Differences ...

==== //SpectraBSD/stable/share/mk/sys.mk#4 (text) ====

@@ -67,18 +67,11 @@
 .endif
 
 # C Type Format data is required for DTrace
-CTFFLAGS	?=	-L VERSION
+CTFFLAGS	?=	-L VERSION ${CFLAGS:M-g}
 
 CTFCONVERT	?=	ctfconvert
 CTFMERGE	?=	ctfmerge
 DTRACE		?=	dtrace
-.if defined(CFLAGS) && (${CFLAGS:M-g} != "")
-CTFFLAGS	+=	-g
-.else
-# XXX: What to do here? Is removing the CFLAGS part completely ok here?
-# For now comment it out to not compile with -g unconditionally.
-#CFLAGS		+=	-g
-.endif
 
 CXX		?=	c++
 CXXFLAGS	?=	${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition}
==== //SpectraBSD/stable/share/mk/bsd.lib.mk#6 (text) ====

@@ -35,10 +35,6 @@
 
 .if defined(DEBUG_FLAGS)
 CFLAGS+= ${DEBUG_FLAGS}
-
-.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
-CTFFLAGS+= -g
-.endif
 .endif
 
 .if !defined(DEBUG_FLAGS)

==== //SpectraBSD/stable/share/mk/bsd.prog.mk#4 (text) ====

@@ -18,10 +18,6 @@
 .if defined(DEBUG_FLAGS)
 CFLAGS+=${DEBUG_FLAGS}
 CXXFLAGS+=${DEBUG_FLAGS}
-
-.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
-CTFFLAGS+= -g
-.endif
 .endif
 
 .if defined(CRUNCH_CFLAGS)
Change 657888 by justing at justing_ns1_spectrabsd on 2013/02/20 08:32:32

	Allow WITH_CTF to be defined from src.conf, make.conf, or
	via the command line with equal efficacy.
	
	share/mk/bsd.own.mk:
		Make maintains three classes of global variables:
		variables from the environment, variables specified
		on the command line, and variables defined in a
		sourced Makefile.  Only variables in the last
		category can be undefined (via .undef) from within
		a Makefile.
	
		Re-implement NO_* (e.g. NO_CTF) option handling to
		not rely on the ability to undefine a variable.  A
		new variable __OVERRIDABLE_OPTIONS now contains the
		options for which the build system honors NO_{option}
		(typically for boot strapping phases).  Embed directly
		in the logic converting from WITH_*/WITHOUT_* to MK_*
		the test for NO_*.
	
		Remove warnings emitted when a user specified option
		is overridden.  Necessary overrides occur hundreds of
		times during bootstrap phases of the build, making these
		messages just noise that users will quickly learn to
		ignore.

Affected files ...

... //SpectraBSD/stable/share/mk/bsd.own.mk#7 edit

Differences ...

==== //SpectraBSD/stable/share/mk/bsd.own.mk#7 (text) ====

@@ -200,25 +200,16 @@
 
 #
 # Supported NO_* options (if defined, MK_* will be forced to "no",
-# regardless of user's setting).
+# regardless of user's setting).  NO_* options are used to temporarily
+# disable user requested behavior during portions of the build that
+# cannot support certain options (e.g. during bootstrap phases).
 #
-.for var in \
+__OVERRIDABLE_OPTIONS = \
     CTF \
     COVERAGE \
     INSTALLLIB \
     MAN \
     PROFILE
-.if defined(NO_${var})
-.if defined(WITH_${var})
-.warning unsetting WITH_${var}
-.undef WITH_${var}
-.if defined(WITH_${var})
-.error wtf
-.endif
-.endif
-WITHOUT_${var}=
-.endif
-.endfor
 
 #
 # Compat NO_* options (same as above, except their use is deprecated).
@@ -474,11 +465,16 @@
 .if defined(MK_${var})
 .error MK_${var} can't be set by a user.
 .endif
+.if defined(NO_${var}) && !empty(__OVERRIDABLE_OPTIONS:M${var})
+MK_${var}:=	no
+.else
 .if defined(WITHOUT_${var})
 MK_${var}:=	no
 .else
 MK_${var}:=	yes
 .endif
+.endif
+
 .endfor
 .undef __DEFAULT_YES_OPTIONS
 
@@ -492,13 +488,18 @@
 .if defined(MK_${var})
 .error MK_${var} can't be set by a user.
 .endif
+.if defined(NO_${var}) && !empty(__OVERRIDABLE_OPTIONS:M${var})
+MK_${var}:=	no
+.else
 .if defined(WITH_${var})
 MK_${var}:=	yes
 .else
 MK_${var}:=	no
 .endif
+.endif
 .endfor
 .undef __DEFAULT_NO_OPTIONS
+.undef __OVERRIDABLE_OPTIONS
 
 #
 # Force some options off if their dependencies are off.




More information about the freebsd-arch mailing list