summaryrefslogtreecommitdiff
path: root/Examples/test-suite/d/Makefile.in
blob: 3333df110d1f5d9710fa76cb2760107cc18d7ab4 (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
#######################################################################
# Makefile for D test-suite
#######################################################################

LANGUAGE     = d

srcdir       = @srcdir@
top_srcdir   = ../@top_srcdir@
top_builddir = ../@top_builddir@

ifeq (,$(D_VERSION))
  D_VERSION = @DDEFAULTVERSION@
endif

ifeq (2,$(D_VERSION))
  VERSIONSUFFIX = .2
else
  VERSIONSUFFIX = .1
endif

SCRIPTSUFFIX = _runme$(VERSIONSUFFIX).d

CPP_TEST_CASES = \
	d_nativepointers \
	exception_partial_info

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

# Overridden variables here
SRCDIR       = ../$(srcdir)/
TARGETSUFFIX = _wrap
SWIGOPT+=-splitproxy -package $*

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

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

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

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

# Compiles D files then runs the testcase. A testcase is only run if
# a file is found which has _runme.d appended after the testcase name.
run_testcase = \
	if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
	  cd $*$(VERSIONSUFFIX) && \
	  $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
	  DFLAGS='-of$*_runme' \
	  DSRCS='../$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) `find $* -name *.d`' d_compile && \
	  env LD_LIBRARY_PATH=".:$$LD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme; \
	else \
	  cd $*$(VERSIONSUFFIX) && \
	  $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
	  DFLAGS='-c' \
	  DSRCS='`find $* -name *.d`' d_compile && cd .. ; \
	fi

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