summaryrefslogtreecommitdiff
path: root/Examples/test-suite/ocaml/Makefile.in
blob: 3d72309201239289bd39fa47b6d678189c1939f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#######################################################################
# Makefile for ocaml test-suite
#######################################################################

LANGUAGE     = ocaml
OCAMLP4WHERE =`$(COMPILETOOL) @CAMLP4@ -where`
OCC          =$(COMPILETOOL) @OCAMLC@
OCAMLPP      = -pp "camlp4o ./swigp4.cmo"
VARIANT      = _static
SCRIPTSUFFIX = _runme.ml

srcdir       = @srcdir@
top_srcdir   = @top_srcdir@
top_builddir = @top_builddir@

FAILING_CPP_TESTS = \
allprotected \
apply_signed_char \
apply_strings \
cpp_enum \
default_constructor \
director_binary_string \
director_comparison_operators \
director_enum \
director_primitives \
director_redefined \
director_string \
enum_thorough \
li_windows \
member_pointer_const \
preproc_constants \
smart_pointer_inherit \

FAILING_C_TESTS = \
enums \
preproc_constants_c \

CPP_TEST_CASES += \
	inout \

C_TEST_CASES += \
	multivalue \

ml_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)

run_testcase = \
	if [ -f $(srcdir)/$(ml_runme) ]; then \
		if [ $(srcdir) != . ]; then \
			cp $(srcdir)/$(ml_runme) $(ml_runme); \
		fi ; \
		$(OCC) $(OCAMLPP) -c $(ml_runme) && \
		if [ -f $(top_srcdir)/Examples/test-suite/$*.list ]; then \
			$(OCC) swig.cmo -custom -g -cc '$(CXX)' -o $*_runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./$*_runme; \
		else \
			$(OCC) swig.cmo -custom -g -cc '$(CXX)' -o $*_runme $(*).cmo $(*)_runme.cmo $(*)_wrap.o && $(RUNTOOL) ./$*_runme; \
		fi ; \
	fi ;

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

# Overridden variables here
SWIGOPT += -w524 # Suppress SWIGWARN_LANG_EXPERIMENTAL warning

# 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:
	+$(swig_and_compile_multi_cpp)
	$(setup)
	$(run_testcase)

swig.cmi:
	env SWIG_LIB=$(SWIG_LIB_DIR) $(SWIGEXE) -ocaml -co swig.mli
	$(OCC) -c swig.mli
swig.cmo:
	env SWIG_LIB=$(SWIG_LIB_DIR) $(SWIGEXE) -ocaml -co swig.ml
	$(OCC) -c swig.ml
swigp4.cmi:
	env SWIG_LIB=$(SWIG_LIB_DIR) $(SWIGEXE) -ocaml -co swigp4.ml
	$(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
extra_objects: swig.cmi swig.cmo swigp4.cmi

$(C_TEST_CASES:=.ctest): extra_objects
$(CPP_TEST_CASES:=.cpptest): extra_objects
$(MULTI_CPP_TEST_CASES:=.multicpptest): extra_objects

# Clean
%.clean:
	@rm -f $*.ml $*.mli $*_runme;
	@if test $(srcdir) != .; then rm -f $(ml_runme); fi

clean:
	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' ocaml_clean
	rm -f clientdata_prop_a.ml clientdata_prop_b.ml import_stl_a.ml import_stl_b.ml
	rm -f imports_a.ml imports_b.ml mod_a.ml mod_b.ml multi_import_a.ml
	rm -f multi_import_b.ml packageoption_a.ml packageoption_b.ml packageoption_c.ml