Module Name:    src
Committed By:   apb
Date:           Fri Sep  9 13:29:23 UTC 2011

Modified Files:
        src: BUILDING build.sh
        src/doc: BUILDING.mdoc

Log Message:
Allow MAKEFLAGS to be set via build.sh -V.  Somebody asked for this
in 2008.

Also add comments above a few functions in build.sh, and bump copyright
dates.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/BUILDING
cvs rdiff -u -r1.247 -r1.248 src/build.sh
cvs rdiff -u -r1.81 -r1.82 src/doc/BUILDING.mdoc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/BUILDING
diff -u src/BUILDING:1.93 src/BUILDING:1.94
--- src/BUILDING:1.93	Sat Aug  6 19:52:49 2011
+++ src/BUILDING	Fri Sep  9 13:29:23 2011
@@ -104,7 +104,9 @@
 
      MAKE              Path name to invoke make(1) as.
 
-     MAKEFLAGS         Flags to invoke make(1) with.
+     MAKEFLAGS         Flags to invoke make(1) with.  Note that build.sh
+                       ignores the value of MAKEFLAGS passed in the environ-
+                       ment, but allows MAKEFLAGS to be set via the -V option.
 
      MAKEOBJDIR        Directory to use as the .OBJDIR for the current direc-
                        tory.  The value is subjected to variable expansion by
@@ -234,11 +236,6 @@
 
                  Default: ``yes''
 
-     MKKMOD      Can be set to ``yes'' or ``no''.  Indicates whether kernel
-                 modules are built and installed.
-
-                 Default: ``yes''
-
      MKLINT      Can be set to ``yes'' or ``no''.  Indicates whether lint(1)
                  will be run against portions of the NetBSD source code during
                  the build, and whether lint libraries will be installed into
@@ -534,10 +531,9 @@
                    ing.
 
                    The INSTALLSETS environment variable may be set to a list
-                   of distribution sets to be installed, separated by spaces.
-                   By default, all sets except ``etc'' and ``xetc'' are
-                   extracted, so most files in INSTALLWORLDDIR/etc will not
-                   be installed or modified.
+                   of distribution sets to be installed.  By default, all sets
+                   except ``etc'' and ``xetc'' are installed, so most files in
+                   INSTALLWORLDDIR/etc will not be installed or modified.
 
                    Note: Before performing this operation with
                    INSTALLWORLDDIR=/, it is highly recommended that you
@@ -671,8 +667,7 @@
 
      install=idir  Install the contents of DESTDIR to idir, using ``make
                    installworld''.  Note that files that are part of the
-                   ``etc'' or ``xetc'' sets will not be installed, unless
-                   overridden by the INSTALLSETS environment variable.
+                   ``etc'' or ``xetc'' sets will not be installed.
 
      kernel=kconf  Build a new kernel.  The kconf argument is the name of a
                    configuration file suitable for use by config(1).  If kconf
@@ -927,4 +922,4 @@
      The build.sh based build scheme was introduced for NetBSD 1.6 as
      USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
 
-NetBSD                            May 1, 2009                           NetBSD
+NetBSD                         September 9, 2011                        NetBSD

Index: src/build.sh
diff -u src/build.sh:1.247 src/build.sh:1.248
--- src/build.sh:1.247	Tue Aug 30 12:04:12 2011
+++ src/build.sh	Fri Sep  9 13:29:23 2011
@@ -1,7 +1,7 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.247 2011/08/30 12:04:12 apb Exp $
+#	$NetBSD: build.sh,v 1.248 2011/09/09 13:29:23 apb Exp $
 #
-# Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
+# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
 #
 # This code is derived from software contributed to The NetBSD Foundation
@@ -171,6 +171,9 @@
 	    bomb "HOST_SH=\"${HOST_SH}\" is not executable."
 }
 
