Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Allow MAKEFLAGS to be set via build.sh -V. Somebody asked f...



details:   https://anonhg.NetBSD.org/src/rev/84ec98e920f2
branches:  trunk
changeset: 769422:84ec98e920f2
user:      apb <apb%NetBSD.org@localhost>
date:      Fri Sep 09 13:29:23 2011 +0000

description:
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.

diffstat:

 BUILDING          |  21 ++++++++-------------
 build.sh          |  45 +++++++++++++++++++++++++++++++--------------
 doc/BUILDING.mdoc |  15 ++++++++++++---
 3 files changed, 51 insertions(+), 30 deletions(-)

diffs (199 lines):

diff -r 0350aa8cb74e -r 84ec98e920f2 BUILDING
--- a/BUILDING  Fri Sep 09 12:44:27 2011 +0000
+++ b/BUILDING  Fri Sep 09 13:29:23 2011 +0000
@@ -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
diff -r 0350aa8cb74e -r 84ec98e920f2 build.sh
--- a/build.sh  Fri Sep 09 12:44:27 2011 +0000
+++ b/build.sh  Fri Sep 09 13:29:23 2011 +0000
@@ -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}
 #
 
diff -r 0350aa8cb74e -r 84ec98e920f2 doc/BUILDING.mdoc
--- a/doc/BUILDING.mdoc Fri Sep 09 12:44:27 2011 +0000
+++ b/doc/BUILDING.mdoc Fri Sep 09 13:29:23 2011 +0000
@@ -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



Home | Main Index | Thread Index | Old Index