Refactor top-level Makefile to use a single pass.
authorChris Hanson <org/chris-hanson/cph>
Mon, 15 Oct 2018 02:48:43 +0000 (19:48 -0700)
committerChris Hanson <org/chris-hanson/cph>
Mon, 15 Oct 2018 02:48:43 +0000 (19:48 -0700)
src/Makefile.in
src/Makefile.tools.in [deleted file]
src/configure.ac
src/runtime/host-adapter.scm
src/runtime/runtime.sf

index 0a41b6720d376e410b65544c73a273696923558b..8de186837273a0db2ccbf3b9dfcec183788ef714 100644 (file)
@@ -95,53 +95,14 @@ all-native: cross-target
 
 @IF_CROSS@COMPILER_SETTINGS_CROSS = (set! compiler:cross-compiling? true)
 @IF_LIARC@COMPILER_SETTINGS_LIARC = (set! compiler:invoke-c-compiler? false)
-TOOL_TOOLCHAIN_HEAP = @TOOL_TOOLCHAIN_HEAP@
+HOST_COMPILER_HEAP = @HOST_COMPILER_HEAP@
 
-TOOL_COMPILER_SETTINGS = \
+HOST_COMPILER_SETTINGS = \
        $(COMPILER_SETTINGS_CROSS) \
        $(COMPILER_SETTINGS_LIARC)
 
-# User can override this to use another toolchain.
-TOOLCHAIN = ./tools
-
-HOST_SCHEME = '$(MIT_SCHEME_EXE)' --batch-mode
-TOOL_COMPILER = $(TOOL_TOOLCHAIN)
-TOOL_SYNTAXER = $(HOST_SCHEME) --band $(TOOLCHAIN)/syntaxer.com
-TOOL_TOOLCHAIN = $(HOST_SCHEME) --band $(TOOLCHAIN)/compiler.com \
-  $(TOOL_TOOLCHAIN_HEAP) \
-  --eval '(begin $(TOOL_COMPILER_SETTINGS))'
-
-.PHONY: toolchain
-toolchain: $(TOOLCHAIN)/compiler.com
-
-./tools/compiler.com:
-       $(MAKE) -f Makefile.tools clean && $(MAKE) -f Makefile.tools allclean
-
-# This target toolchain crud is a kludge until the whole system can be
-# cross-compiled.
-TARGET_COMPILER_SETTINGS = \
-       $(COMPILER_SETTINGS_LIARC)
-
-TARGET_RUNTIME = ./microcode/scheme \
-       --library lib --band runtime.com --batch-mode
-TARGET_COMPILER = $(TARGET_RUNTIME) \
-       --eval '(load-option (quote COMPILER))' \
-       --eval '(begin $(TARGET_COMPILER_SETTINGS))'
-TARGET_SYNTAXER = $(TARGET_RUNTIME) \
-       --eval '(load-option (quote CREF))' \
-       --eval '(load-option (quote SF))'
-TARGET_TOOLCHAIN = $(TARGET_RUNTIME) \
-       --eval '(load-option (quote COMPILER))' \
-       --eval '(load-option (quote CREF))' \
-       --eval '(load-option (quote SF))' \
-       --eval '(begin $(TARGET_COMPILER_SETTINGS))'
-
-.PHONY: target-toolchain
-target-toolchain: all-compiler
-target-toolchain: all-cref
-target-toolchain: all-sf
-target-toolchain: cross-target
-target-toolchain: lib/runtime.com
+HOST_COMPILER = '$(MIT_SCHEME_EXE)' --batch-mode $(HOST_COMPILER_HEAP) \
+  --eval '(begin $(HOST_COMPILER_SETTINGS))' --load runtime/host-adapter.scm
 
 .PHONY: microcode/scheme
 @IF_LIARC@microcode/scheme: all-runtime
@@ -183,16 +144,6 @@ lib/runtime.com: microcode/scheme
               | ../microcode/scheme --batch-mode --library ../lib \
                   --fasl "$${FASL}"))
 
-lib/compiler.com: all-compiler
-lib/compiler.com: all-sf
-lib/compiler.com: lib/runtime.com
-lib/compiler.com: microcode/scheme
-       (echo '(begin' && \
-        echo '  (load-option (quote COMPILER))' && \
-        echo '  (load-option (quote SF))' && \
-        echo '  (disk-save "$@"))') \
-       | ./microcode/scheme --batch-mode --library lib --band runtime.com
-
 lib/all.com: all-compiler
 lib/all.com: all-sf
 lib/all.com: lib/runtime.com
@@ -234,232 +185,168 @@ restore:
        @if ! test -d saved-objects; then exit 1; fi && \
        (cd saved-objects && pax -rw -pe -v . ../../.)
 
-### Stuff we build with the tools compiler necessarily from scratch.
-
 # This rule is for LIARC.
 .SUFFIXES: .bld .pkd .c
-.pkd.c .bld.c: toolchain
-       echo '(cbf "$<")' | $(TOOL_COMPILER)
+.pkd.c .bld.c:
+       echo '(cbf "$<")' | $(HOST_COMPILER)
 
-# Compiler (LIAR)
+################
+# Runtime
+################
 
