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.
This commit is contained in:
parent
ebe575d3ca
commit
756722c3c1
@ -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= ${MAKE} -V .OBJDIR
|
||||
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 @@ _SRC_TOP_!= cd ${.CURDIR}; while :; do \
|
||||
.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 @@ HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
|
||||
|
||||
# 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 @@ check_RELEASEDIR: .PHONY .NOTMAIN
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user