#!/bin/sh
sh find-systype.sh > systype

rm -f compile
sh print-cc.sh > compile
chmod 555 compile

rm -f makelib
sh print-ar.sh > makelib
chmod 555 makelib

rm -f load
sh print-ld.sh > load
chmod 555 load

rm -f uint64.h
# some systems require C differently
ln uint64.h1 uint64.h
#ln uint64.h2 uint64.h

rm -f *.o
./compile *.c 2>/dev/null

rm -f all.a
./makelib all.a *.o

rm -f tai64n
./load tai64n all.a
ls -l tai64n

rm -f tai64ngmt
./load tai64ngmt all.a
ls -l tai64ngmt

rm -f tai64nlocal
./load tai64nlocal all.a
ls -l tai64nlocal

# tidy up
rm -f *.o *.a uint64.h load makelib compile systype

TESTOUT=`(
	echo hello
	sleep 1
	echo world
) | ./tai64n`
echo "tai64n output:"
echo "$TESTOUT"
echo "tai64ngmt output:"
echo "$TESTOUT" | ./tai64ngmt
echo "tai64nlocal output:"
echo "$TESTOUT" | ./tai64nlocal
