#!/bin/sh

echo "removing old compilations"
rm kb_server
rm kb_creader
rm kb_telnet
rm kb
echo "compiling kb_server"
gcc -Wall -Xlinker --no-as-needed -lm kb_server.c -o kb_server
if [ -f kb_server ]
then
 echo "kb_server compiled successfully"
else
 echo ""
 echo "*** error compiling kb_server ***"
 echo ""
fi
echo "compiling kb_creader"
gcc -Wall -Xlinker --no-as-needed -lm kb_creader.c -o kb_creader
if [ -f kb_creader ]
then
 echo "kb_creader compiled successfully"
else
 echo ""
 echo "*** error compiling kb_creader ***"
 echo ""
fi
echo "compiling kb_telnet"
gcc -Wall -D KBTELNET -Xlinker --no-as-needed -lm kb_telnet.c -o kb_telnet
if [ -f kb_telnet ]
then
 echo "kb_telnet compiled successfully"
else
 echo ""
 echo "*** error compiling kb_telnet ***"
 echo ""
fi
echo "compiling kb"
include_files="`pkg-config --cflags --libs gtk+-2.0 gthread-2.0`"
gcc -Wall -Xlinker --no-as-needed $include_files -lm kb.c -o kb
if [ -f kb ]
then
 echo "kb compiled successfully"
else
 echo ""
 echo "*** error compiling kb ***"
 echo ""
fi

exit 0