-# The subdirectories can be compiled independently and in parallel, but
-# syntaxing the compiler is too hairy right now to do without the
-# compiler.sf script(s).
+.PHONY: all-runtime
+all-runtime: compile-runtime
+@IF_LIARC@all-runtime: bundle-runtime
+
+.PHONY: syntax-runtime
+syntax-runtime:
+       (echo '(with-working-directory-pathname "runtime"' && \
+        echo '  (lambda () (load "runtime.sf")))') \
+       | $(HOST_COMPILER)
+
+.PHONY: compile-runtime
+compile-runtime: syntax-runtime
+       (echo '(with-working-directory-pathname "runtime"' && \
+        echo '  (lambda () (load "runtime.cbf")))') \
+       | $(HOST_COMPILER)
+
+.PHONY: bundle-runtime
+bundle-runtime: runtime/runtime-unx.c
+bundle-runtime: runtime/runtime-w32.c
+
+# XXX Kludgey bogus rules for LIARC.
+#runtime/runtime-w32.pkd: runtime/runtime-unx.pkd
+
+################
+# SF
+################
+
+.PHONY: all-sf
+all-sf: compile-sf
+@IF_LIARC@all-sf: bundle-sf
+
+.PHONY: syntax-sf
+syntax-sf:
+       (echo '(with-working-directory-pathname "sf"' && \
+        echo '  (lambda () (load "sf.sf")))') \
+       | $(HOST_COMPILER)
+
+.PHONY: compile-sf
+compile-sf: syntax-sf
+       (echo '(with-working-directory-pathname "sf"' && \
+        echo '  (lambda () (load "sf.cbf")))') \
+       | $(HOST_COMPILER)
+
+.PHONY: bundle-sf
+bundle-sf: liarc-bundle-tools
+bundle-sf: compile-sf
+bundle-sf: sf/sf-unx.c
+bundle-sf: sf/sf-w32.c
+       (cd sf && $(MAKE) compile-liarc-bundle)
+
+# XXX Kludgey bogus rules for liarc.
+#sf/sf-w32.pkd: sf/sf-unx.pkd
+
+################
+# Compiler (LIAR)
+################
 
 .PHONY: all-compiler
 all-compiler: compile-compiler
 @IF_LIARC@all-compiler: bundle-compiler
 
-.PHONY: bundle-compiler
-bundle-compiler: liarc-bundle-tools
-bundle-compiler: compile-compiler
-bundle-compiler: compiler/compiler-unx.c
-bundle-compiler: compiler/compiler-w32.c
-       (cd compiler && $(MAKE) compile-liarc-bundle)
-
-.PHONY: compile-compiler
-compile-compiler: compile-compiler-back
-compile-compiler: compile-compiler-base
-compile-compiler: compile-compiler-fggen
-compile-compiler: compile-compiler-fgopt
-compile-compiler: compile-compiler-machine
-compile-compiler: compile-compiler-rtlbase
-compile-compiler: compile-compiler-rtlgen
-compile-compiler: compile-compiler-rtlopt
-
-.PHONY: compile-compiler-back
-compile-compiler-back: toolchain
-compile-compiler-back: syntax-compiler
-       echo '(compile-directory "compiler/back")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-base
-compile-compiler-base: toolchain
-compile-compiler-base: syntax-compiler
-       echo '(compile-directory "compiler/base")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-fggen
-compile-compiler-fggen: toolchain
-compile-compiler-fggen: syntax-compiler
-       echo '(compile-directory "compiler/fggen")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-fgopt
-compile-compiler-fgopt: toolchain
-compile-compiler-fgopt: syntax-compiler
-       echo '(compile-directory "compiler/fgopt")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-machine
-compile-compiler-machine: toolchain
-compile-compiler-machine: syntax-compiler
-       echo '(compile-directory "compiler/machine")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-rtlbase
-compile-compiler-rtlbase: toolchain
-compile-compiler-rtlbase: syntax-compiler
-       echo '(compile-directory "compiler/rtlbase")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-rtlgen
-compile-compiler-rtlgen: toolchain
-compile-compiler-rtlgen: syntax-compiler
-       echo '(compile-directory "compiler/rtlgen")' | $(TOOL_COMPILER)
-
-.PHONY: compile-compiler-rtlopt
-compile-compiler-rtlopt: toolchain
-compile-compiler-rtlopt: syntax-compiler
-       echo '(compile-directory "compiler/rtlopt")' | $(TOOL_COMPILER)
-
 .PHONY: syntax-compiler
-syntax-compiler: toolchain
 @IF_SVM@syntax-compiler: compiler/machines/svm/svm1-defns.h
-syntax-compiler: syntax-sf cref-compiler
+syntax-compiler: syntax-sf
        (echo '(with-working-directory-pathname "compiler"' && \
         echo '  (lambda () (load "compiler.sf")))') \
-       | $(TOOL_SYNTAXER)
-
-.PHONY: cref-compiler
-cref-compiler: compiler/compiler-unx.pkd
+       | $(HOST_COMPILER)
 
-compiler/compiler-unx.pkd: toolchain
-compiler/compiler-unx.pkd: compiler/compiler.pkg
-compiler/compiler-unx.pkd: cref-runtime
-compiler/compiler-unx.pkd: cref-sf
+.PHONY: compile-compiler
+compile-compiler: syntax-compiler
        (echo '(with-working-directory-pathname "compiler"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "compiler")))') \
-       | $(TOOL_SYNTAXER)
+        echo '  (lambda () (load "compiler.cbf")))') \
+       | $(HOST_COMPILER)
 
-# XXX Kludgey bogus rules for liarc.
-compiler/compiler-w32.pkd: compiler/compiler-unx.pkd
+.PHONY: bundle-compiler
+bundle-compiler: liarc-bundle-tools
+bundle-compiler: compile-compiler
+bundle-compiler: compiler/compiler-unx.c
+bundle-compiler: compiler/compiler-w32.c
+       (cd compiler && $(MAKE) compile-liarc-bundle)
 
