
echo "
    This script assumes that the GCC compiler is available, and that
    the function glob() is available in the gcc-runtime library.
    If that's not the case, remove the -DHAVE_GLOB define from the 
    gcc flags.
"                                     

echo    Building the runtime-library in ./rss
cd rss
gcc -c -O -DHAVE_GLOB *.c
ar rsv libicrss.a *.o
rm *.o
cd ..

echo Creating the target directory ./bin
mkdir -p bin

echo Creating icmake
cd make
gcc -O -DHAVE_GLOB -o ../bin/icmake *.c ../rss/libicrss.a

echo Creating icm-pp
cd ../pp
gcc -O -DHAVE_GLOB -o ../bin/icm-pp *.c ../rss/libicrss.a

echo Creating icm-comp
cd ../comp
gcc -O -DHAVE_GLOB -o ../bin/icm-comp *.c ../rss/libicrss.a

echo Creating icm-exec
cd ../exec
gcc -O -DHAVE_GLOB -o ../bin/icm-exec *.c ../rss/libicrss.a
cd ../un

echo Creating icmun
gcc -O -DHAVE_GLOB -o ../bin/icmun *.c ../rss/libicrss.a
cd ..  

echo Stripping the binaries
cd bin
strip *

cd ..

echo "
    Done.
"