+# initdefaults --
+# Set defaults before parsing command line options.
+#
 initdefaults()
 {
 	makeenv=
@@ -186,7 +189,19 @@
 	[ -f share/mk/bsd.own.mk ] ||
 	    bomb "src/share/mk is missing; please re-fetch the source tree"
 
-	# Set LC_ALL=C before we try to parse the output from any command
+	# Set various environment variables to known defaults,
+	# to minimize (cross-)build problems observed "in the field".
+	#
+	# LC_ALL=C must be set before we try to parse the output from
+	# any command.  Other variables are set (or unset) here, before
+	# we parse command line arguments.
+	#
+	# These variables can be overridden via "-V var=value" if
+	# you know what you are doing.
+	#
+	unsetmakeenv INFODIR
+	unsetmakeenv LESSCHARSET
+	unsetmakeenv MAKEFLAGS
 	setmakeenv LC_ALL C
 
 	# Find information about the build platform.  This should be
@@ -237,10 +252,7 @@
 	#
 	case "${uname_s}" in
 	Darwin | FreeBSD | CYGWIN*)
-		MAKEFLAGS=-X
-		;;
-	*)
-		MAKEFLAGS=
+		MAKEFLAGS="-X ${MAKEFLAGS}"
 		;;
 	esac
 
@@ -304,11 +316,6 @@
 	#
 	setmakeenv MKARZERO "yes"
 
-	# Set various environment variables to known defaults,
-	# to minimize (cross-)build problems observed "in the field".
-	#
-	unsetmakeenv INFODIR
-	unsetmakeenv LESSCHARSET
 }
 
 getarch()
@@ -947,10 +954,14 @@
 	#
 	makeenv="${makeenv} TOOLDIR MACHINE MACHINE_ARCH MAKEFLAGS"
 	[ -z "${BUILDID}" ] || makeenv="${makeenv} BUILDID"
-	MAKEFLAGS="-de -m ${TOP}/share/mk ${MAKEFLAGS} MKOBJDIRS=${MKOBJDIRS-yes}"
+	MAKEFLAGS="-de -m ${TOP}/share/mk ${MAKEFLAGS}"
+	MAKEFLAGS="${MAKEFLAGS} MKOBJDIRS=${MKOBJDIRS-yes}"
 	export MAKEFLAGS MACHINE MACHINE_ARCH
 }
 
+# sanitycheck --
+# Sanity check after parsing command line options, before rebuildmake.
+#
 sanitycheck()
 {
 	# If the PATH contains any non-absolute components (including,
@@ -1144,6 +1155,12 @@
 	fi
 }
 
+# validatemakeparams --
+# Perform some late sanity checks, after rebuildmake,
+# but before createmakewrapper or any real work.
+#
+# Also create the top-level obj directory.
+#
 validatemakeparams()
 {
 	if [ "${runcmd}" = "echo" ]; then
@@ -1387,7 +1404,7 @@
 	eval cat <<EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.247 2011/08/30 12:04:12 apb Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.248 2011/09/09 13:29:23 apb Exp $
 # with these arguments: ${_args}
 #
 

Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.81 src/doc/BUILDING.mdoc:1.82
--- src/doc/BUILDING.mdoc:1.81	Sun Jul 25 07:19:00 2010
+++ src/doc/BUILDING.mdoc	Fri Sep  9 13:29:23 2011
@@ -1,6 +1,6 @@
-.\"	$NetBSD: BUILDING.mdoc,v 1.81 2010/07/25 07:19:00 mrg Exp $
+.\"	$NetBSD: BUILDING.mdoc,v 1.82 2011/09/09 13:29:23 apb Exp $
 .\"
-.\" Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -33,7 +33,7 @@
 .\" Toolchain prefix for commands
 .ds toolprefix nb
 .
-.Dd May 1, 2009
+.Dd September 9, 2011
 .Dt BUILDING 8
 .Os NetBSD
 .
@@ -213,6 +213,15 @@
 Flags to invoke
 .Xr make 1
 with.
+Note that
+.Sy build.sh
+ignores the value of
+.Sy MAKEFLAGS
+passed in the environment, but allows
+.Sy MAKEFLAGS
+to be set via the
+.Fl V
+option.
 .
 .It Sy MAKEOBJDIR
 Directory to use as the

Reply via email to