export SATHER_HOME=$(shell cd ..;pwd)
export LOCALE=en_NZ
export SATHER_ENV=$(SATHER_HOME)/resources/$(LOCALE)/bin/LIBCHARS

#CS_OPT=-chk -verbose -only_reachable -pretty
CS_OPT=-verbose -only_reachable -chk
SACOMP=$(SATHER_HOME)/bin/sacomp

default: do_test do_std_chans do_all

do_%: test_%
	./test_$(*) | tee test_$(*).output

test_test: FORCE
#	$(SACOMP) test.module -o test_test -main TEST_TEST $(CS_OPT) -only_C
	$(MAKE) CFLAGS="-I. -g" -C test_test.code

test_std_chans: FORCE
#	$(SACOMP) test.module -o test_std_chans -main TEST_STD_CHANS $(CS_OPT) -only_C
	$(MAKE) CFLAGS="-I. -g" -C test_std_chans.code

test_all: FORCE
#	$(SACOMP) test.module -o test_all -main TEST_ALL $(CS_OPT) -only_C
	$(MAKE) CFLAGS="-I. -g" -C test_all.code

test_minimal: FORCE
	$(SACOMP) test.module -o test_minimal -main TEST_MINIMAL $(CS_OPT) -only_C
	$(MAKE) CFLAGS="-I. -g" -C test_minimal.code

FORCE:

clean:
	rm -rf test_test.code test_std_chans.code test_all.code test_minimal.code
	rm -f test_test test_std_chans test_all test_minimal
	rm -f *.output
