Files
pcas/src/libCom/blderrSymTbl
1995-11-27 15:49:58 +00:00

119 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
#
# base/tools $Id$
# Author: Robert Zieman (ANL)
# Date: 6/03/91
#
# Experimental Physics and Industrial Control System (EPICS)
#
# Copyright 1991, the Regents of the University of California,
# and the University of Chicago Board of Governors.
#
# This software was produced under U.S. Government contracts:
# (W-7405-ENG-36) at the Los Alamos National Laboratory,
# and (W-31-109-ENG-38) at Argonne National Laboratory.
#
# Initial development by:
# The Controls and Automation Group (AT-8)
# Ground Test Accelerator
# Accelerator Technology Division
# Los Alamos National Laboratory
#
# Co-developed with
# The Controls and Computing Group
# Accelerator Systems Division
# Advanced Photon Source
# Argonne National Laboratory
#
# Modification Log:
# -----------------
# .00 mm-dd-yy iii Comment
# .01 05-04-94 pg HPUX port modifications.
# .02 08-25-94 mda use makedepend for HP or Alpha if no GCC
# .03 04-28-95 anj use GetVar and case for host arch
# ...
#
# tool to rebuild errSymTbl.c when errInc.c or it's depends change
# Usage blderrSymTbl EPICS HOST_ARCH MAKE VXLIST - IOC and commmon
# Usage blderrSymTbl EPICS HOST_ARCH MAKE - just common
if [ "x" = "x$4" ]; then
DEF="XXX"
else
DEF="${4}"
fi
TMPMAKEFILE=/tmp/tmpmakefile
SFILES=/tmp/sfiles
EPICS=$1
HOST_ARCH=$2
MAKE=$3
case $HOST_ARCH in
alpha | hp700 | sgi | Linux)
# Use gcc if it can be found, or makedepend
GCC=`which gcc`
if [ -x "$GCC" ]; then
FILES=`"$GCC" -M -D$DEF -I../../../include \
errInc.c 2>/dev/null \
| sed -e 's/errInc\.o.*: errInc\.c//' -e 's/\\\//'`
else
MAKEDEPEND=`which makedepend`
if [ -x "$MAKEDEPEND" ]; then
FILES=`"$MAKEDEPEND" -f- -D$DEF -I../../../include \
errInc.c 2>/dev/null | sed -e 's/errInc.o://' -e 's/\\\//'`
else
echo Neither GCC or MAKEDEPEND found.
exit 1
fi
fi
;;
solaris)
# use -xM option of ACC to list dependencies
CC=`$EPICS/base/tools/GetVar $EPICS ACC $HOST_ARCH`
FILES=`$CC -xM -D$DEF -I../../../include errInc.c \
| grep "errInc.o" | grep -v "errInc.c" \
| sed -e 's/errInc\.o://'`
;;
sun4)
# use -M option of Sun compiler to list make dependencies
FILES=`cc -M -D$DEF -I../../../include errInc.c 2>/dev/null \
| grep "errInc.o" | grep -v "errInc.c" \
| sed -e 's/errInc\.o://'`
;;
*)
# Unrecognised host architecture
echo $0: host architecture not supported
exit 1
esac
# files with S_ defines
grep "^#define[ ]*S_" $FILES /dev/null \
| sed -e 's-:.*--' | sort -u >$SFILES
# create a tmpmakefile
cat $SFILES | (awk '
BEGIN {print "errInc.o : errInc.c \\"}
{print " "$0" \\" }
END {print " ../../../include/errMdef.h"}
') > $TMPMAKEFILE
cat >> $TMPMAKEFILE <<!addon
/bin/rm -f errSymTbl.c
../makeStatTbl \`cat $SFILES\` >errSymTbl.c
/bin/rm -f errInc.o
touch errInc.o
!addon
$MAKE -f $TMPMAKEFILE
/bin/rm -f $TMPMAKEFILE $SFILES
exit 0