+################
 # CREF
+################
 
 .PHONY: all-cref
 all-cref: compile-cref
 @IF_LIARC@all-cref: bundle-cref
 
-.PHONY: bundle-cref
-bundle-cref: liarc-bundle-tools
-bundle-cref: compile-cref
-bundle-cref: cref/cref-unx.c
-bundle-cref: cref/cref-w32.c
-       (cd cref && $(MAKE) compile-liarc-bundle)
-
-.PHONY: compile-cref
-compile-cref: toolchain
-compile-cref: syntax-cref
-       (echo '(with-working-directory-pathname "cref"' && \
-        echo '  (lambda () (load "cref.cbf")))') \
-       | $(TOOL_COMPILER)
-
 .PHONY: syntax-cref
-syntax-cref: toolchain
-syntax-cref: cref-cref
+syntax-cref:
        (echo '(with-working-directory-pathname "cref"' && \
         echo '  (lambda () (load "cref.sf")))') \
-       | $(TOOL_SYNTAXER)
-
-.PHONY: cref-cref
-cref-cref: cref/cref-unx.pkd
+       | $(HOST_COMPILER)
 
-cref/cref-unx.pkd: toolchain
-cref/cref-unx.pkd: cref-runtime
-cref/cref-unx.pkd: cref/cref.pkg
+.PHONY: compile-cref
+compile-cref: syntax-cref
        (echo '(with-working-directory-pathname "cref"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "cref")))') \
-       | $(TOOL_SYNTAXER)
-
-# XXX Kludgey bogus rules for liarc.
-cref/cref-w32.pkd: cref/cref-unx.pkd
-
-# Runtime
-
-.PHONY: all-runtime
-all-runtime: compile-runtime
-@IF_LIARC@all-runtime: bundle-runtime
-
-.PHONY: bundle-runtime
-bundle-runtime: runtime/runtime-unx.c
-bundle-runtime: runtime/runtime-w32.c
-
-.PHONY: compile-runtime
-compile-runtime: toolchain
-compile-runtime: syntax-runtime
-       (echo '(with-working-directory-pathname "runtime"' && \
-        echo '  (lambda () (load "runtime.cbf")))') \
-       | $(TOOL_COMPILER)
-
-.PHONY: compile-runtime
-syntax-runtime: toolchain
-syntax-runtime: cref-runtime
-       (echo '(with-working-directory-pathname "runtime"' && \
-        echo '  (lambda () (load "runtime.sf")))') \
-       | $(TOOL_SYNTAXER)
-
-.PHONY: cref-runtime
-cref-runtime: runtime/runtime-unx.pkd
-
-runtime/runtime-unx.pkd: toolchain
-runtime/runtime-unx.pkd: runtime/runtime.pkg
-       (echo '(with-working-directory-pathname "runtime"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "runtime")))') \
-       | $(TOOL_SYNTAXER)
-
-# XXX Kludgey bogus rules for liarc.
-runtime/runtime-w32.pkd: runtime/runtime-unx.pkd
-
-# SF
+        echo '  (lambda () (load "cref.cbf")))') \
+       | $(HOST_COMPILER)
 
-.PHONY: all-sf
-all-sf: compile-sf
-@IF_LIARC@all-sf: bundle-sf
+.PHONY: bundle-cref
+bundle-cref: liarc-bundle-tools
+bundle-cref: compile-cref
+bundle-cref: cref/cref-unx.c
+bundle-cref: cref/cref-w32.c
+       (cd cref && $(MAKE) compile-liarc-bundle)
 
-.PHONY: bundle-sf
-bundle-sf: liarc-bundle-tools
-bundle-sf: compile-sf
-bundle-sf: sf/sf-unx.c
-bundle-sf: sf/sf-w32.c
-       (cd sf && $(MAKE) compile-liarc-bundle)
+# XXX Kludgey bogus rules for LIARC.
+#cref/cref-w32.pkd: cref/cref-unx.pkd
 
-.PHONY: compile-sf
-compile-sf: toolchain
-compile-sf: syntax-sf
-       (echo '(with-working-directory-pathname "sf"' && \
-        echo '  (lambda () (load "sf.cbf")))') \
-       | $(TOOL_COMPILER)
+################
+# *PARSER
+################
 
-.PHONY: syntax-sf
-syntax-sf: toolchain
-syntax-sf: cref-sf
-       (echo '(with-working-directory-pathname "sf"' && \
-        echo '  (lambda () (load "sf.sf")))') \
-       | $(TOOL_SYNTAXER)
+.PHONY: all-star-parser
+all-star-parser: compile-star-parser
+@IF_LIARC@all-star-parser: bundle-star-parser
 
-.PHONY: cref-sf
-cref-sf: sf/sf-unx.pkd
+.PHONY: compile-star-parser
+compile-star-parser:
+       (echo '(with-working-directory-pathname "star-parser"' && \
+        echo '  (lambda () (load "compile")))') \
+       | $(HOST_COMPILER)
 
-sf/sf-unx.pkd: toolchain
-sf/sf-unx.pkd: cref-runtime
-sf/sf-unx.pkd: sf/sf.pkg
-       (echo '(with-working-directory-pathname "sf"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "sf")))') \
-       | $(TOOL_SYNTAXER)
+.PHONY: bundle-star-parser
+bundle-star-parser: liarc-bundle-tools
+bundle-star-parser: compile-star-parser
+bundle-star-parser: star-parser/parser-unx.c
+bundle-star-parser: star-parser/parser-w32.c
+       (cd star-parser && $(MAKE) compile-liarc-bundle)
 
-# XXX Kludgey bogus rules for liarc.
-sf/sf-w32.pkd: sf/sf-unx.pkd
+# XXX Kludgey bogus rules for LIARC.
+#star-parser/parser-w32.pkd: star-parser/parser-unx.pkd
 
 ### More stuff we build with tools.  We could build it with the newly
 ### built compiler in the native case, but we want to avoid having to
 ### do that to encourage cross-compilation.
 
+################
 # FFI
+################
 
 .PHONY: all-ffi
 all-ffi: compile-ffi
 @IF_LIARC@all-ffi: bundle-ffi
 
+.PHONY: compile-ffi
+compile-ffi:
+       (echo '(with-working-directory-pathname "ffi"' && \
+        echo '  (lambda () (load "compile.scm")))') \
+       | $(HOST_COMPILER)
+
 .PHONY: bundle-ffi
 bundle-ffi: liarc-bundle-tools
 bundle-ffi: compile-ffi
@@ -467,34 +354,23 @@ bundle-ffi: ffi/ffi-unx.c
 bundle-ffi: ffi/ffi-w32.c
        (cd ffi && $(MAKE) compile-liarc-bundle)
 
-.PHONY: compile-ffi
-compile-ffi: toolchain
-compile-ffi: cref-ffi
-compile-ffi: syntax-cref       # XXX Urgh!  Should not be here!
-       (echo '(with-working-directory-pathname "ffi"' && \
-        echo '  (lambda () (load "compile.scm")))') \
-       | $(TOOL_TOOLCHAIN)
-
-.PHONY: cref-ffi
-cref-ffi: ffi/ffi-unx.pkd
-
-ffi/ffi-unx.pkd: toolchain
-ffi/ffi-unx.pkd: cref-runtime
-ffi/ffi-unx.pkd: ffi/ffi.pkg
-       (echo '(with-working-directory-pathname "ffi"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "ffi")))') \
-       | $(TOOL_SYNTAXER)
-
-# XXX Kludgey bogus rules for liarc.
-ffi/ffi-w32.pkd: ffi/ffi-unx.pkd
+# XXX Kludgey bogus rules for LIARC.
+#ffi/ffi-w32.pkd: ffi/ffi-unx.pkd
 
+################
 # SOS
+################
 
 .PHONY: all-sos
 all-sos: compile-sos
 @IF_LIARC@all-sos: bundle-sos
 
+.PHONY: compile-sos
+compile-sos:
+       (echo '(with-working-directory-pathname "sos"' && \
+        echo '  (lambda () (load "compile")))') \
+       | $(HOST_COMPILER)
+
 .PHONY: bundle-sos
 bundle-sos: liarc-bundle-tools
 bundle-sos: compile-sos
@@ -502,33 +378,23 @@ bundle-sos: sos/sos-unx.c
 bundle-sos: sos/sos-w32.c
        (cd sos && $(MAKE) compile-liarc-bundle)
 
-.PHONY: compile-sos
-compile-sos: toolchain
-compile-sos: cref-sos
-       (echo '(with-working-directory-pathname "sos"' && \
-        echo '  (lambda () (load "compile")))') \
-       | $(TOOL_TOOLCHAIN)
-
-.PHONY: cref-sos
-cref-sos: sos/sos-unx.pkd
-
-sos/sos-unx.pkd: toolchain
-sos/sos-unx.pkd: cref-runtime
-sos/sos-unx.pkd: sos/sos.pkg
-       (echo '(with-working-directory-pathname "sos"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "sos")))') \
-       | $(TOOL_SYNTAXER)
-
-# XXX Kludgey bogus rules for liarc.
-sos/sos-w32.pkd: sos/sos-unx.pkd
+# XXX Kludgey bogus rules for LIARC.
+#sos/sos-w32.pkd: sos/sos-unx.pkd
 
+################
 # SSP
+################
 
 .PHONY: all-ssp
 all-ssp: compile-ssp
 @IF_LIARC@all-ssp: bundle-ssp
 
+.PHONY: compile-ssp
+compile-ssp: compile-xml
+       (echo '(with-working-directory-pathname "ssp"' && \
+        echo '  (lambda () (load "compile")))') \
+       | $(HOST_COMPILER)
+
 .PHONY: bundle-ssp
 bundle-ssp: liarc-bundle-tools
 bundle-ssp: compile-ssp
@@ -536,101 +402,45 @@ bundle-ssp: ssp/ssp-unx.c
 bundle-ssp: ssp/ssp-w32.c
        (cd ssp && $(MAKE) compile-liarc-bundle)
 
