summaryrefslogtreecommitdiff
path: root/usr/src/tools/scripts/xref.sh
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/tools/scripts/xref.sh')
-rw-r--r--usr/src/tools/scripts/xref.sh41
1 files changed, 16 insertions, 25 deletions
diff --git a/usr/src/tools/scripts/xref.sh b/usr/src/tools/scripts/xref.sh
index cad8be25e1..20ec192315 100644
--- a/usr/src/tools/scripts/xref.sh
+++ b/usr/src/tools/scripts/xref.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,7 +28,10 @@
# xref: build and maintain source cross-reference databases.
#
-PATH=/usr/bin:/usr/ccs/bin:${BUILD_TOOLS:-/opt}/teamware/bin export PATH
+ONBLDDIR=$(dirname $(whence $0))
+
+PATH=/usr/bin:/usr/ccs/bin:${BUILD_TOOLS:-/opt}/teamware/bin:$ONBLDDIR
+export PATH
PROG=`basename $0`
XREFMK=`dirname $0`/xref.mk
XRMAKEFILE=Makefile export XRMAKEFILE
@@ -87,28 +89,17 @@ timeinfo()
info "$1 in ${min}m${sec}s"
}
-#
-# If $CODEMGR_WS isn't set, then attempt to glean it from the workspace
-# command before giving up.
-#
-if [ -z "$CODEMGR_WS" ]; then
- if whence workspace > /dev/null; then
- #
- # Since ws(1) hasn't been run, set up SRC and MACH too.
- # Note that other environment variables, such as
- # ENVCPPFLAGS*, can also affect the resulting
- # cross-reference, but we assume that if the developer
- # really cared, he would've ws'd first.
- #
- CODEMGR_WS=`workspace name` export CODEMGR_WS
- SRC=$CODEMGR_WS/usr/src export SRC
- MACH=`uname -p` export MACH
- else
- fail "No active workspace; run \"ws <workspace_name>\""
- fi
+which_scm | read SCM_MODE CODEMGR_WS || exit 1
+
+if [[ $SCM_MODE == "unknown" ]];then
+ print -u2 "Unable to determine SCM type currently in use."
+ exit 1
fi
-[ -d "$CODEMGR_WS" ] || fail "\$CODEMGR_WS ($CODEMGR_WS) is not a directory"
+export CODEMGR_WS
+SRC=$CODEMGR_WS/usr/src export SRC
+MACH=`uname -p` export MACH
+
[ -f $XREFMK ] || fail "cannot locate xref.mk"
clobber=