LIARC_BOOT_BUNDLES = compiler cref sf star-parser
LIARC_BUNDLES = $(LIARC_BOOT_BUNDLES) edwin ffi imail sos ssp xml
-FFIS = @FFIS@
SUBDIRS = $(INSTALLED_SUBDIRS) 6001 compiler rcs win32 xdoc
-INSTALLED_SUBDIRS = microcode runtime $(LIARC_BUNDLES) $(FFIS)
+INSTALLED_SUBDIRS = microcode runtime $(LIARC_BUNDLES)
MIT_SCHEME_EXE = @MIT_SCHEME_EXE@
AUXDIR_NAME = @AUXDIR_NAME@
all-svm: microcode/svm1-defns.h
$(MAKE) compile-microcode
@$(top_srcdir)/etc/compile-svm.sh "$(MIT_SCHEME_EXE)"
- $(MAKE) build-bands #build-ffis
+ $(MAKE) build-bands
microcode/svm1-defns.h: compiler/machines/svm/svm1-defns.h
@$(top_srcdir)/etc/maybe-update-file.sh \
all-liarc:
@$(top_srcdir)/etc/c-compile.sh "$(MIT_SCHEME_EXE)" --batch-mode
- $(MAKE) compile-liarc-bundles build-bands #build-ffis
-
-build-ffis:
- etc/make-in-subdirs.sh build ffi $(FFIS)
+ $(MAKE) compile-liarc-bundles build-bands
macosx-app: stamp_macosx-app
AC_SUBST([DEFAULT_TARGET])
AC_SUBST([ALL_TARGET])
-AC_SUBST([FFIS])
AC_SUBST([INSTALL_COM])
AC_SUBST([INSTALL_LIARC_BUNDLES])
AC_SUBST([MIT_SCHEME_EXE])
(cd lib; rm -f ${BN}; ${LN_S} ../${BN} .)
done
for BUNDLE in 6001 compiler cref edwin ffi imail sf sos ssp star-parser \
- xdoc xml $FFIS; do
+ xdoc xml; do
SO=${BUNDLE}.so
(cd lib/lib; rm -f ${SO}; ${LN_S} ../../${BUNDLE}/${SO} .)
done
run_make stamp_install-liarc-boot-compiler c-clean distclean
run_configure --enable-native-code=c --disable-host-scheme-test "${@}"
-run_make stamp_compile-liarc-bundles build-bands clean-boot-root #build-ffis
+run_make stamp_compile-liarc-bundles build-bands clean-boot-root
$(INSTALL_DATA) *.bci $(DESTDIR)$(TARGET_DIR)/.
$(INSTALL_DATA) ffi-*.pkd $(DESTDIR)$(TARGET_DIR)/.
$(INSTALL_DATA) make.scm $(DESTDIR)$(TARGET_DIR)/.
-
-# Build a test library interface.
-
-# This target is built after everything else (during build-ffis), and
-# should use the new machine, runtime, etc.
-
-# This interface is for tests/ffi/test-ffi.scm, which uses its own
-# wrapper, so there is no need for the compile-ffi procedure (hint).
-build: ffi-test-shim.so ffi-test-types.bin ffi-test-const.bin
-
-ffi-test-shim.so: ffi-test-shim.o ffi-test.o $(SHIM_LOADER)
- $(LINK_SHIM) ffi-test-shim.o ffi-test.o $(SHIM_LIBS)
-
-ffi-test-shim.o: ffi-test-shim.c ffi-test.h
- $(COMPILE_SHIM) -c $*.c
-
-ffi-test-shim.c ffi-test-const.c ffi-test-types.bin: ffi-test.cdecl
- (echo "(begin"; \
- echo " (load-option 'FFI)"; \
- echo ' (C-generate "ffi-test" "#include \"ffi-test.h\""))') \
- | ../microcode/scheme --library ../lib --batch-mode
-
-ffi-test-const.bin: ffi-test-const.scm
- echo '(sf "ffi-test-const")' \
- | ../microcode/scheme --library ../lib --batch-mode
-
-ffi-test-const.scm: ffi-test-const
- ./ffi-test-const
-
-ffi-test-const: ffi-test-const.o
- @rm -f $@
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ffi-test-const.o
-
-ffi-test-const.o: ffi-test-const.c
- $(CC) $(CFLAGS) -o $@ -c $<
-
-# Finally, the test library itself.
-
-ffi-test.o: ffi-test.c ffi-test.h
- $(COMPILE_SHIM) -o $@ -c $<
-
-ffi-test.c: ffi-test.c.stay
- cp -p ffi-test.c.stay ffi-test.c
-
-.PHONY: build
--- /dev/null
+#-*-Makefile-*-
+# tests/ffi/Makefile
+
+# Build a test library and wrapper.
+
+all: ffi-test-shim.so
+
+HOST=../../src/microcode/scheme --library ../../src/lib --batch-mode
+
+ffi-test-shim.so: ffi-test-shim.o ffi-test.o
+ echo "(link-shim)" | $(HOST) -- -o $@ $^
+
+ffi-test-shim.o: ffi-test-shim.c ffi-test.h
+ echo "(compile-shim)" | $(HOST) -- -c $<
+
+ffi-test-shim.c: ffi-test.cdecl
+ echo '(generate-shim "ffi-test" "#include \"ffi-test.h\"")' | $(HOST)
+
+# The test library itself.
+
+ffi-test.o: ffi-test.c ffi-test.h
+ echo "(compile-shim)" | $(HOST) -- -o $@ -c $<
+
+.PHONY: build
(C-include "ffi-test")
-(define (test-ffi)
+(define test-ffi
+ (let ((libdir (merge-pathnames "./")))
+ (named-lambda (test-ffi)
+ (with-system-library-directories (list libdir)
+ (lambda ()
+ (test-ffi*))))))
+
+(define (test-ffi*)
(let* ((struct (malloc (c-sizeof "TestStruct") '|TestStruct|))
(string "input string")
(pi (* 4 (atan 1 1)))
;;;-*-Scheme-*-
-(load-option 'FFI)
(with-working-directory-pathname (directory-pathname (current-load-pathname))
(lambda ()
- (compile-file "test-ffi-wrapper")
- (load "test-ffi-wrapper")))
+ (let ((code
+ (with-notification
+ (lambda (port)
+ (write-string "make build" port)
+ (newline port))
+ (lambda ()
+ (run-synchronous-subprocess "make" (list "all"))))))
+ (if (not (zero? code))
+ (warn "Test library build failed:" code)
+ (begin
+ (fluid-let ((load/suppress-loading-message? #t))
+ (load-option 'FFI))
+ (with-system-library-directories '("./")
+ (lambda ()
+ (compile-file "test-ffi-wrapper")))
+ (load "test-ffi-wrapper"))))))
+
(define-test 'ffi test-ffi)
\ No newline at end of file