#! /bin/sh # # Copyright (C) 1993, Digital Equipment Corporation # All rights reserved. # See the file COPYRIGHT for a full description. # # Last modified on Mon Nov 1 10:51:30 PST 1993 by kalsow # modified on Mon May 24 11:21:16 PDT 1993 by mjordan quake="/ex32/usr/local/bin/quake" template_dir="/ex32/usr/local/lib/m3/pkg/m3build/templates" template="LINUX" build_dir="LINUX" start_dir="." quake_args="" units="" show_hidden="" verbose="n" # # parse the command line # while case "$1" in "") break;; -b) shift ; build_dir="$1" ; template="$1" ;; -T) shift ; template_dir="$1" ;; -d) shift ; start_dir="$1" ;; -h) show_hidden="show_hidden" ;; -v) verbose="y" ;; -*) quake_args="$quake_args $1" ;; *) units="$units $1" ;; esac do shift done # # get to the initial directory # cd "$start_dir" start_dir=`pwd` base=`basename "$start_dir"` parent=`cd .. ; pwd` # # move to the directory with derived objects # if [ $base = $build_dir ] then package_dir=$parent elif [ -d "$build_dir" ] then package_dir="$start_dir" cd "$build_dir" elif [ -d "../$build_dir" ] then # we're in a sibling directory (probably "src") set package_dir=$parent cd "../$build_dir" else echo "m3where: cannot locate build directory $build_dir" exit 1 fi package=`basename "$package_dir"` # # find a .M3EXPORTS file # if [ ! -r ".M3EXPORTS" ] then echo "m3where: missing .M3EXPORTS file in `pwd`" exit 1 fi # # build the query # query="/tmp/m3find.$$" echo "% m3where $*" >$query if [ "x$units" = "x" ] then echo "enum_units(\"$show_hidden\")" >>$query else for u in $units do echo "find_unit($u, \"$show_hidden\")" >>$query done fi # # prepare for the worst... # trap 'rm -f $query ; exit 1' 1 2 3 15 # # evaulate the query # if [ x"$verbose" = xy ] then echo "$quake -DPACKAGE_DIR=$package_dir -DPACKAGE=$package -DBUILD_DIR=$build_dir $template_dir/$template $quake_args .M3EXPORTS $query" fi if $quake -DPACKAGE_DIR=$package_dir -DPACKAGE=$package -DBUILD_DIR=$build_dir $template_dir/$template $quake_args .M3EXPORTS $query then : else rm -f $query exit 1 fi # # and cleanup # rm -f $query