-.PHONY: compile-ssp
-compile-ssp: toolchain
-compile-ssp: cref-ssp
-       (echo '(with-working-directory-pathname "ssp"' && \
-        echo '  (lambda () (load "compile")))') \
-       | $(TOOL_TOOLCHAIN)
-
-.PHONY: cref-ssp
-cref-ssp: ssp/ssp-unx.pkd
-
-ssp/ssp-unx.pkd: toolchain
-ssp/ssp-unx.pkd: cref-runtime
-ssp/ssp-unx.pkd: cref-xml
-ssp/ssp-unx.pkd: ssp/ssp.pkg
-       (echo '(with-working-directory-pathname "ssp"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "ssp")))') \
-       | $(TOOL_SYNTAXER)
-
-# XXX Kludgey bogus rules for liarc.
-ssp/ssp-w32.pkd: ssp/ssp-unx.pkd
-
-# *PARSER
-
-.PHONY: all-star-parser
-all-star-parser: compile-star-parser
-@IF_LIARC@all-star-parser: bundle-star-parser
-
-.PHONY: bundle-star-parser
-bundle-star-parser: liarc-bundle-tools
-bundle-star-parser: compile-star-parser
-bundle-star-parser: star-parser/parser-unx.c
-bundle-star-parser: star-parser/parser-w32.c
-       (cd star-parser && $(MAKE) compile-liarc-bundle)
-
-.PHONY: compile-star-parser
-compile-star-parser: toolchain
-compile-star-parser: cref-star-parser
-       (echo '(with-working-directory-pathname "star-parser"' && \
-        echo '  (lambda () (load "compile")))') \
-       | $(TOOL_TOOLCHAIN)
-
-.PHONY: cref-star-parser
-cref-star-parser: star-parser/parser-unx.pkd
-
-star-parser/parser-unx.pkd: toolchain
-star-parser/parser-unx.pkd: cref-runtime
-star-parser/parser-unx.pkd: star-parser/parser.pkg
-       (echo '(with-working-directory-pathname "star-parser"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "parser")))') \
-       | $(TOOL_SYNTAXER)
-
-# XXX Kludgey bogus rules for liarc.
-star-parser/parser-w32.pkd: star-parser/parser-unx.pkd
+# XXX Kludgey bogus rules for LIARC.
+#ssp/ssp-w32.pkd: ssp/ssp-unx.pkd
 
+################
 # Windows FFI
+################
 
 .PHONY: all-win32
 all-win32: compile-win32
 
-.PHONY: compile-win32
-compile-win32: toolchain
-compile-win32: syntax-win32
-       (echo '(with-working-directory-pathname "win32"' && \
-        echo '  (lambda () (load "win32.cbf")))') \
-       | $(TOOL_COMPILER)
-
 .PHONY: syntax-win32
-syntax-win32: toolchain
-syntax-win32: cref-win32
+syntax-win32:
        (echo '(with-working-directory-pathname "win32"' && \
         echo '  (lambda () (load "win32.sf")))') \
-       | $(TOOL_SYNTAXER)
-
-.PHONY: cref-win32
-cref-win32: win32/win32-unx.pkd                # XXX Er...
+       | $(HOST_COMPILER)
 
-win32/win32-unx.pkd: toolchain
-win32/win32-unx.pkd: cref-runtime
-win32/win32-unx.pkd: win32/win32.pkg
+.PHONY: compile-win32
+compile-win32: syntax-win32
        (echo '(with-working-directory-pathname "win32"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "win32")))') \
-       | $(TOOL_SYNTAXER)
+        echo '  (lambda () (load "win32.cbf")))') \
+       | $(HOST_COMPILER)
 
 # XXX Kludgey bogus rules for liarc.
-win32/win32-w32.pkd: win32/win32-unx.pkd
+#win32/win32-w32.pkd: win32/win32-unx.pkd
 
+################
 # XML
+################
 
 .PHONY: all-xml
 all-xml: compile-xml
 @IF_LIARC@all-xml: bundle-xml
 
+.PHONY: compile-xml
+compile-xml: compile-star-parser
+       (echo '(with-working-directory-pathname "xml"' && \
+        echo '  (lambda () (load "compile")))') \
+       | $(HOST_COMPILER)
+
 .PHONY: bundle-xml
 bundle-xml: liarc-bundle-tools
 bundle-xml: compile-xml
@@ -638,30 +448,12 @@ bundle-xml: xml/xml-unx.c
 bundle-xml: xml/xml-w32.c
        (cd xml && $(MAKE) compile-liarc-bundle)
 
-.PHONY: compile-xml
-compile-xml: toolchain
-compile-xml: cref-xml
-       (echo '(with-working-directory-pathname "xml"' && \
-        echo '  (lambda () (load "compile")))') \
-       | $(TOOL_TOOLCHAIN)
-
-.PHONY: cref-xml
-cref-xml: xml/xml-unx.pkd
-
-xml/xml-unx.pkd: toolchain
-xml/xml-unx.pkd: cref-runtime
-xml/xml-unx.pkd: cref-sos
-xml/xml-unx.pkd: cref-star-parser
-xml/xml-unx.pkd: xml/xml.pkg
-       (echo '(with-working-directory-pathname "xml"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "xml")))') \
-       | $(TOOL_SYNTAXER)
-
 # XXX Kludgey bogus rules for liarc.
-xml/xml-w32.pkd: xml/xml-unx.pkd
+#xml/xml-w32.pkd: xml/xml-unx.pkd
 
+################################
 ### Cross-compilation finish-up.
+################################
 
 # We split this up into two targets, cross-host and cross-target, so
 # that you can type `make cross-host' to do everything on the
@@ -694,14 +486,14 @@ cross-target: cross-host
 
 .PHONY: cross-end
 cross-end: cross-host
-       (echo '(let ((env (->environment (quote (RUNTIME)))))' && \
+       (echo '(let ((env (->environment (quote (runtime)))))' && \
         echo '  (load "../compiler/base/crsend" env)' && \
-        echo '  ((access FINISH-CROSS-COMPILATION:FILES env) ".."))') \
+        echo '  ((access finish-cross-compilation:files env) ".."))') \
        | (cd runtime && ../microcode/scheme --batch-mode --library ../lib \
                                             --fasl make.bin)
