Files
pcas/src/tools/GetVar
T
1996-02-20 20:58:44 +00:00

89 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
#
# $Id$
#
# Retrieve a variable value from EPICS configuration makefiles.
# by Matthew Needes
#
# Syntax:
# GetVar VAR_NAME [TARGET_ARCH]
#
# If TARGET_ARCH is NOT specified, only those general variables in
# CONFIG_SITE are available.
#
# If TARGET_ARCH is specified, all EPICS target specific variables
# are accessable in addition to all general variables.
#
# $Log$
# Revision 1.10 1995/08/18 15:26:39 jba
# Added pathname to gmake
#
# Revision 1.9 1995/08/17 20:30:00 jba
# EPICS now passed as param - FindEpics removed
#
# Revision 1.8 1994/10/25 15:55:28 winans
# Changed 'make' to 'gmake' for performing make operations.
#
# Revision 1.7 1994/10/05 18:39:27 jba
# Modified syntax of makefile usage
#
# Revision 1.6 1994/09/22 01:41:44 mcn
# MakeRelease - MAJOR bug fix. GetVar / MakeDirs - minor fix.
#
# Revision 1.5 1994/09/08 13:47:08 mcn
# Fixed GetVar's inclusions.
#
# Revision 1.4 1994/09/07 20:59:13 mcn
# Revamped GetVar, modified scripts for new GetVar.
#
# Revision 1.3 1994/09/07 19:08:49 jba
# Modified to work with extensions and do depends
#
# Revision 1.2 1994/08/21 00:56:38 mcn
# New Stuff
#
# Revision 1.1 1994/08/16 16:12:18 mcn
# Added GetVar, made use of 'ln' compatible with SYSV Unix.
#
#
if [ -z "$2" ]; then
echo "usage: $0 EPICS VAR_NAME [TARGET_ARCH]"
exit 1
fi
EPICS=$1
INCLUDE=${EPICS}/config/CONFIG_BASE
if [ -z "$3" ]; then
OPTS=""
else
OPTS="T_A=$3"
fi
PID=$$
# Construct temporary makefile
cat - <<MFILE > /tmp/Makefile.tmp.$$
EPICS=$EPICS
include ${INCLUDE}
all:
@echo "\$($2)" > /tmp/Makefile.tmp.out.$PID
MFILE
gnumake -f /tmp/Makefile.tmp.$$ $OPTS > /dev/null
# Display value
cat /tmp/Makefile.tmp.out.$$
rm -f /tmp/Makefile.tmp.$$ /tmp/Makefile.tmp.out.$$
exit 0