From: Chris Hanson Date: Mon, 14 May 2007 16:51:00 +0000 (+0000) Subject: Move building of LIARC bundles into their respective directories. X-Git-Tag: 20090517-FFI~568 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6016297bfd73e2bb7012842271143b92952f73ac;p=mit-scheme.git Move building of LIARC bundles into their respective directories. Create bundle file lists from .pkg files rather than from directory listings. Change "make c" to "make liarc-dist". Restructure top-level makefile to generate "liarc-dist" in distinct stages: (1) build a compiler in the directory "boot-lib"; (2) run c-clean to discard all .c files; and (3) rebuild everything using boot-lib compiler. Delete "Makefile.std"; generate all subdirectory makefiles (except microcode) using "Makefile-fragment" and standard prefix/suffix. Rename COMPILE_FOR_DYNAMIC_LOADING to ENABLE_LIARC_FILE_INIT. Don't build 6001 or xdoc subdirs. Use -fPIC only for shared objects, not for scheme executable. Make sure -fPIC is given to linker as well as compiler. --- diff --git a/v7/src/6001/Makefile-fragment b/v7/src/6001/Makefile-fragment new file mode 100644 index 000000000..445af7383 --- /dev/null +++ b/v7/src/6001/Makefile-fragment @@ -0,0 +1 @@ +install: diff --git a/v7/src/Clean.sh b/v7/src/Clean.sh index 3fdeb712a..6d83df255 100755 --- a/v7/src/Clean.sh +++ b/v7/src/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.15 2007/05/06 14:16:44 cph Exp $ +# $Id: Clean.sh,v 1.16 2007/05/14 16:50:31 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -38,26 +38,20 @@ shift SUBDIRS=${@} FULL=no -C=no DIST=no MAINTAINER=no case ${COMMAND} in mostlyclean) ;; -clean) +clean | c-clean) FULL=yes ;; -c-clean) - FULL=yes - C=yes - ;; distclean) FULL=yes DIST=yes ;; maintainer-clean) FULL=yes - C=yes DIST=yes MAINTAINER=yes ;; @@ -75,16 +69,12 @@ if [ ${FULL} = yes ]; then maybe_rm lib/*.com fi -if [ ${C} = yes ]; then - maybe_rm liarc.stamp -fi - if [ ${DIST} = yes ]; then - maybe_rm Makefile config.cache config.log config.status + maybe_rm Makefile boot-lib config.cache config.log config.status fi if [ ${MAINTAINER} = yes ]; then - maybe_rm configure lib autom4te.cache + maybe_rm autom4te.cache configure liarc.stamp lib fi for SUBDIR in ${SUBDIRS}; do diff --git a/v7/src/Makefile.in b/v7/src/Makefile.in index 345a3d8ac..781578893 100644 --- a/v7/src/Makefile.in +++ b/v7/src/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.37 2007/05/09 20:01:36 cph Exp $ +# $Id: Makefile.in,v 1.38 2007/05/14 16:50:33 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -61,47 +61,89 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs # **** END BOILERPLATE **** -SUBDIRS = 6001 compiler rcs sf win32 $(INSTALLED_SUBDIRS) -INSTALLED_SUBDIRS = microcode runtime cref edwin imail sos ssp star-parser \ - xdoc xml +SUBDIRS_1 = cref sf star-parser +SUBDIRS_2 = edwin imail sos ssp xml + +SUBDIRS = $(INSTALLED_SUBDIRS) 6001 compiler rcs win32 xdoc +INSTALLED_SUBDIRS = microcode runtime $(SUBDIRS_1) $(SUBDIRS_2) + +LIARC_BOOT_BUNDLES = $(SUBDIRS_1) compiler +LIARC_BUNDLES = $(LIARC_BOOT_BUNDLES) $(SUBDIRS_2) AUXDIR = @AUXDIR@ EDETC = $(AUXDIR)/edwin/etc -all: all-microcode @ALL_TARGET@ all-bands +all: compile-microcode @ALL_TARGET@ build-bands + +compile-microcode: + (cd microcode && $(MAKE) all) -all-microcode: - ( cd microcode && $(MAKE) all ) +build-bands: + @$(top_srcdir)/etc/build-bands.sh all-native: - $(srcdir)/etc/compile.sh + @$(top_srcdir)/etc/compile.sh -all-c: - $(srcdir)/etc/c-compile.sh - ( cd microcode && $(MAKE) liarc-bundles ) -all-bands: - $(srcdir)/etc/build-bands.sh +liarc-dist: liarc-stamp distclean + +c-boot-compiler.com: + @$(top_srcdir)/etc/c-boot-compiler.sh mit-scheme $@ -c: c-boot-compiler.com - $(srcdir)/etc/c-prepare.sh mit-scheme --band $< - -rm -f liarc.stamp +liarc-stamp: c-boot-compiler.com + @$(top_srcdir)/etc/c-prepare.sh mit-scheme --band $< echo "done" > liarc.stamp -native: native-boot-compiler.com - $(srcdir)/etc/compile.sh mit-scheme-c --band $< -c-boot-compiler.com: - $(srcdir)/etc/c-boot-compiler.sh mit-scheme $@ +all-c: liarc-compile-scheme + $(MAKE) compile-microcode + $(MAKE) compile-liarc-bundles + rm -rf boot-lib + +liarc-compile-scheme: boot-lib/compiler.com c-clean + @$(top_srcdir)/etc/c-compile.sh boot-lib/scheme --library boot-lib \ + --band boot-lib/compiler.com + +boot-lib/compiler.com: compile-microcode compile-liarc-boot-bundles + $(mkinstalldirs) boot-lib boot-lib/include boot-lib/lib + $(INSTALL_DATA) $(top_srcdir)/etc/optiondb.scm boot-lib/. + $(INSTALL_PROGRAM) microcode/scheme boot-lib/. + $(INSTALL_PROGRAM) microcode/liarc-cc boot-lib/. + $(INSTALL_PROGRAM) microcode/liarc-ld boot-lib/. + $(INSTALL_DATA) microcode/*.h boot-lib/include/. + @for BN in $(LIARC_BOOT_BUNDLES); do \ + CMD="$(INSTALL_DATA) $${BN}/$${BN}.so boot-lib/lib/.";\ + echo "$${CMD}"; eval "$${CMD}";\ + done + @$(top_srcdir)/etc/c-boot-compiler-2.sh boot-lib boot-lib/compiler.com + +compile-liarc-boot-bundles: + @for BN in $(LIARC_BOOT_BUNDLES); do \ + CMD="(cd $${BN} && $(MAKE) liarc-bundle)";\ + echo "$${CMD}"; eval "$${CMD}";\ + done + +compile-liarc-bundles: + @for BN in $(LIARC_BUNDLES); do \ + CMD="(cd $${BN} && $(MAKE) liarc-bundle)";\ + echo "$${CMD}"; eval "$${CMD}";\ + done + + + +native: native-boot-compiler.com + @$(top_srcdir)/etc/compile.sh mit-scheme-c --band $< native-boot-compiler.com: - $(srcdir)/etc/c-boot-compiler.sh mit-scheme-c $@ + @$(top_srcdir)/etc/c-boot-compiler.sh mit-scheme-c $@ + + mostlyclean clean distclean maintainer-clean c-clean: - $(srcdir)/Clean.sh $@ $(SUBDIRS) + $(top_srcdir)/Clean.sh $@ $(SUBDIRS) tags TAGS: - $(srcdir)/Tags.sh $(SUBDIRS) + $(top_srcdir)/Tags.sh $(SUBDIRS) install: @for SUBDIR in $(INSTALLED_SUBDIRS); do \ @@ -110,11 +152,14 @@ install: done $(mkinstalldirs) $(DESTDIR)$(AUXDIR) - $(INSTALL_DATA) $(srcdir)/lib/optiondb.scm $(DESTDIR)$(AUXDIR)/. - $(INSTALL_DATA) $(srcdir)/lib/*.com $(DESTDIR)$(AUXDIR)/. + $(INSTALL_DATA) $(top_srcdir)/etc/optiondb.scm $(DESTDIR)$(AUXDIR)/. + $(INSTALL_DATA) lib/*.com $(DESTDIR)$(AUXDIR)/. $(mkinstalldirs) $(DESTDIR)$(EDETC) - $(INSTALL_DATA) $(srcdir)/etc/TUTORIAL $(DESTDIR)$(EDETC)/. + $(INSTALL_DATA) $(top_srcdir)/etc/TUTORIAL $(DESTDIR)$(EDETC)/. -.PHONY: all all-microcode all-native all-c all-bands c native install -.PHONY: mostlyclean clean distclean maintainer-clean c-clean tags TAGS +.PHONY: all compile-microcode build-bands all-native +.PHONY: liarc-dist all-c liarc-compile-scheme compile-liarc-boot-bundles +.PHONY: compile-liarc-bundles native +.PHONY: mostlyclean clean distclean maintainer-clean c-clean +.PHONY: tags TAGS install diff --git a/v7/src/Setup.sh b/v7/src/Setup.sh index 8ed68f6d7..ddd3d674c 100755 --- a/v7/src/Setup.sh +++ b/v7/src/Setup.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Setup.sh,v 1.24 2007/05/09 20:01:36 cph Exp $ +# $Id: Setup.sh,v 1.25 2007/05/14 16:50:34 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -43,7 +43,6 @@ maybe_link lib/include ../microcode maybe_link lib/optiondb.scm ../etc/optiondb.scm maybe_link lib/options ../runtime maybe_link lib/utabmd.bin ../microcode/utabmd.bin -maybe_link lib/include ../microcode # lib/edwin maybe_mkdir lib/edwin @@ -52,15 +51,30 @@ maybe_link lib/edwin/etc/TUTORIAL ../../../etc/TUTORIAL maybe_link lib/edwin/etc/mime.types ../../../etc/mime.types maybe_link lib/edwin/autoload ../../edwin -for SUBDIR in 6001 compiler cref edwin imail rcs runtime \ - sf sos ssp star-parser win32 xdoc xml microcode; do +BUNDLES="6001 compiler cref edwin imail sf sos ssp star-parser xdoc xml" + +for SUBDIR in ${BUNDLES} runtime win32 microcode; do echo "setting up ${SUBDIR}" - if [ -f ${SUBDIR}/Makefile-fragment ]; then - rm -f ${SUBDIR}/Makefile.in - cat etc/std-makefile-prefix \ - ${SUBDIR}/Makefile-fragment \ - etc/std-makefile-suffix > ${SUBDIR}/Makefile.in - fi maybe_link ${SUBDIR}/Setup.sh ../etc/Setup.sh - ( cd ${SUBDIR} && ./Setup.sh "$@" ) + (cd ${SUBDIR} && ./Setup.sh "$@") +done + +maybe_link compiler/compiler.pkg machines/C/compiler.pkg +mit-scheme --heap 4000 < ${SUBDIR}/Makefile.in + cat ${SUBDIR}/Makefile-fragment >> ${SUBDIR}/Makefile.in + if [ -f ${SUBDIR}/Makefile-bundle ]; then + cat ${SUBDIR}/Makefile-bundle >> ${SUBDIR}/Makefile.in + rm -f ${SUBDIR}/Makefile-bundle + fi + cat etc/std-makefile-suffix >> ${SUBDIR}/Makefile.in done diff --git a/v7/src/compiler/Makefile-fragment b/v7/src/compiler/Makefile-fragment new file mode 100644 index 000000000..445af7383 --- /dev/null +++ b/v7/src/compiler/Makefile-fragment @@ -0,0 +1 @@ +install: diff --git a/v7/src/compiler/machines/C/ctop.scm b/v7/src/compiler/machines/C/ctop.scm index 3a2a886aa..8a2c95fb2 100644 --- a/v7/src/compiler/machines/C/ctop.scm +++ b/v7/src/compiler/machines/C/ctop.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: ctop.scm,v 1.27 2007/05/09 02:05:50 cph Exp $ +$Id: ctop.scm,v 1.28 2007/05/14 16:50:37 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -126,7 +126,8 @@ USA. (run-shell-command command))))))) (run (system-library-pathname "liarc-cc") (pathname-new-type pathname "o") - pathname) + pathname + "-DENABLE_LIARC_FILE_INIT") (run (system-library-pathname "liarc-ld") (pathname-new-type pathname (c-output-extension)) (pathname-new-type pathname "o")))) diff --git a/v7/src/configure.ac b/v7/src/configure.ac index 6a92bb6ee..6f6c75f07 100644 --- a/v7/src/configure.ac +++ b/v7/src/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT([MIT/GNU Scheme], [7.7.91], [bug-mit-scheme@gnu.org], [mit-scheme]) -AC_REVISION([$Id: configure.ac,v 1.12 2007/05/09 02:05:32 cph Exp $]) +AC_REVISION([$Id: configure.ac,v 1.13 2007/05/14 16:50:32 cph Exp $]) AC_CONFIG_SRCDIR([microcode/boot.c]) AC_PROG_MAKE_SET @@ -65,13 +65,17 @@ fi AC_CONFIG_SUBDIRS([microcode compiler]) AC_CONFIG_FILES([ Makefile +6001/Makefile +compiler/Makefile cref/Makefile edwin/Makefile imail/Makefile runtime/Makefile +sf/Makefile sos/Makefile ssp/Makefile star-parser/Makefile +win32/Makefile xdoc/Makefile xml/Makefile ]) @@ -79,11 +83,11 @@ AC_OUTPUT if test x${enable_native_code} = xc; then BN=liarcc-cc - (cd lib; rm -f ${BN}; ${LN_S} ../microcode/${BN} ${BN}) + (cd lib; rm -f ${BN}; ${LN_S} ../microcode/${BN} .) BN=liarcc-ld - (cd lib; rm -f ${BN}; ${LN_S} ../microcode/${BN} ${BN}) - for BUNDLE in compiler cref edwin imail sf sos ssp star-parser xdoc xml; do - BN=${BUNDLE}.so - (cd lib/lib; rm -f ${BN}; ${LN_S} ../../microcode/${BN} ${BN}) + (cd lib; rm -f ${BN}; ${LN_S} ../microcode/${BN} .) + for BUNDLE in 6001 compiler cref edwin imail sf sos ssp star-parser xdoc xml; do + SO=${BUNDLE}.so + (cd lib/lib; rm -f ${SO}; ${LN_S} ../../${BUNDLE}/${SO} .) done fi diff --git a/v7/src/edwin/Clean.sh b/v7/src/edwin/Clean.sh index c8501c8a7..8f43e92db 100755 --- a/v7/src/edwin/Clean.sh +++ b/v7/src/edwin/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.15 2007/05/03 03:40:17 cph Exp $ +# $Id: Clean.sh,v 1.16 2007/05/14 16:50:38 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -37,6 +37,3 @@ fi . ../etc/functions.sh maybe_rm edwin.bld -maybe_rm edwin-unx.crf edwin-w32.crf edwin-os2.crf -maybe_rm edwin-unx.pkd edwin-w32.pkd edwin-os2.pkd -maybe_rm edwin-unx.fre edwin-w32.fre edwin-os2.fre diff --git a/v7/src/edwin/Makefile-fragment b/v7/src/edwin/Makefile-fragment index 6d52c009e..9aae5c6c1 100644 --- a/v7/src/edwin/Makefile-fragment +++ b/v7/src/edwin/Makefile-fragment @@ -12,11 +12,8 @@ install: rm -rf $(DESTDIR)$(EODIR) $(mkinstalldirs) $(DESTDIR)$(EODIR) @for F in $(EDOPTS); do \ - echo "$(INSTALL_COM) $${F}.com $(DESTDIR)$(EODIR)/.";\ - $(INSTALL_COM) $${F}.com $(DESTDIR)$(EODIR)/.;\ - done - @for F in $(EDOPTS); do \ - REL="../../SRC/edwin/$${F}.bci";\ - echo "( cd $(DESTDIR)$(EODIR); $(LN_S) $${REL} . )";\ - ( cd $(DESTDIR)$(EODIR); $(LN_S) $${REL} . );\ + CMD="$(INSTALL_COM) $${F}.com $(DESTDIR)$(EODIR)/.";\ + echo "${CMD}"; eval "${CMD}";\ + CMD="(cd $(DESTDIR)$(EODIR);$(LN_S) ../../SRC/edwin/$${F}.bci .)";\ + echo "${CMD}"; eval "${CMD}";\ done diff --git a/v7/src/etc/Clean.sh b/v7/src/etc/Clean.sh index 79f90dafa..a8b26ed8d 100755 --- a/v7/src/etc/Clean.sh +++ b/v7/src/etc/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.22 2007/05/13 12:22:47 cph Exp $ +# $Id: Clean.sh,v 1.23 2007/05/14 16:50:44 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -66,6 +66,8 @@ esac TOPDIR=${TOPDIR:-..} . "${TOPDIR}/etc/functions.sh" +maybe_rm *-init.c *-init.h *-init.o + if [ ${DIST} = yes ]; then if [ -f Makefile.in ]; then maybe_rm Makefile @@ -73,13 +75,13 @@ if [ ${DIST} = yes ]; then fi if [ ${MAINTAINER} = yes ]; then - maybe_unlink Makefile "${TOPDIR}/Makefile.std" maybe_unlink .edwin-ffi ed-ffi.scm for FN in Clean.sh Setup.sh Stage.sh Tags.sh; do maybe_unlink "${FN}" "${TOPDIR}/etc/${FN}" done if [ -f Makefile-fragment ]; then maybe_rm Makefile.in + maybe_rm Makefile-bundle fi fi diff --git a/v7/src/etc/Setup.sh b/v7/src/etc/Setup.sh index 1bef115e8..9db75e126 100755 --- a/v7/src/etc/Setup.sh +++ b/v7/src/etc/Setup.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Setup.sh,v 1.13 2007/05/02 03:59:08 cph Exp $ +# $Id: Setup.sh,v 1.14 2007/05/14 16:50:47 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -30,9 +30,6 @@ set -e . ../etc/functions.sh -if [ ! -f Makefile.in ]; then - maybe_link Makefile ../Makefile.std -fi for FN in Clean.sh Stage.sh Tags.sh; do maybe_link ${FN} ../etc/${FN} done diff --git a/v7/src/etc/build-bands.sh b/v7/src/etc/build-bands.sh index c90818d3f..6c6e4bd40 100755 --- a/v7/src/etc/build-bands.sh +++ b/v7/src/etc/build-bands.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: build-bands.sh,v 1.10 2007/05/03 03:45:51 cph Exp $ +# $Id: build-bands.sh,v 1.11 2007/05/14 16:50:40 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -25,10 +25,29 @@ set -e -etc/build-runtime.sh +( +echo "cd runtime" +cd runtime -echo "microcode/scheme --library lib --heap 3000" -exec microcode/scheme --library lib --heap 3000 < " + exit 1 +fi + +CMD="microcode/scheme --library ${LIB} --fasl runtime_make.so --heap 6000" +echo "${CMD}" +eval "${CMD}" <> "${SYSTEM}.c" - -#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code) \\ - if (0 != (declare_compiled_code (name, nentries, decl_code, code))) \\ - return (0); - -#define DECLARE_COMPILED_DATA(name, decl_data, data) \\ - if (0 != (declare_compiled_code (name, decl_data, data))) \\ - return (0); - -#define DECLARE_COMPILED_DATA_NS(name, data) \\ - if (0 != (declare_compiled_data_ns (name, data))) \\ - return (0); - -#define DECLARE_DATA_OBJECT(name, data) \\ - if (0 != (declare_data_object (name, data))) \\ - return (0); - -char * -dload_initialize_file (void) -{ -#include "${SYSTEM}.h" - return (0); -} -EOF - ;; static) cat <> "${SYSTEM}.c" @@ -141,4 +110,34 @@ initialize_compiled_code_blocks (void) } EOF ;; +library) + cat <> "${SYSTEM}.c" + +#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code) \\ + if (0 != (declare_compiled_code (name, nentries, decl_code, code))) \\ + return (0); + +#define DECLARE_COMPILED_DATA(name, decl_data, data) \\ + if (0 != (declare_compiled_code (name, decl_data, data))) \\ + return (0); + +#define DECLARE_COMPILED_DATA_NS(name, data) \\ + if (0 != (declare_compiled_data_ns (name, data))) \\ + return (0); + +#define DECLARE_DATA_OBJECT(name, data) \\ + if (0 != (declare_data_object (name, data))) \\ + return (0); + +char * +dload_initialize_file (void) +{ +#include "${SYSTEM}.h" + return (0); +} +EOF + ;; +*) + usage + ;; esac diff --git a/v7/src/etc/c-compile.sh b/v7/src/etc/c-compile.sh index e3c06b679..c45c828b8 100755 --- a/v7/src/etc/c-compile.sh +++ b/v7/src/etc/c-compile.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: c-compile.sh,v 1.6 2007/05/06 14:16:59 cph Exp $ +# $Id: c-compile.sh,v 1.7 2007/05/14 16:50:43 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -25,14 +25,10 @@ set -e -etc/build-runtime.sh - -echo "microcode/scheme --library lib --heap 6000 --stack 200" -exec microcode/scheme --library lib --heap 6000 --stack 200 <namestring + (cref/package-files + (string-append bundle + "/" + pkg-name + ".pkg") + 'unix)))) + (cond ((or (string=? bundle "6001") + (string=? bundle "cref") + (string=? bundle "runtime") + (string=? bundle "sf")) + (cons "make" names)) + ((string=? bundle "compiler") + (cons* "machines/C/make" + "base/make" + names)) + ((string=? bundle "edwin") + (cons* "edwin" + "rename" + names)) + (else names))) + stringlocal-iso8601-string (get-universal-time)) + output) + (write-string "." output) + (newline output) + (newline output)) + +(define (write-rule port lhs . rhs) + (write-string lhs port) + (write-string ":" port) + (write-items (flatten-items rhs) port) + (newline port)) + +(define (write-macro port lhs . rhs) + (write-string lhs port) + (write-string " =" port) + (write-items (flatten-items rhs) port) + (newline port)) + +(define (write-command port program . args) + (write-char #\tab port) + (write-string program port) + (write-items (flatten-items args) port) + (newline port)) + +(define (flatten-items items) + (append-map (lambda (item) + (if (list? item) + (flatten-items item) + (list item))) + items)) + +(define (write-items items port) + (for-each (lambda (item) + (write-string " " port) + (write-item item port)) + items)) + +(define (write-item item port) + (if (>= (+ (output-port/column port) + (string-length item)) + 78) + (begin + (write-char #\\ port) + (newline port) + (write-char #\tab port) + (write-string " " port))) + (write-string item port)) + +(define (files+suffix files suffix) + (map (lambda (file) + (string-append file suffix)) + files)) \ No newline at end of file diff --git a/v7/src/microcode/configure.ac b/v7/src/microcode/configure.ac index 856c9df3f..4ce02b7e1 100644 --- a/v7/src/microcode/configure.ac +++ b/v7/src/microcode/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT([MIT/GNU Scheme microcode], [15.1], [bug-mit-scheme@gnu.org], [mit-scheme]) -AC_REVISION([$Id: configure.ac,v 1.46 2007/05/09 02:05:56 cph Exp $]) +AC_REVISION([$Id: configure.ac,v 1.47 2007/05/14 16:50:51 cph Exp $]) AC_CONFIG_SRCDIR([boot.c]) AC_CONFIG_HEADERS([config.h]) AC_PROG_MAKE_SET @@ -218,9 +218,6 @@ if test ${GCC} = yes; then CFLAGS="-O0 -g -DENABLE_DEBUGGING_TOOLS" LDFLAGS="${LDFLAGS} -g" fi - if test ${enable_native_code} = c; then - CFLAGS="-fPIC ${CFLAGS}" - fi CFLAGS="${CFLAGS} -Wall -Wundef -Wpointer-arith -Winline" CFLAGS="${CFLAGS} -Wstrict-prototypes -Wnested-externs -Wredundant-decls" @@ -854,7 +851,7 @@ if test ${DO_GCC_TESTS} = yes; then fi SCHEME_LDFLAGS="${SCHEME_LDFLAGS} -export-dynamic" MODULE_CFLAGS="${MODULE_CFLAGS} -fPIC" - MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared" + MODULE_LDFLAGS="${MODULE_LDFLAGS} -shared -fPIC" AC_MSG_CHECKING([for ELF binaries]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( @@ -930,8 +927,6 @@ c) AC_CONFIG_LINKS([cmpauxmd.c:cmpauxmd/c.c]) AC_CONFIG_FILES([liarc-cc], [chmod +x liarc-cc]) AC_CONFIG_FILES([liarc-ld], [chmod +x liarc-ld]) - AC_DEFINE([COMPILE_FOR_STATIC_LINKING], [1], - [Define to 1 for static compilation of C native code.]) OPTIONAL_BASES="${OPTIONAL_BASES} cmpauxmd unstackify compinit" LIARC_VARS=liarc-vars LIARC_RULES=liarc-rules diff --git a/v7/src/microcode/liarc-cc.in b/v7/src/microcode/liarc-cc.in index 45d0e9c7c..db1803128 100755 --- a/v7/src/microcode/liarc-cc.in +++ b/v7/src/microcode/liarc-cc.in @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: liarc-cc.in,v 1.2 2007/05/09 19:12:04 cph Exp $ +# $Id: liarc-cc.in,v 1.3 2007/05/14 16:50:52 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -25,10 +25,17 @@ set -e -if [ ${#} -ne 2 ]; then - echo "usage: ${0} OUTPUT INPUT" +if [ ${#} -lt 2 ]; then + echo "usage: ${0} OUTPUT INPUT [OPTIONS]" exit 1 fi -@CC@ @DEFS@ @SCHEME_DEFS@ @CPPFLAGS@ @CFLAGS@ @MODULE_CFLAGS@ \ - -DCOMPILE_FOR_DYNAMIC_LOADING -o "${1}" -c "${2}" +OUT=${1} +shift +IN=${1} +shift + +CMD="@CC@ @DEFS@ @SCHEME_DEFS@ @CPPFLAGS@ @CFLAGS@ @MODULE_CFLAGS@" +CMD="${CMD} ${@} -o ${OUT} -c ${IN}" +echo "${CMD}" +eval "${CMD}" diff --git a/v7/src/microcode/liarc-ld.in b/v7/src/microcode/liarc-ld.in index e48b0a968..1c45bfe0b 100644 --- a/v7/src/microcode/liarc-ld.in +++ b/v7/src/microcode/liarc-ld.in @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: liarc-ld.in,v 1.1 2007/05/09 02:06:16 cph Exp $ +# $Id: liarc-ld.in,v 1.2 2007/05/14 16:50:54 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -30,8 +30,9 @@ if [ ${#} -lt 2 ]; then exit 1 fi -OUTPUT=${1} +OUT=${1} shift -@CCLD@ @LDFLAGS@ @MODULE_LDFLAGS@ -o "${OUTPUT}" "${@}" -rm -f "${@}" +CMD="@CCLD@ @LDFLAGS@ @MODULE_LDFLAGS@ -o ${OUT} ${@}" +echo "${CMD}" +eval "${CMD}" diff --git a/v7/src/microcode/liarc.h b/v7/src/microcode/liarc.h index 2cc86db10..5c4c5d2cf 100644 --- a/v7/src/microcode/liarc.h +++ b/v7/src/microcode/liarc.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: liarc.h,v 1.29 2007/04/22 16:31:22 cph Exp $ +$Id: liarc.h,v 1.30 2007/05/14 16:50:53 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -49,12 +49,6 @@ USA. extern SCHEME_OBJECT * sp_register; -#ifndef COMPILE_FOR_STATIC_LINKING -# ifndef COMPILE_FOR_DYNAMIC_LOADING -# define COMPILE_FOR_DYNAMIC_LOADING 1 -# endif -#endif - #ifdef __GNUC__ /* Add attributes to avoid warnings from -Wall for unreferenced labels */ # define DEFLABEL(name) name : __attribute__((unused)) @@ -377,20 +371,9 @@ struct liarc_data_S return (result); \ } while (false) -#ifndef COMPILE_FOR_DYNAMIC_LOADING - -#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code) -#define DECLARE_COMPILED_DATA(name, decl_data, data) -#define DECLARE_COMPILED_DATA_NS(name, data) -#define DECLARE_DATA_OBJECT(name, data) -#define DECLARE_DYNAMIC_INITIALIZATION(name) -#define DECLARE_DYNAMIC_OBJECT_INITIALIZATION(name) - -#else /* COMPILE_FOR_DYNAMIC_LOADING */ +#ifdef ENABLE_LIARC_FILE_INIT #define DECLARE_COMPILED_CODE(name, nentries, decl_code, code) \ -liarc_decl_code_t decl_code; \ -liarc_code_proc_t code; \ static int \ dload_initialize_code (void) \ { \ @@ -398,8 +381,6 @@ dload_initialize_code (void) \ } #define DECLARE_COMPILED_DATA(name, decl_data, data) \ -liarc_decl_data_t decl_data; \ -liarc_data_proc_t data; \ static int \ dload_initialize_data (void) \ { \ @@ -407,7 +388,6 @@ dload_initialize_data (void) \ } #define DECLARE_COMPILED_DATA_NS(name, data) \ -liarc_data_proc_t data; \ static int \ dload_initialize_data (void) \ { \ @@ -415,7 +395,6 @@ dload_initialize_data (void) \ } #define DECLARE_DATA_OBJECT(name, data) \ -liarc_object_proc_t data; \ static int \ dload_initialize_data (void) \ { \ @@ -440,7 +419,16 @@ dload_initialize_file (void) \ return (((dload_initialize_data ()) == 0) ? name : 0); \ } -#endif /* COMPILE_FOR_DYNAMIC_LOADING */ +#else /* !ENABLE_LIARC_FILE_INIT */ + +#define DECLARE_COMPILED_CODE(name, nentries, decl_code, code) +#define DECLARE_COMPILED_DATA(name, decl_data, data) +#define DECLARE_COMPILED_DATA_NS(name, data) +#define DECLARE_DATA_OBJECT(name, data) +#define DECLARE_DYNAMIC_INITIALIZATION(name) +#define DECLARE_DYNAMIC_OBJECT_INITIALIZATION(name) + +#endif /* !ENABLE_LIARC_FILE_INIT */ extern SCHEME_OBJECT initialize_subblock (const char *); diff --git a/v7/src/microcode/makegen/Makefile.in.in b/v7/src/microcode/makegen/Makefile.in.in index 0188d9220..7f43af082 100644 --- a/v7/src/microcode/makegen/Makefile.in.in +++ b/v7/src/microcode/makegen/Makefile.in.in @@ -1,6 +1,6 @@ # -*- Makefile -*- # -# $Id: Makefile.in.in,v 1.55 2007/05/09 20:01:37 cph Exp $ +# $Id: Makefile.in.in,v 1.56 2007/05/14 16:50:56 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -139,7 +139,7 @@ ALL_LIBS = $(aux_LIBS) ALL_DATA = $(aux_DATA) MOSTLYCLEAN_FILES = *.o usrdef.c compinit.c compinit.h cmpauxmd.s \ - $(LIARC_OBJECTS) $(LIARC_BUNDLE_CLEAN_FILES) + $(LIARC_OBJECTS) CLEAN_FILES = $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) $(EXTRA_PROGRAMS) @@ -170,9 +170,7 @@ C_CLEAN_FILES = utabmd.c utabmd.bci default-target: $(ALL_PROGRAMS) $(ALL_LIBS) -all: $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) $(LIARC_BOOT_BUNDLES) - -liarc-bundles: all $(LIARC_BUNDLES) +all: $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) scheme: $(scheme_OBJECTS) $(scheme_DEPENDENCIES) -rm -f $@ @@ -239,9 +237,9 @@ install: install-auxLIBS install-auxDATA @INSTALL_INCLUDE@ $(INSTALL_PROGRAM) scheme $(DESTDIR)$(bindir)/$(SYSTEM_BASE_NAME) ../etc/install-bin-symlinks.sh $(DESTDIR)$(bindir) $(SYSTEM_BASE_NAME) -install-auxLIBS: $(aux_LIBS) $(LIARC_BUNDLES) +install-auxLIBS: $(aux_LIBS) $(mkinstalldirs) $(DESTDIR)$(AUXDIR)/lib - @list='$(aux_LIBS) $(LIARC_BUNDLES)'; \ + @list='$(aux_LIBS)'; \ for p in $$list; do \ if test -f $$p; then \ echo "$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/lib/."; \ diff --git a/v7/src/microcode/makegen/liarc-base-rules b/v7/src/microcode/makegen/liarc-base-rules index d5a27c317..0255a54a6 100644 --- a/v7/src/microcode/makegen/liarc-base-rules +++ b/v7/src/microcode/makegen/liarc-base-rules @@ -1,6 +1,6 @@ # -*- Makefile -*- # -# $Id: liarc-base-rules,v 1.3 2007/05/03 03:49:54 cph Exp $ +# $Id: liarc-base-rules,v 1.4 2007/05/14 16:50:55 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -32,4 +32,4 @@ unstackify.o: unstackify.c stackops.h $(LIARC_HEAD_FILES) compinit.c compinit.h: $(LIARC_SOURCES) Makefile rm -f $@ - ../etc/c-bundle.sh static compinit $(LIARC_SOURCES) + $(srcdir)/../etc/c-bundle.sh static compinit $(LIARC_SOURCES) diff --git a/v7/src/microcode/makegen/makegen.scm b/v7/src/microcode/makegen/makegen.scm index 2f3cdc69c..aeda3ba39 100644 --- a/v7/src/microcode/makegen/makegen.scm +++ b/v7/src/microcode/makegen/makegen.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: makegen.scm,v 1.23 2007/05/06 00:01:01 cph Exp $ +$Id: makegen.scm,v 1.24 2007/05/14 16:50:57 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -31,9 +31,12 @@ USA. (load-option 'REGULAR-EXPRESSION) (load-option 'SYNCHRONOUS-SUBPROCESS) +(load (merge-pathnames "../../etc/utilities" + (directory-pathname (current-load-pathname)))) (define (generate-makefile) - (generate-liarc-files) + (generate-liarc-variables) + (generate-liarc-rules) (let ((file-lists (map (lambda (pathname) (cons (pathname-name pathname) @@ -62,48 +65,35 @@ USA. (write-char char output) (loop)))))))))))) -(define (write-header output) - (write-string "# This file automatically generated at " output) - (write-string (universal-time->local-iso8601-string (get-universal-time)) - output) - (write-string "." output) - (newline output) - (newline output)) - -(define (generate-liarc-files) - (generate-liarc-variables) - (generate-liarc-rules)) - (define (generate-liarc-variables) (call-with-output-file "liarc-vars" (lambda (output) (write-header output) - (write-rule "LIARC_HEAD_FILES" - "=" - (cddr (generate-rule "liarc-gendeps.c")) - output) + (write-macro output + "LIARC_HEAD_FILES" + (cddr (generate-rule "liarc-gendeps.c"))) (newline output) (let ((files (liarc-static-files))) - (write-rule "LIARC_SOURCES" "=" (files+suffix files ".c") output) + (write-macro output "LIARC_SOURCES" (files+suffix files ".c")) (newline output) - (write-rule "LIARC_OBJECTS" "=" (files+suffix files ".o") output) + (write-macro output "LIARC_OBJECTS" (files+suffix files ".o")) (newline output)) - (write-rule "LIARC_BOOT_BUNDLES" - "=" - (files+suffix '("sf" "compiler" "star-parser" "cref") ".so") - output) + (write-macro output + "LIARC_BOOT_BUNDLES" + (files+suffix '("sf" "compiler" "star-parser" "cref") ".so")) (let ((bundles (liarc-bundles))) - (write-rule "LIARC_BUNDLES" - "=" - (bundles+suffix bundles ".so") - output) - (write-rule "LIARC_BUNDLE_CLEAN_FILES" - "=" - (cons "$(LIARC_BUNDLES)" - (append (bundles+suffix bundles "-init.h") - (bundles+suffix bundles "-init.c") - (bundles+suffix bundles "-init.o"))) - output))))) + (write-macro output + "LIARC_BUNDLES" + (bundles+suffix bundles ".so")) + (write-macro output + "LIARC_BUNDLE_CLEAN_FILES" + (cons "$(LIARC_BUNDLES)" + (append (bundles+suffix bundles "-init.h") + (bundles+suffix bundles "-init.c") + (bundles+suffix bundles "-init.o")))))))) + +(define (bundles+suffix bundles suffix) + (files+suffix (map car bundles) suffix)) (define (generate-liarc-rules) (call-with-output-file "liarc-rules" @@ -114,53 +104,10 @@ USA. (let loop () (let ((char (read-char input))) (if (not (eof-object? char)) - (begin (write-char char output) - (loop))))))) - (for-each (lambda (bundle) - (newline output) - (let ((files - (append (append-map package-description-files - (cadr bundle)) - (enumerate-directories (cddr bundle)))) - (init-root (string-append (car bundle) "-init"))) - (write-rule (string-append (car bundle) ".so") - ":" - (files+suffix files ".o") - output) - (write-command output - "../etc/c-bundle.sh" - "library" - init-root - (files+suffix files ".c")) - (write-command output - "$(COMPILE_MODULE)" - "-c" - (string-append init-root ".c")) - (write-command output - "$(LINK_MODULE)" - (string-append init-root ".o") - "$^") - (write-command output - "rm" - "-f" - (map (lambda (suffix) - (string-append init-root suffix)) - '(".h" ".c" ".o"))))) - (liarc-bundles))))) - -(define (write-command port program . args) - (write-char #\tab port) - (write-string program port) - (write-items (flatten-items args) port) - (newline port)) + (begin + (write-char char output) + (loop)))))))))) -(define (flatten-items items) - (append-map (lambda (item) - (if (list? item) - (flatten-items item) - (list item))) - items)) - (define (liarc-static-files) (append '("utabmd") (append-map package-description-files @@ -227,34 +174,6 @@ USA. (write-dependencies file-lists "Makefile.deps" output)) (else (error "Unknown command:" command))))))) - -(define (files+suffix files suffix) - (map (lambda (file) - (string-append file suffix)) - files)) - -(define (bundles+suffix bundles suffix) - (files+suffix (map car bundles) suffix)) - -(define (write-rule lhs op rhs port) - (write-string lhs port) - (write-string " " port) - (write-string op port) - (write-items rhs port) - (newline port)) - -(define (write-items items port) - (for-each (lambda (item) - (write-string " " port) - (write-item item port)) - items)) - -(define (write-item item port) - (if (>= (+ (output-port/column port) - (string-length item)) - 78) - (write-string "\\\n\t " port)) - (write-string item port)) (define (write-dependencies file-lists deps-filename output) (maybe-update-dependencies @@ -284,7 +203,7 @@ USA. (call-with-output-file deps-filename (lambda (output) (for-each (lambda (rule) - (write-rule (car rule) ":" (cdr rule) output)) + (write-rule output (car rule) (cdr rule))) rules)))))) (define (generate-rule filename) @@ -316,5 +235,5 @@ USA. (error "Missing rule target:" rule)) (cons* (string-head (car items) (- (string-length (car items)) 1)) (cadr items) - (sort (list-transform-negative (cddr items) pathname-absolute?) + (sort (delete-matching-items (cddr items) pathname-absolute?) string