-       (echo '(let ((env (->environment (quote (RUNTIME)))))' && \
+       (echo '(let ((env (->environment (quote (runtime)))))' && \
         echo '  (load "../compiler/base/crsend" env)' && \
-        echo '  ((access FINISH-CROSS-COMPILATION:INFO-FILES env) ".."))') \
+        echo '  ((access finish-cross-compilation:info-files env) ".."))') \
         | (cd runtime && ../microcode/scheme --batch-mode --library ../lib \
                                              --fasl make.com)
 
@@ -783,7 +575,6 @@ stamp_native-compile-scheme: compile-microcode
 
 
 mostlyclean clean distclean maintainer-clean c-clean:
-       $(MAKE) -f Makefile.tools clean
        $(top_srcdir)/Clean.sh $@ $(SUBDIRS)
 
 clean-boot-root:
diff --git a/src/Makefile.tools.in b/src/Makefile.tools.in
deleted file mode 100644 (file)
index 2984c7f..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-#     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-#     2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
-#     2015, 2016, 2017, 2018 Massachusetts Institute of Technology
-#
-# This file is part of MIT/GNU Scheme.
-#
-# MIT/GNU Scheme is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# MIT/GNU Scheme is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with MIT/GNU Scheme; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# **** BEGIN BOILERPLATE ****
-
-SHELL = @SHELL@
-
-@SET_MAKE@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datarootdir = @datarootdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-top_builddir = @top_builddir@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-
-LN_S = @LN_S@
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/microcode/mkinstalldirs
-
-# **** END BOILERPLATE ****
-
-MIT_SCHEME_EXE = @MIT_SCHEME_EXE@
-
-HOST_COMPILER = $(HOST_TOOLCHAIN)
-HOST_RUNTIME = '$(MIT_SCHEME_EXE)' --batch-mode --band runtime.com \
-       --eval '(load "runtime/host-adapter")'
-HOST_SYNTAXER = '$(MIT_SCHEME_EXE)' --batch-mode --band runtime.com \
-       --eval '(load "runtime/host-adapter")' \
-       --eval '(load-option (quote CREF))' \
-       --eval '(load-option (quote SF))'
-HOST_TOOLCHAIN = '$(MIT_SCHEME_EXE)' --batch-mode \
-       --eval '(load "runtime/host-adapter")' \
-       --eval '(load-option (quote CREF))'
-
-SUBDIRS = compiler cref runtime sf star-parser
-
-.PHONY: all
-all: tools/compiler.com
-all: tools/syntaxer.com
-
-.PHONY: allclean
-allclean: all
-       @for d in $(SUBDIRS); do (cd $$d && sh Clean.sh clean); done
-
-# XXX This clean target is a cop-out.
-.PHONY: clean
-clean:
-       @for d in $(SUBDIRS); do (cd $$d && sh Clean.sh clean); done
-       -rm -rf tools/saved-objects
-       -rm -f tools/compiler.com
-       -rm -f tools/syntaxer.com
-
-.PHONY: save
-save:
-       @echo 'Saving tools objects...'
-       @rm -rf tools/saved-objects && \
-       mkdir tools/saved-objects && \
-       ( \
-         find $(SUBDIRS) -type f \
-           \( \
-             -name '*.bci' -o \
-             -name '*.bin' -o \
-             \( -name '*.c' \! -path compiler/documentation/test-c.c \) -o \
-             -name '*.com' -o \
-             -name '*.crf' -o \
-             -name '*.ext' -o \
-             -name '*.fre' -o \
-             -name '*.o' -o \
-             -name '*.pkd' -o \
-             -name '*.so' -o \
-             -false \
-           \) \
-           -print0 \
-         | pax -rw -pe -l -v -d -0 tools/saved-objects/. \
-       ) || { rm -rf tools/saved-objects; exit 1; }
-
-.PHONY: restore
-restore:
-       @echo 'Restoring tools saved-objectsects...'
-       @if ! test -d tools/saved-objects; then exit 1; fi && \
-       (cd tools/saved-objects && pax -rw -pe -v . ../../.)
-
-tools/compiler.com: tools/syntaxer.com
-tools/compiler.com: cross-compiler
-tools/compiler.com: cross-cref
-tools/compiler.com: cross-sf
-tools/compiler.com: kludgerous-star-parser
-tools/compiler.com: runtime/host-adapter.scm
-       (echo '(begin' && \
-        echo '  (with-working-directory-pathname "cref"' && \
-        echo '    (lambda () (load "make")))' && \
-        echo '  (with-working-directory-pathname "sf"' && \
-        echo '    (lambda () (load "make")))' && \
-        echo '  (with-working-directory-pathname "star-parser"' && \
-        echo '    (lambda () (load "load")))' && \
-        echo '  (with-working-directory-pathname "compiler"' && \
-        echo '    (lambda () (load "make")))' && \
-        echo '  (disk-save "$@"))') \
-       | $(HOST_RUNTIME)
-
-tools/syntaxer.com: cross-cref
-tools/syntaxer.com: cross-sf
-tools/syntaxer.com: kludgerous-star-parser
-tools/syntaxer.com: runtime/host-adapter.scm
-       (echo '(begin' && \
-        echo '  (with-working-directory-pathname "cref"' && \
-        echo '    (lambda () (load "make")))' && \
-        echo '  (with-working-directory-pathname "sf"' && \
-        echo '    (lambda () (load "make")))' && \
-        echo '  (with-working-directory-pathname "star-parser"' && \
-        echo '    (lambda () (load "load")))' && \
-        echo '  (disk-save "$@"))') \
-       | $(HOST_RUNTIME)
-
-# Compiler (LIAR)
-
-.PHONY: cross-compiler
-@IF_DEBUG_TOOLCHAIN@cross-compiler: syntax-cross-compiler
-@IF_NOT_DEBUG_TOOLCHAIN@cross-compiler: compile-cross-compiler
-
-.PHONY: compile-cross-compiler
-compile-cross-compiler: compile-cross-compiler-back
-compile-cross-compiler: compile-cross-compiler-base
-compile-cross-compiler: compile-cross-compiler-fggen
-compile-cross-compiler: compile-cross-compiler-fgopt
-compile-cross-compiler: compile-cross-compiler-machine
-compile-cross-compiler: compile-cross-compiler-rtlbase
-compile-cross-compiler: compile-cross-compiler-rtlgen
-compile-cross-compiler: compile-cross-compiler-rtlopt
-
-.PHONY: compile-cross-compiler-back
-compile-cross-compiler-back: syntax-cross-compiler
-       echo '(compile-directory "compiler/back")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-base
-compile-cross-compiler-base: syntax-cross-compiler
-       echo '(compile-directory "compiler/base")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-fggen
-compile-cross-compiler-fggen: syntax-cross-compiler
-       echo '(compile-directory "compiler/fggen")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-fgopt
-compile-cross-compiler-fgopt: syntax-cross-compiler
-       echo '(compile-directory "compiler/fgopt")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-machine
-compile-cross-compiler-machine: syntax-cross-compiler
-       echo '(compile-directory "compiler/machine")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-rtlbase
-compile-cross-compiler-rtlbase: syntax-cross-compiler
-       echo '(compile-directory "compiler/rtlbase")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-rtlgen
-compile-cross-compiler-rtlgen: syntax-cross-compiler
-       echo '(compile-directory "compiler/rtlgen")' | $(HOST_COMPILER)
-
-.PHONY: compile-cross-compiler-rtlopt
-compile-cross-compiler-rtlopt: syntax-cross-compiler
-       echo '(compile-directory "compiler/rtlopt")' | $(HOST_COMPILER)
-
-# Must use HOST_SYNTAXER here because compiler.sf's (and, more
-# generally, CREF's) host/target distinction is bollocksed up, and will
-# do the wrong thing if there is already a compiler loaded into the
-# image.
-.PHONY: syntax-cross-compiler
-@IF_SVM@syntax-cross-compiler: compiler/machines/svm/assembler-db.scm
-syntax-cross-compiler: cref-cross-compiler
-       (echo '(with-working-directory-pathname "compiler"' && \
-        echo '  (lambda () (load "compiler.sf")))') \
-       | $(HOST_SYNTAXER)
-
-compiler/machines/svm/assembler-db.scm:
-       (cd compiler/machines/svm && \
-        '$(MIT_SCHEME_EXE)' --batch-mode --load compile-assembler </dev/null)
-
-.PHONY: cref-cross-compiler
-cref-cross-compiler: cref-cross-cref
-cref-cross-compiler: cref-cross-sf
-cref-cross-compiler: cref-kludgerous-runtime
-       (echo '(with-working-directory-pathname "compiler"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "compiler")))') \
-       | $(HOST_SYNTAXER)
-
-# CREF
-
-.PHONY: cross-cref
-@IF_DEBUG_TOOLCHAIN@cross-cref: syntax-cross-cref
-@IF_NOT_DEBUG_TOOLCHAIN@cross-cref: compile-cross-cref
-
-.PHONY: compile-cross-cref
-compile-cross-cref: syntax-cross-cref
-       (echo '(with-working-directory-pathname "cref"' && \
-        echo '  (lambda () (load "cref.cbf")))') \
-       | $(HOST_COMPILER)
-
-.PHONY: syntax-cross-cref
-syntax-cross-cref: cref-cross-cref
-       (echo '(with-working-directory-pathname "cref"' && \
-        echo '  (lambda () (load "cref.sf")))') \
-       | $(HOST_SYNTAXER)
-
-.PHONY: cref-cross-cref
-cref-cross-cref: cref-kludgerous-runtime
-       (echo '(with-working-directory-pathname "cref"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "cref")))') \
-       | $(HOST_SYNTAXER)
-
-# SF
-
-.PHONY: cross-sf
-@IF_DEBUG_TOOLCHAIN@cross-sf: syntax-cross-sf
-@IF_NOT_DEBUG_TOOLCHAIN@cross-sf: compile-cross-sf
-
-.PHONY: compile-cross-sf
-compile-cross-sf: syntax-cross-sf
-       (echo '(with-working-directory-pathname "sf"' && \
-        echo '  (lambda () (load "sf.cbf")))') \
-       | $(HOST_COMPILER)
-
-.PHONY: syntax-cross-sf
-syntax-cross-sf: cref-cross-sf
-       (echo '(with-working-directory-pathname "sf"' && \
-        echo '  (lambda () (load "sf.sf")))') \
-       | $(HOST_SYNTAXER)
-
-.PHONY: cref-cross-sf
-cref-cross-sf: cref-kludgerous-runtime
-       (echo '(with-working-directory-pathname "sf"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "sf")))') \
-       | $(HOST_SYNTAXER)
-
-# Kludges
-
-# XXX This is a kludge that should be abolished.  The compiler should
-# be able to load and run macros for the target even if we are cross-
-# compiling, but currently that's not doable.
-.PHONY: kludgerous-star-parser
-kludgerous-star-parser: compile-kludgerous-star-parser
-.PHONY: compile-kludgerous-star-parser
-compile-kludgerous-star-parser: cref-kludgerous-runtime
-       (echo '(with-working-directory-pathname "star-parser"' && \
-        echo '  (lambda () (load "compile")))') \
-       | $(HOST_TOOLCHAIN)
-
-# XXX This is a mega-kludge that should be abolished.  Parser.pkg has
-# (global-definitions "../../runtime"), which should refer to the
-# host's runtime packaging -- but that doesn't get installed anywhere!
-# So instead we pretend it refers to the target's runtime packaging
-# (which may be completely wrong for something we want to load into the
-# host).
-.PHONY: cref-kludgerous-runtime
-cref-kludgerous-runtime:
-       (echo '(with-working-directory-pathname "runtime"' && \
-        echo '  (lambda ()' && \
-        echo '    (cref/generate-trivial-constructor "runtime")))') \
-       | $(HOST_TOOLCHAIN)
index f978f07d125d7fada281065beb62dac0bb63a334..c7169c95116486a85c2f5c7705fcd63255004f72 100644 (file)
@@ -64,18 +64,6 @@ else
     IF_CROSS=\#
 fi
 
