#!/bin/csh -f
#
# Quick build script for occam compiler and libraries
#

# You will need to redefine these
set gccinclude = "/u/products/toolset/release/build/include/gcc"
set inmos_occam = /inmos/prod/d4205a

# These should be ok
set base_dir = $cwd
set path = ($inmos_occam/tools $base_dir/preocc $path)
setenv ISEARCH "$base_dir/libs/ $base_dir/include/ $gccinclude/"

set buildlibs = (arglib extlib tcofflib)
foreach buildlib ($buildlibs)
	echo --- $buildlib
	cd $buildlib
	make -f [Mm]akefile.s4 COMMON=$base_dir GCCINCLUDE=$gccinclude TLIB=
	cd ..
end

set buildtools = (preocc)
foreach buildtool ($buildtools)
	echo --- $buildtool
	cd $buildtool
	make -f [Mm]akefile.s4 COMMON=$base_dir GCCINCLUDE=$gccinclude 'TLIB=$(COMMON)/arglib/arg.a $(COMMON)/tcofflib/tcofflib.a'
	cd ..
end

rehash

set libs = (libs)
foreach lib ($libs)
	echo --- $lib
	cd $lib
	make -f [Mm]akefile.tp COMMON=$base_dir GCCINCLUDE=$gccinclude OCCAMLIBS=$base_dir/libs
	cd ..
end

set tools = (oc)
foreach tool ($tools)
	echo --- $tool
	cd $tool
	make -f [Mm]akefile.s4c MAKE=make HOST="" COMMON=$base_dir GCCINCLUDE=$gccinclude
	cd ..
end
