swig/Examples/test-suite/c/Makefile.in
2008-07-21 10:55:05 +00:00

65 lines
1.7 KiB
Makefile

#######################################################################
# Makefile for C test-suite
#######################################################################
LANGUAGE = c
C = gcc
CXX = g++
SCRIPTSUFFIX = _runme.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@/..
top_builddir = @top_builddir@/..
C_TEST_CASES =
CPP_TEST_CASES = \
exception_order \
exception_partial_info \
enums \
enum_plus \
include $(srcdir)/../common.mk
# 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)
# 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.c appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then (\
cd $* && $(COMPILETOOL) $(CC) ../$*_runme.c $*_proxy.c -L. -l$* -o $*_runme && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_LIBRARY_PATH="$*:$$DYLD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme;) \
fi;
# Clean: remove testcase directories
%.clean:
@if [ -d $* ]; then \
rm -rf $*; \
fi;
clean:
@rm -f *_wrap.* *_proxy.* *~ *.exe *.dll *.so *.out *runme