#!/bin/sh
# ----------------------------------------------------------------------------
# Description:
# This is a final link of the debugging version of the CAPLIB2 APL2
# Interpreter, creating the binary $HOME/cap2/bin/apldeb2.
#
# $HOME should be set to the path to the cap2 subdirectory, e.g. "/home/smitty"
# if it's /home/smitty/cap2. $PATH should have $HOME/cap2/bat:$HOME/cap2/bin
# at it's front before invoking.
# ----------------------------------------------------------------------------
# Changelog:
# 920101 Created by Smitty.
# 980101 Smitty modified to handle HP-UX and Linux Release 2.
# ----------------------------------------------------------------------------
echo "Linking $HOME/bin/apldeb2, using $HOME/cap2/lib/libbug2.a."
os=`uname -s`
if [ "$os" = "HP-UX" ]; then
gcc -g -I$HOME/cap2/include -o $HOME/cap2/bin/apldeb2 \
-L$HOME/cap2/lib \
$HOME/cap2/source/apl.c \
$HOME/src/misc/mem.o \
-lm -lbug2 -lcap2 -lm -lbug2
else
release=`uname -r | cut -d. -f1`
case "$release" in
"1")
zd $HOME/cap2/source/apl
rc=$?
if [ $rc -ne 0 ]; then
echo bad compile
exit $rc
fi
ld -g -o $HOME/bin/apldeb2 \
-dll-verbose -m486 -non_shared \
/usr/lib/crt0.o \
$HOME/cap2/source/apl.o \
$HOME/src/misc/mem.o \
$HOME/cap2/lib/libbug2.a \
-L/usr/lib/gcc-lib/i486-linux/2.6.3 \
-lcurses -ltermcap -lgcc -lg -lgcc -lm
rm $HOME/cap2/source/apl.o
;;
*)
cp $HOME/cap2/include/apldebug.h1 \
$HOME/cap2/include/apldebug.h
trap "cp $HOME/cap2/include/apldebug.h0 \
$HOME/cap2/include/apldebug.h" EXIT
gcc -g -I$HOME/cap2/include \
-o $HOME/cap2/bin/apldeb2 \
-L$HOME/cap2/lib \
$HOME/cap2/source/apl.c \
$HOME/src/misc/mem.o \
-lm -lbug2 -lcap2
exit
;;
esac
fi