#!/bin/csh
# This script compiles all c programs in the subdirectories of kaos
# and make corresponding libraries. 
# Note: This does not check dependencies
# Note: The reason for the existence of this shell script is because of
# the problem with the use of make scripts of the old make facilities 
# under SunOS 3.x operating systems.
# Run "make kaos" after running this cshell script.
# The environmental variable $KAOSHOME should be set in .login and .cshrc files.

set mathlibs = -lm
set cflags = (-sun4 -O)

cd ${KAOSHOME}
echo "cd ${KAOSHOME}"
echo -n "cleaning all object and archive files..."
unalias rm
rm -f *lib/*.[oa]
echo "Done"

set libs = `ls -d *lib`
set lib =

echo "starting compilation..."
foreach lib (${libs})
	cd ${lib}
	echo "cd ${lib}"
	cc ${cflags} ${mathlibs} -c *.c
	ar r ${lib}.a *.o
	ranlib ${lib}.a
	cd ..
end

alias rm rm -i
echo "compilation done"
