#######################################################################
# 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 aren't working. Fix 'em
# need to further separate these into tests requiring
# std libraries, or the $ldestructor problem.
CPP_TEST_BROKEN_ACL = \
	array_member \
	char_strings \
	class_ignore \
	constant_pointers \
	contract \
	cplusplus_throw \
	cpp_basic \
	cpp_enum \
	cpp_typedef \
	default_constructor \
	default_args \
	dynamic_cast \
	enum_thorough \
	extend_variable \
	global_vars \
	import_nomodule \
	kind \
	li_carrays \
	li_cdata \
	li_windows \
	namespace_class \
	namespace_spaces \
	naturalvar \
	operator_overload \
	overload_simple \
	register_par \
	sizet \
	smart_pointer_extend \
	smart_pointer_namespace \
	template \
	template_classes \
	template_default \
	template_default_inherit \
	template_enum \
	template_explicit \
	template_extend_overload \
	template_ns \
	template_ns4 \
	template_ns_enum \
	template_rename \
	template_retvalue \
	template_static \
	template_tbase_template \
	template_typedef \
	template_typedef_cplx \
	template_typedef_cplx2 \
	template_typedef_cplx3 \
	template_typedef_cplx4 \
	template_typedef_cplx5 \
	template_typedef_ns \
	template_typedef_rec \
	threads \
	typedef_array_member \
	typedef_sizet \
	typemap_namespace \
	union_scope \
	using_pointers \
	valuewrapper_opaque \
	varargs \
	virtual_poly \
	voidtest \
	wrapmacro

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

# These are currently unsupported.
CPP_TEST_CASES_ACL_UNSUPPORTED = \
	aggregate \
	contract \
	director_abstract \
	director_basic \
	director_constructor \
	director_detect \
	director_default \
	director_enum \
	director_exception \
	director_frob \
	director_finalizer \
	director_nested \
	director_protected \
	director_redefined \
	director_unroll \
	director_using \
	director_wombat \
	exception_order \
	extern_throws \
	throw_exception
		
C_TEST_CASES_ACL_BROKEN = \
	arrays \
	enums \
	extern_declaration \
	immutable \
	integers \
	li_cdata \
	typemap_subst

C_TEST_BROKEN_LONGLONG = \
	long_long


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

C_TEST_CASES =

CPP_TEST_CASES =

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

# 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: (does nothing, we dont generate extra allegrocl code)
%.clean:
	

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

