#!/bin/sh
# Shared library demo
#        - synopsys: dynamic FILE1 [FILE2 ... FILE9]
#        - NOTE    : the output library will have the 
#                    name of the 1st file within 
#                    parameters list.


PARAMS_1stSTEP=""
PARAMS_2ndSTEP=""
BLANK=" "

for A in ${@}
do
PARAMS_1stSTEP=$PARAMS_1stSTEP$BLANK${A}.C
done

for A in ${@}
do
PARAMS_2ndSTEP=$PARAMS_2ndSTEP$BLANK${A}.o
done


# {@}.C are the C++ input file(s). 
# Create shared library's object file(s), {@}.o.

g++ -fPIC -Wall -g -c $PARAMS_1stSTEP

# Create shared library.
# Use -lc to link it against C library, since $1 input file
# depends on the C library.

g++ -g -shared -o $1.so.0 $PARAMS_2ndSTEP extpred.o -lc

     
#/sbin/ldconfig -n .

# Set up the linker name.
# In a more sophisticated setting, we'd need to make
# sure that if there was an existing linker name,
# and if so, check if it should stay or not.

ln -sf $1.so.0 $1.so
