Rewrite chicken example and test-suite building code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5948 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
830e72dba7
commit
acd0b021b1
35 changed files with 315 additions and 844 deletions
|
|
@ -1,49 +1,30 @@
|
|||
TOP = ../..
|
||||
SWIG = $(TOP)/../swig
|
||||
INTERFACE = example.i
|
||||
CHICKSRCS = precsi.c oexample.c
|
||||
SRCS = example.c example_wrap.c
|
||||
CXXSRCS =
|
||||
CHICKGEN = $(CHICKSRCS) csi.c example_wrap.c
|
||||
TARGET = simple
|
||||
INCLUDE =
|
||||
SWIGOPT =
|
||||
CFLAGS =
|
||||
TOP = ../..
|
||||
SWIG = $(TOP)/../preinst-swig
|
||||
INTERFACE = example.i
|
||||
SRCS = example.c
|
||||
CXXSRCS =
|
||||
TARGET = simple
|
||||
INCLUDE =
|
||||
SWIGOPT =
|
||||
CFLAGS =
|
||||
VARIANT =
|
||||
|
||||
# uncomment the following two lines to build a static exe
|
||||
#CHICKEN_MAIN = test-simple.scm
|
||||
#VARIANT = _static
|
||||
|
||||
all:: $(TARGET)
|
||||
|
||||
csi.c:
|
||||
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
|
||||
INTERFACE='precsi' chicken_csi
|
||||
|
||||
precsi.c: precsi.scm
|
||||
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
|
||||
INTERFACE='$<' chicken_chicken
|
||||
|
||||
example_wrap.c example.scm: example.i
|
||||
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
|
||||
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_swig_c
|
||||
|
||||
oexample.c: example.scm
|
||||
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
|
||||
INTERFACE='$<' chicken_chicken
|
||||
|
||||
$(TARGET): csi.c $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
||||
$(TARGET): $(INTERFACE) $(SRCS)
|
||||
$(MAKE) -f $(TOP)/Makefile \
|
||||
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
|
||||
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
|
||||
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
|
||||
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_static
|
||||
|
||||
module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
||||
$(MAKE) -f $(TOP)/Makefile \
|
||||
CHICKSRCS='$(CHICKSRCS)' SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \
|
||||
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='module' \
|
||||
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' chicken_module
|
||||
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
|
||||
|
||||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: module
|
||||
check::
|
||||
csi -batch simple.so test-simple.scm
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
(declare (unit precsi))
|
||||
(declare (uses example))
|
||||
|
||||
;; display prelude to csi
|
||||
(display "simple\n\n")
|
||||
|
||||
(display " A SWIG example for the CHICKEN compiler\n")
|
||||
(display " Author: Jonah Beckford, December 2002\n\n")
|
||||
|
||||
(display "C Procedures:\n")
|
||||
(display " double My_variable;\n")
|
||||
(display " int fact(int);\n")
|
||||
(display " %name(mod) int my_mod(int n, int m);\n")
|
||||
(display " int my_mod(int n, int m);\n")
|
||||
(display " char *get_time();\n")
|
||||
|
||||
(display "\n")
|
||||
|
||||
(display "Scheme Procedures:\n")
|
||||
(display " (example:My-variable) or (example:My-variable %x)\n");
|
||||
(display " (example:fact %n)\n")
|
||||
(display " (example:mod %n %m)\n")
|
||||
(display " (example:my-mod %n %m)\n")
|
||||
(display " (example:get-time)\n")
|
||||
(display "\n")
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
;; run with './simple test-simple.scm'
|
||||
;; feel free to uncomment and comment sections
|
||||
(declare (uses example))
|
||||
|
||||
(display "(example:My-variable): ")
|
||||
(display (example:My-variable))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue