#!/bin/bash

DEST=.
PLATFORM=Linux_2.x
TCLINCLUDE=/usr/include
SPECIALFLAGS=-DLINUX

echo "gcc -c -o $DEST/verisoft_$PLATFORM.o $SPECIALFLAGS ./verisoft.c"
gcc -c -o $DEST/verisoft_$PLATFORM.o $SPECIALFLAGS ./verisoft.c

echo "gcc -c -o $DEST/verisoft_simul_$PLATFORM.o $SPECIALFLAGS -DSIMUL -DEXHAUSTIVE ./verisoft.c"
gcc -c -o $DEST/verisoft_simul_$PLATFORM.o $SPECIALFLAGS -DSIMUL -DEXHAUSTIVE ./verisoft.c

echo "gcc -I$TCLINCLUDE $SPECIALFLAGS ./sss.c -c -fpic"
gcc -I$TCLINCLUDE ./sss.c -c -fpic

echo "ld ./sss.o -G -o $DEST/libsss.so"
ld ./sss.o -G -o $DEST/libsss.so

echo "gcc -I$TCLINCLUDE $SPECIALFLAGS ./mbx.c -c -fpic"
gcc -I$TCLINCLUDE ./mbx.c -c -fpic

echo "ld ./mbx.o -G -o $DEST/libmbx.so"
ld ./mbx.o -G -o $DEST/libmbx.so

echo "rm ./verisoft.c ./getkey.h ./macros.h ./mbx.c ./sss.c ./verisoft-semdef.h"
rm ./verisoft.c ./getkey.h ./macros.h ./mbx.c ./sss.c ./verisoft-semdef.h

echo "rm ./sss.o ./mbx.o"
rm ./sss.o ./mbx.o

echo "rm ./v.tar"
rm ./v.tar

echo "rm ./install-here"
rm ./install-here

echo "installation complete!"
echo "(warning: a new version of simul.tcl has been installed;"
echo " please update the first two lines of that new file if necessary!)"
