From dd36f28ac7b28ecb78736894796bdcab9d945e07 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 9 May 2013 19:28:09 +0100 Subject: [PATCH] Migrate Guile examples build into common Examples makefile - Now Guile examples are built in a consistent way to other target languages. - Also set GUILE_AUTO_COMPILE=0 to remove auto-compilation is enabled warnings --- Examples/Makefile.in | 15 +++++++--- Examples/guile/Makefile.in | 47 ------------------------------- Examples/guile/README | 1 + Examples/guile/constants/Makefile | 19 ++++++------- Examples/guile/matrix/Makefile | 21 ++++++-------- Examples/guile/port/Makefile | 19 ++++++------- Examples/guile/simple/Makefile | 25 +++++++--------- configure.ac | 1 - 8 files changed, 46 insertions(+), 102 deletions(-) delete mode 100644 Examples/guile/Makefile.in diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 20f1cfea6..5d521f5a1 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -111,7 +111,6 @@ OBJS = $(SRCS:.c=.@OBJEXT@) $(CXXSRCS:.cxx=.@OBJEXT@) distclean: rm -f Makefile - rm -f guile/Makefile rm -f xml/Makefile ################################################################## @@ -482,6 +481,14 @@ $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCS) guile_externalhdr: $(SWIG) -guile -external-runtime $(TARGET) +# ----------------------------------------------------------------- +# Build Guile interpreter augmented with extra functions +# ----------------------------------------------------------------- + +guile_augmented: + $(SWIG) -guile $(SWIGOPT) $(INTERFACE) + $(CC) $(CFLAGS) $(SRCS) $(ISRCS) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) -o $(TARGET) + # ----------------------------------------------------------------- # Build statically linked Guile interpreter # ----------------------------------------------------------------- @@ -513,10 +520,10 @@ guile_simple_cpp: $(SRCS) # ----------------------------------------------------------------- guile_run: - $(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE) + env GUILE_AUTO_COMPILE=0 $(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE) -guile_embedded_run: - $(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE) +guile_augmented_run: + env GUILE_AUTO_COMPILE=0 $(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display diff --git a/Examples/guile/Makefile.in b/Examples/guile/Makefile.in deleted file mode 100644 index f84d54a38..000000000 --- a/Examples/guile/Makefile.in +++ /dev/null @@ -1,47 +0,0 @@ -# Makefile for Guile. Used by all of the example programs. - -subdirs = simple matrix port constants multimap multivalue - -top_srcdir = @top_srcdir@ -SWIG = ../$(top_srcdir)/preinst-swig -CC = @CC@ -CXX = @CXX@ -CFLAGS = @PLATFLAGS@ -LIBS = -GUILE = @GUILE@ -GUILE_CFLAGS = @GUILE_CFLAGS@ -GUILE_LIBS = @GUILE_LIBS@ -SWIGOPT = - -WRAP = $(IFILE:.i=_wrap.c) -CXXWRAP = $(IFILE:.i=_wrap.cxx) - -SO = @SO@ - -all: - for d in $(subdirs) ; do (cd $$d ; $(MAKE)) ; done - -clean: - for d in $(subdirs) ; do (cd $$d ; $(MAKE) clean) ; done - rm -f *~ .~* - -guile_clean: - rm -f *.@OBJEXT@ *$(SO) *_wrap* *~ .~* core my-guile $(TARGET) - -# This is meant to be used w/ "make -f ../Makefile" from subdirs. -# Doesn't make sense to use it from here. - -sub-all: - $(SWIG) -guile $(SWIGOPT) $(IFILE) - $(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(WRAP) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) - -sub-all-cxx: - $(SWIG) -c++ -guile $(SWIGOPT) $(IFILE) - $(CXX) $(CFLAGS) -o $(TARGET) $(SRCS) $(CXXWRAP) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) - -run_example: - if [ -f $(RUNSCRIPT) ]; then \ - env GUILE_AUTO_COMPILE=0 LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(RUNSCRIPT); \ - fi - -# Makefile ends here diff --git a/Examples/guile/README b/Examples/guile/README index 7d726619e..03ce8e450 100644 --- a/Examples/guile/README +++ b/Examples/guile/README @@ -1,6 +1,7 @@ This directory contains examples for Guile. constants -- handling #define and %constant literals +class -- classic c++ class example matrix -- a very simple Matrix example multimap -- typemaps with multiple sub-types multivalue -- using the %values_as_list directive diff --git a/Examples/guile/constants/Makefile b/Examples/guile/constants/Makefile index 5e60d9b34..d8a3cfebd 100644 --- a/Examples/guile/constants/Makefile +++ b/Examples/guile/constants/Makefile @@ -1,18 +1,15 @@ -SRCS = -TARGET = my-guile -IFILE = example.i -MKDIR = .. TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = +TARGET = my-guile +INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run build: - $(MAKE) -f $(MKDIR)/Makefile \ - SRCS='$(SRCS)' \ - TARGET=$(TARGET) \ - IFILE=$(IFILE) \ - sub-all + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/matrix/Makefile b/Examples/guile/matrix/Makefile index 3d488f6f6..8a6ff81de 100644 --- a/Examples/guile/matrix/Makefile +++ b/Examples/guile/matrix/Makefile @@ -1,20 +1,15 @@ -SRCS = matrix.c vector.c -TARGET = matrix -IFILE = example.i -MKDIR = .. TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = matrix.c vector.c +TARGET = matrix +INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_embedded_run + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_augmented_run build: - $(MAKE) -f $(MKDIR)/Makefile \ - SRCS='$(SRCS)' \ - TARGET=$(TARGET) \ - IFILE=$(IFILE) \ - MODULE=$(MODULE) \ - LIBS="-lm" \ - sub-all + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/port/Makefile b/Examples/guile/port/Makefile index 0088dd92f..ec5d5198a 100644 --- a/Examples/guile/port/Makefile +++ b/Examples/guile/port/Makefile @@ -1,19 +1,16 @@ -SRCS = example.c -TARGET = port -IFILE = example.i -MKDIR = .. +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = port +INTERFACE = example.i check: build ./$(TARGET) -s runme.scm build: - $(MAKE) -f $(MKDIR)/Makefile \ - SRCS='$(SRCS)' \ - TARGET=$(TARGET) \ - IFILE=$(IFILE) \ - MODULE=$(MODULE) \ - sub-all + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean rm -f test.out diff --git a/Examples/guile/simple/Makefile b/Examples/guile/simple/Makefile index 66c7e26af..da4eb9015 100644 --- a/Examples/guile/simple/Makefile +++ b/Examples/guile/simple/Makefile @@ -1,20 +1,15 @@ -SRCS = example.c -TARGET = my-guile -IFILE = example.i -MKDIR = .. TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = my-guile +INTERFACE = example.i -check: $(TARGET) - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run +check: build + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run -build: $(TARGET) - -$(TARGET): - $(MAKE) -f $(MKDIR)/Makefile \ - SRCS='$(SRCS)' \ - TARGET=$(TARGET) \ - IFILE=$(IFILE) \ - sub-all +build: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean diff --git a/configure.ac b/configure.ac index a618d55de..968764715 100644 --- a/configure.ac +++ b/configure.ac @@ -2397,7 +2397,6 @@ AC_CONFIG_FILES([ \ swig.spec \ Source/Makefile \ Examples/Makefile \ - Examples/guile/Makefile \ Examples/xml/Makefile \ Examples/test-suite/chicken/Makefile \ Examples/test-suite/csharp/Makefile \