summaryrefslogtreecommitdiff
path: root/Examples/test-suite/javascript/Makefile.in
blob: 7368ea9a31f6bf5f62bab21a9ab9924e7b28e2e6 (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
108
109
110
111
112
113
114
#######################################################################
# Makefile for javascript test-suite
#######################################################################

LANGUAGE     = javascript
NODEGYP = @NODEGYP@
SCRIPTSUFFIX = _runme.js
srcdir       = @srcdir@
top_srcdir   = @top_srcdir@
top_builddir = @top_builddir@
SWIG  = $(top_builddir)/preinst_swig

ifneq (, $(ENGINE))
	JSENGINE=$(ENGINE)
else
	JSENGINE=node
endif

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

_setup = \
	if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then	  \
	  echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
	else								  \
	  echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ;     \
	fi;

ifneq (jsc,$(ENGINE))

  # This test can not be run with v8 as it uses v8 API incompatible output typemaps
  typemap_variables.cpptest:
	  echo "skipping $(LANGUAGE) ($(JSENGINE)) testcase typemap_variables" ;

endif

ifeq (node,$(JSENGINE))

  SWIGOPT += -v8 -DBUILDING_NODE_EXTENSION=1

  # shut up some warnings
  # contract macro has an empty 'else' at the end...
  aggregate.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"
  contract.cpptest: GYP_CFLAGS = \"-Wno-empty-body\"

  # dunno... ignoring generously
  apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
  constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
  enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"

	# Note: we need to use swig in C parse mode, but make node-gyp believe it is c++ (via file extension)
	swig_and_compile_c = \
		sh ./setup_test.sh $* $(GYP_CFLAGS); \
		$(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx ../$*.i; \
		$(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null

	swig_and_compile_cpp = \
		sh ./setup_test.sh $* $(GYP_CFLAGS); \
		$(SWIG) -c++ -javascript $(SWIGOPT) ../$*.i; \
		$(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null

	run_testcase = \
		if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
			node $(srcdir)/$*$(SCRIPTSUFFIX); \
		fi


  %.ctest:
		$(_setup)
		$(swig_and_compile_c)
		$(run_testcase)

  %.cpptest:
		$(_setup)
		$(swig_and_compile_cpp)
		$(run_testcase)

  %.multicpptest:
		$(_setup)

else

  SWIGOPT += -$(JSENGINE)

	run_testcase = \
		if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
			$(top_srcdir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \
		fi

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

  %.cpptest:
		$(_setup)
		+$(swig_and_compile_cpp)
		$(run_testcase)

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

endif


%.clean:
	rm -rf $*

clean:
	rm -f *_wrap.cxx
	rm -f *_wrap.c
	rm -f *.so
	rm -f *.o