summaryrefslogtreecommitdiff
path: root/Examples/test-suite/csharp/Makefile.in
blob: 5fd576ed8a0fa76cf4ee07c7e34eac1db0ea1564 (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
#######################################################################
# Makefile for C# test-suite
#######################################################################

LANGUAGE     = csharp
SCRIPTSUFFIX = _runme.cs
INTERPRETER  = @CSHARPCILINTERPRETER@
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
CSHARPCYGPATH_W     = @CSHARPCYGPATH_W@
srcdir       = @srcdir@
top_srcdir   = @top_srcdir@/..
top_builddir = @top_builddir@/..

CPP_TEST_CASES = \
	csharp_attributes \
	csharp_exceptions \
	csharp_features \
	csharp_prepost \
	csharp_typemaps \
	enum_thorough_simple \
	enum_thorough_typesafe \
	exception_partial_info

CUSTOM_TEST_CASES = intermediary_classname

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

# Overridden variables here
SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)

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

%.ctest:
	$(setup)
	+(cd $* && $(swig_and_compile_c))
	+$(run_testcase)

%.multicpptest: 
	$(setup)
	+(cd $* && $(swig_and_compile_multi_cpp))
	+$(run_testcase)

# Rules for custom tests
intermediary_classname.customtest: 
	$(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname"

# Makes a directory for the testcase if it does not exist
setup = \
	if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then	  \
	  echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \
	else								  \
	  echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ;		  \
	fi;								  \
	if [ ! -d $* ]; then						  \
		mkdir $*;						  \
	fi;

# Compiles C# files then runs the testcase. A testcase is only run if
# a file is found which has _runme.cs appended after the testcase name.
# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
run_testcase = \
	if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then (	  \
	  $(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
	  CSHARPFLAGS='-nologo -out:$*_runme.exe' \
	  CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` \
	  $*$(CSHARPPATHSEPARATOR)*.cs' csharp_compile && \
	  env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" $(RUNTOOL) $(INTERPRETER) $*_runme.exe; ) \
	else ( \
	  cd $* && \
	  $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
	  CSHARPFLAGS='-nologo -t:module -out:$*.netmodule' \
	  CSHARPSRCS='*.cs' csharp_compile; ); \
	fi;

# Clean: remove testcase directories
%.clean:
	@if [ -d $* ]; then \
		rm -rf $*; \
	fi;

clean:
	@rm -f *.exe *.exe.mdb