swig/Examples/test-suite/php/Makefile.in
Karl Wette f574a34155 Allow examples and test-suite to be built out of source tree
- Examples/Makefile.in rules use SRCDIR as the relative source directory

- ./config.status replicates Examples/ source directory tree in build
  directory, and copies each Makefile to build directory, prefixed with
  a header which sets SRCDIR to source directory

- Examples/test-suite/.../Makefile.in set SRCDIR from Autoconf-set srcdir

- Examples/test-suite/errors/Makefile.in needs to filter out source
  directory from SWIG error messages

- Lua: embedded interpreters are passed location of run-time test

- Python: copy run-time scripts to build directory because of 2to3
  conversion; import_packages example copies __init__.py from source
  directory; test-suite sets SCRIPTDIR to location of run-time tests

- Javascript: binding.gyp renamed to binding.gyp.in so that $srcdir
  can be substituted with SRCDIR; removed './' from require() statements
  so that NODE_PATH can be used to point Node.js to build directory
2014-05-11 23:21:10 +02:00

77 lines
2.2 KiB
Makefile

#######################################################################
# Makefile for php test-suite
#######################################################################
LANGUAGE = php
SCRIPTDIR = $(srcdir)
SCRIPTSUFFIX = _runme.php
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
ifeq (.,$(srcdir))
SRCDIR =
else
SRCDIR = $(srcdir)/
endif
CPP_TEST_CASES += \
php_namewarn_rename \
include $(srcdir)/../common.mk
# Overridden variables here
TARGETPREFIX =# Should be php_ for Windows, empty otherwise
# Custom tests - tests with additional commandline options
prefix.cpptest: SWIGOPT += -prefix Project
# write out tests without a _runme.php
missingcpptests:
for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done
missingctests:
for test in $(C_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done
missingtests: missingcpptests missingctests
# 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)
# Smart target
%.test:
@echo ' $(C_TEST_CASES) '|grep -F -v ' $* ' >/dev/null ||\
$(MAKE) $*.ctest
@echo ' $(CPP_TEST_CASES) '|grep -F -v ' $* ' >/dev/null ||\
$(MAKE) $*.cpptest
@echo ' $(MULTI_CPP_TEST_CASES) '|grep -F -v ' $* ' >/dev/null ||\
$(MAKE) $*.multicpptest
# Runs the testcase. Tries to run testcase_runme.php, and if that's not
# found, runs testcase.php, except for multicpptests.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL="$(RUNTOOL)" php_run; \
elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php RUNTOOL="$(RUNTOOL)" php_run; \
fi
# Clean: remove the generated .php file
%.clean:
@rm -f $*.php;
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile php_clean