Source-Changes-HG archive

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

[src/trunk]: src/share/mk Revert part of previous; don't set _SRC_TOP_ to BSD...



details:   https://anonhg.NetBSD.org/src/rev/0eb782ac424c
branches:  trunk
changeset: 526154:0eb782ac424c
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Apr 26 14:27:23 2002 +0000

description:
Revert part of previous; don't set _SRC_TOP_ to BSDSRCDIR if it can't be
determined, since BSDSRCDIR's default of /usr/src might not exist and the
calculation of _SRC_TOP_OBJ_ would then generate a warning :-(.
_SRC_TOP_ can now == "" if make(1) (or a parent make(1)) was started
outside of the NetBSD source tree.

Now, if _SRC_TOP_ != "",  BSDSRCDIR defaults to ${_SRC_TOP_} and
BSDOBJDIR defaults to the objdir of ${BSDSRCDIR}.

Failsafe defaults for BSDSRCDIR (/usr/src) and BSDOBJDIR (/usr/obj)
are provided later in the file.

This should result in a usable BSDSRCDIR default (i.e, _SRC_TOP_ if
running from within the source tree), with safe fallbacks as appropriate
(/usr/src, as always), meaning that BSDSRCDIR should be able to be used
instead of _SRC_TOP_ in the source tree, although I need to carefully
test this.  *aaaiiiieeee!!!*.  (Now I understand some of Todd's pain :)

diffstat:

 share/mk/bsd.own.mk |  52 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 29 insertions(+), 23 deletions(-)

diffs (92 lines):

diff -r a98a5bd85f57 -r 0eb782ac424c share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Fri Apr 26 14:21:28 2002 +0000
+++ b/share/mk/bsd.own.mk       Fri Apr 26 14:27:23 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.own.mk,v 1.286 2002/04/23 07:20:22 lukem Exp $
+#      $NetBSD: bsd.own.mk,v 1.287 2002/04/26 14:27:23 lukem Exp $
 
 .if !defined(_BSD_OWN_MK_)
 _BSD_OWN_MK_=1
@@ -30,19 +30,11 @@
 PRINTOBJDIR=   echo # prevent infinite recursion
 .endif
 
-# Where the system object and source trees are kept; can be configurable
-# by the user in case they want them in ~/foosrc and ~/fooobj (for example).
-#
-BSDSRCDIR?=    /usr/src
-BSDOBJDIR?=    /usr/obj
-
 # Determine if running in the NetBSD source tree by checking for the
 # existence of build.sh and tools/ in the current or a parent directory,
 # and setting _SRC_TOP_ to the result.
-# If no match is found, (e.g., make(1) is running outside of the NetBSD
-# source tree), set _SRC_TOP_ to ${BSDSRCDIR}.
 #
-.if !defined(_SRC_TOP_)
+.if !defined(_SRC_TOP_)                        # {
 _SRC_TOP_!= cd ${.CURDIR}; while :; do \
                here=`pwd`; \
                [ -f build.sh  ] && [ -d tools ] && { echo $$here; break; }; \
@@ -50,27 +42,35 @@
                cd ..; done 
 
 .MAKEOVERRIDES+=       _SRC_TOP_
+
+.endif                                 # }
+
+# If _SRC_TOP != "", we're within the NetBSD source tree, so set
+# various defaults.
+#
+.if (${_SRC_TOP_} != "")               # {
+
+#   The default for BSDSRCDIR is ${_SRC_TOP_},
+#   and the default for BSDOBJDIR is the objdir of ${BSDSRCDIR}
+#
+BSDSRCDIR?=    ${_SRC_TOP_}
+.if !defined(BSDOBJDIR)
+BSDOBJDIR!=    cd ${BSDSRCDIR} && ${PRINTOBJDIR}
 .endif
 
-# (At this point, if not inside the NetBSD source tree, ${_SRC_TOP_} == "").
+.if !defined(_SRC_TOP_OBJ_)
+_SRC_TOP_OBJ_!=                cd ${_SRC_TOP_} && ${PRINTOBJDIR}
+.MAKEOVERRIDES+=       _SRC_TOP_OBJ_
+.endif
+
+.endif # _SRC_TOP != ""                # }
+
 
 .if (${_SRC_TOP_} != "") && defined(USE_NEW_TOOLCHAIN)
 USETOOLS?=     yes
 .endif
 USETOOLS?=     no
 
-.if (${_SRC_TOP_} == "")
-_SRC_TOP_=     ${BSDSRCDIR}            # fall back to ${BSDSRCDIR}
-.endif
-
-# End of logic to set _SRC_TOP_
-#
-
-
-.if !defined(_SRC_TOP_OBJ_)
-_SRC_TOP_OBJ_!=                cd ${_SRC_TOP_} && ${PRINTOBJDIR}
-.MAKEOVERRIDES+=       _SRC_TOP_OBJ_
-.endif
 
 .if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "sh3"
 .BEGIN:
@@ -198,6 +198,12 @@
 DESTDIR?=
 .endif
 
+# Where the system object and source trees are kept; can be configurable
+# by the user in case they want them in ~/foosrc and ~/fooobj (for example).
+#
+BSDSRCDIR?=    /usr/src
+BSDOBJDIR?=    /usr/obj
+
 BINGRP?=       wheel
 BINOWN?=       root
 BINMODE?=      555



Home | Main Index | Thread Index | Old Index