From: Matt Birkholz Date: Sat, 7 Sep 2013 04:33:06 +0000 (-0700) Subject: src/Makefile.in: Punt $(FFIS) and build-ffis target. X-Git-Tag: release-9.2.0~127 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f4d45738bef8ceab8178ecc67c76844008c4d84e;p=mit-scheme.git src/Makefile.in: Punt $(FFIS) and build-ffis target. Moved the test wrapper to tests/ffi/ though it is still commented out of tests/check.scm. --- diff --git a/src/Makefile.in b/src/Makefile.in index f7ee15394..4ce49f754 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -62,10 +62,9 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/microcode/mkinstalldirs 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@ @@ -253,7 +252,7 @@ compile-xml: compile-star-parser 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 \ @@ -272,10 +271,7 @@ compiler/machines/svm/svm1-defns.h: \ 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 diff --git a/src/configure.ac b/src/configure.ac index 27bdea69f..601a4bd9a 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -151,7 +151,6 @@ fi 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]) @@ -207,7 +206,7 @@ if test x"${mit_scheme_native_code}" = xc; then (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 diff --git a/src/etc/make-liarc.sh b/src/etc/make-liarc.sh index 3f6db20d2..ee370c61e 100755 --- a/src/etc/make-liarc.sh +++ b/src/etc/make-liarc.sh @@ -56,4 +56,4 @@ run_configure --prefix=`pwd`/boot-root --enable-native-code=c \ 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 diff --git a/src/ffi/Makefile-fragment b/src/ffi/Makefile-fragment index f16a50c6b..b2e68b7d4 100644 --- a/src/ffi/Makefile-fragment +++ b/src/ffi/Makefile-fragment @@ -11,48 +11,3 @@ install: $(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 diff --git a/tests/ffi/Makefile b/tests/ffi/Makefile new file mode 100644 index 000000000..ca4ecbbe9 --- /dev/null +++ b/tests/ffi/Makefile @@ -0,0 +1,24 @@ +#-*-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 diff --git a/src/ffi/ffi-test.c.stay b/tests/ffi/ffi-test.c similarity index 100% rename from src/ffi/ffi-test.c.stay rename to tests/ffi/ffi-test.c diff --git a/src/ffi/ffi-test.cdecl b/tests/ffi/ffi-test.cdecl similarity index 100% rename from src/ffi/ffi-test.cdecl rename to tests/ffi/ffi-test.cdecl diff --git a/src/ffi/ffi-test.h b/tests/ffi/ffi-test.h similarity index 100% rename from src/ffi/ffi-test.h rename to tests/ffi/ffi-test.h diff --git a/tests/ffi/test-ffi-wrapper.scm b/tests/ffi/test-ffi-wrapper.scm index 59caba116..54e444b59 100644 --- a/tests/ffi/test-ffi-wrapper.scm +++ b/tests/ffi/test-ffi-wrapper.scm @@ -2,7 +2,14 @@ (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))) diff --git a/tests/ffi/test-ffi.scm b/tests/ffi/test-ffi.scm index 1240038c1..3b1b7b57d 100644 --- a/tests/ffi/test-ffi.scm +++ b/tests/ffi/test-ffi.scm @@ -1,8 +1,22 @@ ;;;-*-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