Source-Changes-HG archive

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

[src/trunk]: src/share/mk Overhaul how _SRC_TOP_ is determined, ensuring that...



details:   https://anonhg.NetBSD.org/src/rev/799fc6727dd1
branches:  trunk
changeset: 526003:799fc6727dd1
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Apr 23 07:20:22 2002 +0000

description:
Overhaul how _SRC_TOP_ is determined, ensuring that it will be set to
${BSDSRCDIR} if make(1) is running outside of the NetBSD source tree.
This should solve various issues, including building xsrc which uses
${BSDSRCDIR}/distrib/sets/maketars.

diffstat:

 share/mk/bsd.own.mk |  42 ++++++++++++++++++++++++++++--------------
 1 files changed, 28 insertions(+), 14 deletions(-)

diffs (84 lines):

diff -r 1707662b8c26 -r 799fc6727dd1 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Tue Apr 23 07:17:29 2002 +0000
+++ b/share/mk/bsd.own.mk       Tue Apr 23 07:20:22 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.own.mk,v 1.285 2002/04/12 05:08:53 lukem Exp $
+#      $NetBSD: bsd.own.mk,v 1.286 2002/04/23 07:20:22 lukem Exp $
 
 .if !defined(_BSD_OWN_MK_)
 _BSD_OWN_MK_=1
@@ -30,8 +30,19 @@
 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_)
-# Find the actual top of the source tree
 _SRC_TOP_!= cd ${.CURDIR}; while :; do \
                here=`pwd`; \
                [ -f build.sh  ] && [ -d tools ] && { echo $$here; break; }; \
@@ -41,18 +52,26 @@
 .MAKEOVERRIDES+=       _SRC_TOP_
 .endif
 
-.if !defined(_SRC_TOP_OBJ_)
-.if ${_SRC_TOP_} != ""
-_SRC_TOP_OBJ_!=        cd ${_SRC_TOP_} && ${PRINTOBJDIR}
-.MAKEOVERRIDES+=       _SRC_TOP_OBJ_
-.endif
-.endif
+# (At this point, if not inside the NetBSD source tree, ${_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:
        @echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
@@ -76,7 +95,7 @@
 
 # Provide a default for TOOLDIR.
 .if !defined(TOOLDIR)
-_TOOLOBJ!=     cd ${_SRC_TOP_:U${BSDSRCDIR}}/tools && ${PRINTOBJDIR}
+_TOOLOBJ!=     cd ${_SRC_TOP_}/tools && ${PRINTOBJDIR}
 TOOLDIR:=      ${_TOOLOBJ}/tools.${HOST_OSTYPE}
 .MAKEOVERRIDES+= TOOLDIR
 .endif
@@ -179,11 +198,6 @@
 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