-AC_ARG_ENABLE([debug-toolchain],
-    AS_HELP_STRING([--enable-debug-toolchain],
-       [Use slow interpreted cross-compiler toolchain]))
-: ${enable_debug_toolchain=no}
-if test "x$enable_debug_toolchain" = xyes; then
-    IF_DEBUG_TOOLCHAIN=
-    IF_NOT_DEBUG_TOOLCHAIN=\#
-else
-    IF_DEBUG_TOOLCHAIN=\#
-    IF_NOT_DEBUG_TOOLCHAIN=
-fi
-
 AC_ARG_WITH([default-target],
     AS_HELP_STRING([--with-default-target],
        [Set the default make target [[all]]]))
@@ -181,7 +169,7 @@ fi
 small_words='(= 4 (vector-ref (gc-space-status) 0))'
 if test x"${mit_scheme_native_code}" = xsvm1 \
    && ${MIT_SCHEME_EXE} --eval "(%exit (if ${small_words} 0 1))"; then \
-    TOOL_TOOLCHAIN_HEAP="--heap 10000"
+    HOST_COMPILER_HEAP="--heap 10000"
 fi
 
 AC_SUBST([DEFAULT_TARGET])
@@ -192,11 +180,9 @@ AC_SUBST([MIT_SCHEME_EXE])
 AC_SUBST([AUXDIR_NAME])
 AC_SUBST([AUXDIR])
 AC_SUBST([IF_CROSS])
