#!/bin/sh

INITIAL_DIR=`pwd`

remtrace Compile the C libraries C code
remtrace libpng
cd $INITIAL_DIR/C_library/libpng
if echo "$ISE_PLATFORM" | grep "linux" >/dev/null 2>&1; then
	cp scripts/makefile.linux .
	make -f makefile.linux
elif echo "$ISE_PLATFORM" | grep "solaris" >/dev/null 2>&1; then
	cp scripts/makefile.solaris .
	make -f makefile.solaris
elif echo "$ISE_PLATFORM" | grep "irix" >/dev/null 2>&1; then
	cp scripts/makefile.sgi .
	make -f makefile.sgi
elif [ "$ISE_PLATFORM" = "hpux-11" ]; then
	cp scripts/makefile.hpux .
	make -f makefile.hpux
elif [ "$ISE_PLATFORM" = "alpha" ]; then
	cp scripts/makefile.dec .
	make -f makefile.dec
elif echo "$ISE_PLATFORM" | grep "openbsd" >/dev/null 2>&1; then
	cp scripts/makefile.gcc .
	make -f makefile.gcc
elif echo "$ISE_PLATFORM" | grep "freebsd" >/dev/null 2>&1; then
	cp scripts/makefile.gcc .
	make -f makefile.gcc
elif echo "$ISE_PLATFORM" | grep "macosx" >/dev/null 2>&1; then
	cp scripts/makefile.gcc .
	make -f makefile.gcc
else
	rep=$ISE_PLATFORM
	if [ ! -f "scripts/makefile.$rep" ]; then
		echo Here are the available makefiles:
		ls scripts
		echo "What is the extension of the makefile that should be used?"
		while [ ! -f "scripts/makefile.$rep" ]; do
			echo "scripts/makefile.$rep doesn't exist... Try another one"
			read rep
		done
	fi
	cp scripts/makefile.$rep .
	make -f makefile.$rep
fi

remtrace zlib
cd $INITIAL_DIR/C_library/zlib
make                                                                        


remtrace Compile the Eiffel libraries C code
if [ -d $INITIAL_DIR/library/cURL ]; then
	remtrace cURL
	cd $INITIAL_DIR/library/cURL/Clib
	default_make
fi 
remtrace net
cd $INITIAL_DIR/library/net/Clib
default_make
mac_ranlib $INITIAL_DIR/library/net/spec/$ISE_PLATFORM/lib/libnet.a
remtrace vision2
cd $INITIAL_DIR/library/vision2/Clib
default_make
cd $INITIAL_DIR/library/vision2/implementation/gtk/Clib
default_make
cd $INITIAL_DIR
