/usr/bin/genlib is in alliance 5.1.1-1.1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | #!/bin/sh
#
# $Id: genlib.sh,v 1.9 2002/10/24 10:28:32 hcl Exp $
#
# /------------------------------------------------------------------\
# | |
# | A l l i a n c e C A D S y s t e m |
# | D p G e n |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : alliance-users@asim.lip6.fr |
# | ================================================================ |
# | sh script : "./dpgen/dpgen.sh" |
# | **************************************************************** |
# | U p d a t e s |
# | |
# \------------------------------------------------------------------/
#
# /------------------------------------------------------------------\
# | |
# | Functions Definitions |
# | |
# \------------------------------------------------------------------/
# --------------------------------------------------------------------
# Function : `print_usage()'.
print_usage()
{
echo ""
echo " usage: genlib [-cdlknv] [--keep-exec] [--no-exec] [--no-rm-core] \\"
echo " [--keep-log] [--verbose] \\"
echo " <program> [-e [args]]"
echo ""
echo " Options:"
echo " [-c|--no-rm-core] : Don't remove core file."
echo " [-l|--keep-log] : Keep log file (.grr) after execution."
echo " [-k|--keep-exec] : Keep binary after execution."
echo " [-m|--keep-makefile] : Keep makefile after execution."
echo " [-n|--no-exec] : Do not execute the binary."
echo " [-v|--verbose] : Issue more informations."
echo " [-e [args]] : [args] are passed to the binary."
echo ""
}
# --------------------------------------------------------------------
# Function : `vecho()'.
vecho()
{
ECHOFLAGS=""
if [ $1 -gt $VERBOSE ]; then return 0; fi
if [ "$2" = "-n" ]; then
ECHOFLAGS="-n"; shift;
fi
echo $ECHOFLAGS "$2" 2>&1 | tee -a $CSOURCE.grr
}
# /------------------------------------------------------------------\
# | |
# | Main Part of the Shell Script |
# | |
# \------------------------------------------------------------------/
if [ -z "$ALLIANCE_TOP" ]; then
alcbanner "GenLib" "4.0" "Procedural Generation Language" "1991"
else
${ALLIANCE_TOP}/bin/alcbanner "GenLib" "4.0" "Procedural Generation Language" "1991"
fi
# --------------------------------------------------------------------
# Process the command line.
# If no arguments, print usage.
if [ $# -eq 0 ]; then print_usage; exit 0; fi
KEEP_BIN="n"
KEEP_LOG="n"
KEEP_CORE="n"
KEEP_MAKEFILE="n"
VERBOSE=0
EXECUTE="y"
ARGUMENTS=""
PROGRAM="not set"
DEVEL="n"
# Parse the arguments.
while [ $# -gt 0 ]; do
case $1 in
--no-rm-core) KEEP_CORE="y";;
--keep-makefile) KEEP_MAKEFILE="y";;
--keep-exec) KEEP_BIN="y";;
--keep-log) KEEP_LOG="y";;
--no-exec) EXECUTE="n";;
--verbose) VERBOSE=1;;
--devel) DEVEL="y";;
-*) NB=2; CH=`echo $1 | cut -c$NB`
while [ "$CH" != "" ]; do
case $CH in
m) KEEP_MAKEFILE="y";;
c) KEEP_CORE="y";;
k) KEEP_BIN="y";;
l) KEEP_LOG="y";;
n) EXECUTE="n";;
v) VERBOSE=1;;
d) DEVEL="y";;
e) echo "genlib:warning: misplaced -e option.";
print_usage; exit 1;;
*) echo "genlib:warning: Invalid option \`$CH' (ignored)."
print_usage;;
esac
NB=`expr $NB + 1`
CH=`echo $1 | cut -c$NB`
done;;
*) PROGRAM=$1; shift; break;;
esac
shift
done
# Parse optionals program arguments.
if [ $# -gt 0 ]; then
if [ "$1" != "-e" ]; then
echo "genlib:warning: ignored \`$1' parameter after program name."
print_usage
else
shift; ARGUMENTS="$*"
fi
fi
# Check arguments coherency.
if [ "$PROGRAM" = "not set" ]; then
echo "genlib:error: Missing <program> argument."
print_usage; exit 1;
fi
CSOURCE=`basename $PROGRAM .c`
# Removing previously generated files.
rm -f $CSOURCE.grr $CSOURCE.o > /dev/null 2>&1
# --------------------------------------------------------------------
# Print the current MBK environment.
if [ ! -z "$ALLIANCE_TOP" ]; then ALLIANCE_TOP=$ALLIANCE_TOP; fi
vecho 1 " o Current Alliance environment:"
vecho 1 " - ALLIANCE_TOP : ${ALLIANCE_TOP-not set}"
vecho 1 " o Current MBK environment:"
vecho 1 " - MBK_IN_LO : ${MBK_IN_LO-not set}"
vecho 1 " - MBK_OUT_LO : ${MBK_OUT_LO-not set}"
vecho 1 " - MBK_IN_PH : ${MBK_IN_PH-not set}"
vecho 1 " - MBK_OUT_PH : ${MBK_OUT_PH-not set}"
vecho 1 " - MBK_WORK_LIB : ${MBK_WORK_LIB-not set}"
vecho 1 -n " - MBK_CATA_LIB : "
if [ -z "$MBK_CATA_LIB" ]; then
vecho 1 "not set"
else
STRING=`echo ${MBK_CATA_LIB} | \
awk 'BEGIN { FS=":"; } \
{ for( i=1; i<=NF; i++) { \
printf("%s\n", $i); \
if (i < NF) \
printf(" "); \
} \
}' -`
vecho 1 "$STRING"
fi
vecho 1 " - MBK_CATAL_NAME : ${MBK_CATAL_NAME-not set}"
vecho 1 " - MBK_VDD : ${MBK_VDD-not set}"
vecho 1 " - MBK_VSS : ${MBK_VSS-not set}"
vecho 1 " - RDS_TECHNO_NAME : ${RDS_TECHNO_NAME-not set}"
vecho 1 ""
# --------------------------------------------------------------------
# Development hacks.
if [ "$DEVEL" = "y" ]; then
ALLIANCE_INSTALL_DIR="/usr"
ALLIANCE_DEVEL_INCLUDE="-I${ALLIANCE_INSTALL_DIR}/include"
ALLIANCE_DEVEL_LIB="-L${ALLIANCE_INSTALL_DIR}/lib"
export ALLIANCE_INSTALL_DIR ALLIANCE_DEVEL_INCLUDE ALLIANCE_DEVEL_LIB
vecho 0 " o Switching to development environment :"
vecho 0 " - ALLIANCE_INSTALL_DIR : ${ALLIANCE_INSTALL_DIR-not set}"
fi
# --------------------------------------------------------------------
# Build and execute the Makefile.
vecho 1 " o Program generation."
vecho 1 " - Creating Makefile."
MAKEFILE="Makefile-$$"
# --------------------------------------------------------------------
# Start of the Makefile text.
cat << EOF > $MAKEFILE
ALLIANCE_INCLUDE = $ALLIANCE_TOP/include/alliance
ALLIANCE_LIB = $ALLIANCE_TOP/lib/alliance
LOCAL_ALC_IDIR = $ALLIANCE_DEVEL_INCLUDE -I\$(ALLIANCE_INCLUDE)
LOCAL_ALC_DEFS =
LOCAL_ALC_INCS = \$(LOCAL_ALC_IDIR) \$(LOCAL_ALC_DEFS)
LOCAL_ALC_LDIR = $ALLIANCE_DEVEL_LIB -L\$(ALLIANCE_LIB)
LOCAL_ALC_LVBE = -lBvl \\
-lBeh \\
-lBhl \\
-lLog
LOCAL_ALC_LMGN = -lMgn
LOCAL_ALC_LMUT = -lMut
LOCAL_ALC_LMLO = -lMlu \\
-lMlo \\
-lRcn
LOCAL_ALC_LMPH = -lMpu \\
-lMph
LOCAL_ALC_LIBS = \$(LOCAL_ALC_LDIR) \\
\$(LOCAL_ALC_LVBE) \\
\$(LOCAL_ALC_LMGN) \\
\$(LOCAL_ALC_LMLO) \\
\$(LOCAL_ALC_LMPH) \\
\$(LOCAL_ALC_LMUT)
LOCAL_STD_LIBS = -lm
# C Flags for normal compilation.
LOCAL_CFLAGS = \$(CFLAGS) -c -g
LOCAL_OFLAGS = \$(OFLAGS) -o
all: $CSOURCE
$CSOURCE: $CSOURCE.o
\$(CC) \$(LOCAL_OFLAGS) \$@ \$? \$(LOCAL_ALC_LIBS) \$(LOCAL_STD_LIBS)
rm -f \$?
$CSOURCE.o: $CSOURCE.c
\$(CC) \$(LOCAL_CFLAGS) \$(LOCAL_ALC_INCS) \$?
clean:
rm -f $CSOURCE $CSOURCE.o $CSOURCE.exe
EOF
# --------------------------------------------------------------------
# End of the Makefile text.
vecho 1 " - Running Makefile."
make -f $MAKEFILE ALLIANCE_TOP=$ALLIANCE_TOP \
CSOURCE=$CSOURCE clean all >> $CSOURCE.grr 2>&1
exit_code=$?
if [ $exit_code -ne 0 ]; then
if [ $KEEP_MAKEFILE != "y" ]; then rm -f $MAKEFILE; fi
echo "genlib:error: Compilation failed."
echo "error messages:"
cat $CSOURCE.grr
exit $exit_code
else
if [ "$EXECUTE" = "y" ]; then
vecho 1 " o Execute program..."
./$CSOURCE $ARGUMENTS; exit_code=$?
vecho 1 " - Exit code := $exit_code."
if [ $exit_code -ne 0 ]; then
if [ $KEEP_MAKEFILE != "y" ]; then rm -f $MAKEFILE; fi
echo "genlib:error: Execution failed."
fi
if [ "$KEEP_CORE" != "y" ]; then rm -f core >> $CSOURCE.grr 2>&1; fi
else
vecho 1 " o Execution step skipped."
exit_code=0
fi
fi
vecho 1 ""
vecho 1 " o Remove temporary file."
rm -f $MAKEFILE
if [ "$KEEP_BIN" != "y" ]; then rm -f $CSOURCE $CSOURCE.exe >> $CSOURCE.grr 2>&1; fi
if [ \( $exit_code -eq 0 \) -a \( "$KEEP_LOG" != "y" \) ]; then
rm -f $CSOURCE.grr > /dev/null 2>&1
fi
echo ""
exit $exit_code
|