#######################################################################
# Makefile for allegrocl test-suite
#######################################################################

LANGUAGE     = allegrocl
ALLEGROCL    = @ALLEGROCLBIN@
SCRIPTSUFFIX = _runme.lisp
srcdir       = @srcdir@
top_srcdir   = @top_srcdir@
top_builddir = @top_builddir@


# these cpp tests generate warnings/errors when compiling
# the wrapper .cxx file.
CPP_TEST_BROKEN_CXX = 
# the error is wrap:action code generated by swig. \
# error: can't convert [std::string] 'b' to 'bool' \
# might just need a bool overload op for std::string. \
	global_vars \
# same as w/ global_vars but with more errors in cxx file \
	naturalvar \

# these cpp tests aren't working. Fix 'em
# need to further separate these into tests requiring
# std libraries, or the $ldestructor problem.
CPP_TEST_BROKEN_ACL = \
	contract \
	allprotected \
# 'throws' typemap entries. \
	cplusplus_throw \
# 'throws' typemap entries. \
	default_args \
# missing typemaps. suspect module support needed \
	dynamic_cast \
	extend_variable \
# cdata.i support needed \
	li_cdata \
# warning generated. otherwise all good. \
	operator_overload \
# std_common.i support \
	sizet \
# std_vector.i support. \
	template_default \
# *** line 31. can't copy typemap?? \
	typemap_namespace \

# these aren't working due to longlong support. (low hanging fruit)
CPP_TEST_BROKEN_LONGLONG = \
	arrays_dimensionless \
	arrays_global \
	arrays_global_twodim \
	li_typemaps \
	li_windows \
	long_long_apply \
	primitive_ref \
	reference_global_vars \
	template_default_arg

# These are currently unsupported.
CPP_TEST_CASES_ACL_UNSUPPORTED = \
# contract support \
	aggregate \
# directors support \
	apply_signed_char \
# contract support \
	contract \
	director_exception \
	director_protected \
	exception_order \
# 'throws' typemap support \
	extern_throws \
	throw_exception \
	using_pointers \
		
C_TEST_CASES_ACL_BROKEN = \
# 'cdate.i' module support \
	li_cdata \
# adding an existing type defnition... \
	typedef_struct \
# swigrun.swg support. \
	typemap_subst

C_TEST_BROKEN_LONGLONG = \
	long_long


# std lib support hasn't been done yet.
SKIP_CPP_STD_CASES = Yes

include $(srcdir)/../common.mk

# Overridden variables here
# SWIGOPT += -debug-module 4

# Custom tests - tests with additional commandline options
# none!

# Rules for the different types of tests
%.cpptest: 
	$(setup)
	+$(swig_and_compile_cpp)
	$(run_testcase)

%.ctest:
	$(setup)
	+$(swig_and_compile_c)
	$(run_testcase)

%.multicpptest: 
	$(setup)
	+$(swig_and_compile_multi_cpp)
	$(run_testcase)

# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
	if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
	  env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
	fi

%.clean:
	@rm -f $*.cl

clean:
	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile allegrocl_clean

