summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2015-08-18 07:36:21 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2015-08-18 08:00:01 +0100
commitca1431f4cf1671961a1e012c4042bb90c152181f (patch)
treeafcdfffe60820168ddd21274b02d6ced01514553
parent1fca8109897ecd2d25a49905033ed296b384eec4 (diff)
downloadswig-ca1431f4cf1671961a1e012c4042bb90c152181f.tar.gz
Prototype removal of swig-preinst in the test-suite and examples
Prototype for Java test-suite and Java class example. SWIG_LIB_DIR and SWIGEXE must now instead be set by all Makefiles. SWIG_LIB is explicitly set where necessary. Allows use of 'make SWIGTOOL="gdb --args"' to work as gdb can't be used to debug a shell script, for both examples and test-suite. See issue #473.
-rw-r--r--Examples/Makefile.in8
-rw-r--r--Examples/java/class/Makefile6
-rw-r--r--Examples/test-suite/common.mk14
-rw-r--r--configure.ac14
4 files changed, 32 insertions, 10 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 94f7c63b9..66a76e2df 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -58,7 +58,13 @@ INTERFACE =
INTERFACEDIR =
INTERFACEPATH = $(SRCDIR)$(INTERFACEDIR)$(INTERFACE)
SWIGOPT =
-SWIG = swig
+
+# SWIG_LIB_DIR and SWIGEXE must be explicitly set by Makefiles using this Makefile
+SWIG_LIB_DIR = ./Lib
+SWIGEXE = swig
+SWIG_LIB_SET = @SWIG_LIB_SET@
+SWIGTOOL =
+SWIG = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
LIBM = @LIBM@
LIBC = @LIBC@
diff --git a/Examples/java/class/Makefile b/Examples/java/class/Makefile
index 13cfd1708..faed36e71 100644
--- a/Examples/java/class/Makefile
+++ b/Examples/java/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR="$(SWIG_LIB_DIR)" SWIGEXE="$(SWIGEXE)" \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index cc1ec7464..c4e9138d6 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -56,8 +56,8 @@ endif
COMPILETOOL=
SWIGTOOL =
-SWIG = $(SWIGTOOL) $(top_builddir)/preinst-swig
-SWIG_LIB = $(top_srcdir)/Lib
+SWIGEXE = $(top_builddir)/swig
+SWIG_LIB_DIR = $(top_srcdir)/Lib
TEST_SUITE = test-suite
EXAMPLES = Examples
CXXSRCS =
@@ -708,14 +708,14 @@ partialcheck:
swig_and_compile_cpp = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ SWIG_LIB_DIR="$(SWIG_LIB_DIR)" SWIGEXE="$(SWIGEXE)" \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)_cpp
swig_and_compile_c = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CSRCS="$(CSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ SWIG_LIB_DIR="$(SWIG_LIB_DIR)" SWIGEXE="$(SWIGEXE)" \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)
@@ -723,7 +723,7 @@ swig_and_compile_c = \
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
+ SWIG_LIB_DIR="$(SWIG_LIB_DIR)" SWIGEXE="$(SWIGEXE)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
@@ -731,11 +731,11 @@ swig_and_compile_multi_cpp = \
swig_and_compile_external = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ SWIG_LIB_DIR="$(SWIG_LIB_DIR)" SWIGEXE="$(SWIGEXE)" \
TARGET="$*_wrap_hdr.h" \
$(LANGUAGE)$(VARIANT)_externalhdr; \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS) $*_external.cxx" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ SWIG_LIB_DIR="$(SWIG_LIB_DIR)" SWIGEXE="$(SWIGEXE)" \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)_cpp
diff --git a/configure.ac b/configure.ac
index 74235204e..e01e75170 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2939,6 +2939,19 @@ else
fi
AC_SUBST(SWIG_LIB_PREINST)
+dnl For testing purposes, clear SWIG_LIB when building SWIG in the source
+dnl directory under Windows because it is supposed to work without SWIG_LIB
+dnl being set. Otherwise it always needs to be set.
+SWIG_LIB_SET="env SWIG_LIB=\$(SWIG_LIB_DIR)"
+if test "${srcdir}" = "."; then
+ AC_EGREP_CPP([yes],
+ [#ifdef _WIN32
+ yes
+ #endif
+ ], [SWIG_LIB_SET="env SWIG_LIB="], [])
+fi
+AC_SUBST(SWIG_LIB_SET)
+
AC_CONFIG_FILES([
Makefile
swig.spec
@@ -3000,6 +3013,7 @@ AC_CONFIG_COMMANDS([Examples],[
cat <<EOF >${mkfile}
# DO NOT EDIT: instead edit ${relsrcdir}${mkfile}
# and run (cd ${reldir} && ./config.status) to regenerate
+TOP_BUILDDIR_TO_TOP_SRCDIR = ${srcdir}/
SRCDIR = ${relsrcdir}${dir}/
EOF