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

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

View file

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

View file

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

View file

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

View file

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

View file

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