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
This commit is contained in:
William S Fulton 2013-05-09 19:28:09 +01:00
commit dd36f28ac7
8 changed files with 46 additions and 102 deletions

View file

@ -111,7 +111,6 @@ OBJS = $(SRCS:.c=.@OBJEXT@) $(CXXSRCS:.cxx=.@OBJEXT@)
distclean: distclean:
rm -f Makefile rm -f Makefile
rm -f guile/Makefile
rm -f xml/Makefile rm -f xml/Makefile
################################################################## ##################################################################
@ -482,6 +481,14 @@ $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCS)
guile_externalhdr: guile_externalhdr:
$(SWIG) -guile -external-runtime $(TARGET) $(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 # Build statically linked Guile interpreter
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@ -513,10 +520,10 @@ guile_simple_cpp: $(SRCS)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
guile_run: guile_run:
$(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE) env GUILE_AUTO_COMPILE=0 $(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE)
guile_embedded_run: guile_augmented_run:
$(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE) env GUILE_AUTO_COMPILE=0 $(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Version display # Version display

View file

@ -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

View file

@ -1,6 +1,7 @@
This directory contains examples for Guile. This directory contains examples for Guile.
constants -- handling #define and %constant literals constants -- handling #define and %constant literals
class -- classic c++ class example
matrix -- a very simple Matrix example matrix -- a very simple Matrix example
multimap -- typemaps with multiple sub-types multimap -- typemaps with multiple sub-types
multivalue -- using the %values_as_list directive multivalue -- using the %values_as_list directive

View file

@ -1,18 +1,15 @@
SRCS =
TARGET = my-guile
IFILE = example.i
MKDIR = ..
TOP = ../.. TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS =
TARGET = my-guile
INTERFACE = example.i
check: build check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run
build: build:
$(MAKE) -f $(MKDIR)/Makefile \ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SRCS='$(SRCS)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
TARGET=$(TARGET) \
IFILE=$(IFILE) \
sub-all
clean: clean:
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -1,20 +1,15 @@
SRCS = matrix.c vector.c
TARGET = matrix
IFILE = example.i
MKDIR = ..
TOP = ../.. TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = matrix.c vector.c
TARGET = matrix
INTERFACE = example.i
check: build 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: build:
$(MAKE) -f $(MKDIR)/Makefile \ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SRCS='$(SRCS)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
TARGET=$(TARGET) \
IFILE=$(IFILE) \
MODULE=$(MODULE) \
LIBS="-lm" \
sub-all
clean: clean:
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -1,19 +1,16 @@
SRCS = example.c TOP = ../..
TARGET = port SWIG = $(TOP)/../preinst-swig
IFILE = example.i SRCS = example.c
MKDIR = .. TARGET = port
INTERFACE = example.i
check: build check: build
./$(TARGET) -s runme.scm ./$(TARGET) -s runme.scm
build: build:
$(MAKE) -f $(MKDIR)/Makefile \ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SRCS='$(SRCS)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
TARGET=$(TARGET) \
IFILE=$(IFILE) \
MODULE=$(MODULE) \
sub-all
clean: clean:
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean
rm -f test.out rm -f test.out

View file

@ -1,20 +1,15 @@
SRCS = example.c
TARGET = my-guile
IFILE = example.i
MKDIR = ..
TOP = ../.. TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = my-guile
INTERFACE = example.i
check: $(TARGET) check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run
build: $(TARGET) build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
$(TARGET): TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
$(MAKE) -f $(MKDIR)/Makefile \
SRCS='$(SRCS)' \
TARGET=$(TARGET) \
IFILE=$(IFILE) \
sub-all
clean: clean:
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -2397,7 +2397,6 @@ AC_CONFIG_FILES([ \
swig.spec \ swig.spec \
Source/Makefile \ Source/Makefile \
Examples/Makefile \ Examples/Makefile \
Examples/guile/Makefile \
Examples/xml/Makefile \ Examples/xml/Makefile \
Examples/test-suite/chicken/Makefile \ Examples/test-suite/chicken/Makefile \
Examples/test-suite/csharp/Makefile \ Examples/test-suite/csharp/Makefile \