#!/bin/sh

LIBRARY_PATH="-L$LINK_BASE/src"

CCC=g++
CFLAGS="-g"
INCLUDES="-I$LINK_BASE/include"
libs=
outfile=""
out=""
debug=""

if [ $# -eq 0 ]
then
	echo "usage: link_cc <file.cpp> [-o <executable] [extra libs] -lgraph -lbasic"
	echo "   ex: link_cc a.cpp -o a -lgen -lalg -lgraph -lbasic"
	exit
fi

while [ $# -gt 0 ]
do
        case "$1" in
        -o)     shift; outfile=$1; out=" -o $1";;
        -g)     debug="-g";;
        -l*)     libs="$libs $1";;
         *)     file=$1;;
        esac
        shift
done


echo "${CCC} $debug ${CFLAGS} ${INCLUDES} $file $out ${LIBRARY_PATH} $libs"
${CCC} $debug ${CFLAGS} ${INCLUDES} $file $out ${LIBRARY_PATH} $libs
strip $outfile