-AC_SUBST([IF_DEBUG_TOOLCHAIN])
 AC_SUBST([IF_LIARC])
-AC_SUBST([IF_NOT_DEBUG_TOOLCHAIN])
 AC_SUBST([IF_SVM])
-AC_SUBST([TOOL_TOOLCHAIN_HEAP])
+AC_SUBST([HOST_COMPILER_HEAP])
 
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -210,7 +196,6 @@ AC_CONFIG_SUBDIRS([microcode])
 
 AC_CONFIG_FILES([
 Makefile
-Makefile.tools
 6001/Makefile
 compiler/Makefile
 cref/Makefile
index f9d65d81da0fa5197ac6123d0d199204efcb1065..575bc91a290b067597a81d495300a1aa6c2d895d 100644 (file)
@@ -202,6 +202,39 @@ USA.
                    'undefined-conditional-branch
                    'undefined-scode-conditional-branch))
 
+  (if (name->package '(scode-optimizer))
+      (begin
+       (let ((env (->environment '(scode-optimizer))))
+         (eval '(if (not (memq scode-lambda-name:unnamed
+                               global-constant-objects))
+                    (begin
+                      (set! global-constant-objects
+                            (cons 'scode-lambda-name:unnamed
+                                  global-constant-objects))
+                      (usual-integrations/cache!)))
+               env))
+       (let ((env (->environment '(scode-optimizer expansion))))
+         (eval '(let ((remove-one
+                       (lambda (name)
+                         (set! usual-integrations/expansion-alist
+                               (del-assq! name
+                                          usual-integrations/expansion-alist))
+                         #t)))
+                  (remove-one 'set-string-length!)
+                  (remove-one 'string->char-syntax)
+                  (remove-one 'string-allocate)
+                  (remove-one 'string-length)
+                  (remove-one 'string-ref)
+                  (remove-one 'string-set!)
+                  (remove-one 'string?)
+                  (remove-one 'vector-8b-ref)
+                  (remove-one 'vector-8b-set!)
+                  (set! usual-integrations/expansion-names
+                        (map car usual-integrations/expansion-alist))
+                  (set! usual-integrations/expansion-values
+                        (map cdr usual-integrations/expansion-alist)))
+               env))))
+
   (let ((env (->environment '(runtime))))
     (if (unbound? env 'select-on-bytes-per-word)
        (eval '(define-syntax select-on-bytes-per-word
index 15c4b2ec7d788e7267ea1f249c1cd2ea886612f3..cafe8e5e83a424d4739256e5f3f12957166b20dd 100644 (file)
@@ -26,7 +26,6 @@ USA.
 
 (load-option '*parser)                 ;for url.scm
 (fluid-let ((sf/default-syntax-table (->environment '(runtime))))
-  (load "host-adapter.scm")
   (sf-conditionally "graphics")
   (sf-conditionally "infstr")
   (sf-directory "."))