#!/bin/ksh -p # # 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. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # # # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout # under certain circumstances, which can really screw things up; unset it. # unset CDPATH setvar PROG = $(basename $0)" PATH=/opt/onbld/bin:$PATH" export PATH if test -n $BUILD_TOOLS {" PATH=$BUILD_TOOLS/onbld/bin:$PATH" export PATH } setvar CONF = 'tools/scripts/build_cscope.conf' # # Print the provided failure message and exit with an error. # proc fail { echo $PROG: $ifsjoin(ARGV) > /dev/stderr exit 1 } if test $Argc -ne 1 { echo "Usage: $PROG " exit 1 } # # Setup environment variables # if test -f $1 { if [[ $1 = */* ]] { source $1 } else { source ./$1 } } elif test -f "/opt/onbld/env/$1" { source "/opt/onbld/env/$1" } else { fail "cannot find env file as $1 or /opt/onbld/env/$1" } test -z $SRC && fail "\$SRC is not set" test ! -d $SRC && fail "\$SRC ($SRC) is not a directory" # # Despite our name, we actually build cscope, ctags, and etags # cross-references. # cd $SRC while read name flags dirs { test $name = "" -o $name = "#" && continue test $flags = "\"\"" && setvar flags = '' xref -c $dirs xref $flags $dirs || fail "cannot build $name cross-reference" } < $CONF