+# -*-makefile-*-
# 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
MIT_SCHEME_EXE = @MIT_SCHEME_EXE@
-HOST_COMPILER = $(HOST_TOOLCHAIN)
-HOST_RUNTIME = '$(MIT_SCHEME_EXE)' --batch-mode --band runtime.com
-HOST_SYNTAXER = '$(MIT_SCHEME_EXE)' --batch-mode --band runtime.com \
- --eval '(load-option (quote CREF))' \
- --eval '(load-option (quote SF))'
-HOST_TOOLCHAIN = '$(MIT_SCHEME_EXE)' --batch-mode \
- --eval '(load-option (quote CREF))'
+HOST_COMPILER = $(MIT_SCHEME_EXE) --batch-mode
+CROSS_SYNTAXER = '$(MIT_SCHEME_EXE)' --batch-mode --band ./tools/syntaxer.com
+HOST_SYNTAXER = '$(MIT_SCHEME_EXE)' --batch-mode
SUBDIRS = compiler cref runtime sf star-parser
tools/compiler.com: tools/syntaxer.com
tools/compiler.com: compile-cross-compiler
-tools/compiler.com: compile-cross-cref
-tools/compiler.com: compile-cross-sf
-tools/compiler.com: compile-kludgerous-star-parser
(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)
+ | $(CROSS_SYNTAXER)
+tools/syntaxer.com: compile-cross-runtime
tools/syntaxer.com: compile-cross-cref
tools/syntaxer.com: compile-cross-sf
-tools/syntaxer.com: compile-kludgerous-star-parser
+tools/syntaxer.com: compile-cross-star-parser
(echo '(begin' && \
- echo ' (with-working-directory-pathname "cref"' && \
+ echo ' (with-working-directory-pathname "../cref"' && \
echo ' (lambda () (load "make")))' && \
- echo ' (with-working-directory-pathname "sf"' && \
+ echo ' (with-working-directory-pathname "../sf"' && \
echo ' (lambda () (load "make")))' && \
- echo ' (with-working-directory-pathname "star-parser"' && \
+ echo ' (with-working-directory-pathname "../star-parser"' && \
echo ' (lambda () (load "load")))' && \
- echo ' (disk-save "$@"))') \
- | $(HOST_RUNTIME)
+ echo ' (disk-save "../$@"))') \
+ | (cd runtime && '$(MIT_SCHEME_EXE)' --batch-mode --fasl make.com)
# Compiler (LIAR)
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
+syntax-cross-compiler: tools/syntaxer.com
@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)
+ | $(CROSS_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")))') \
+# RUNTIME
+
+.PHONY: compile-cross-runtime
+compile-cross-runtime: syntax-cross-runtime
+ (echo '(with-working-directory-pathname "runtime"' && \
+ echo ' (lambda () (load "runtime.cbf")))') \
+ | $(HOST_COMPILER)
+
+.PHONY: syntax-cross-runtime
+syntax-cross-runtime:
+ (echo '(with-working-directory-pathname "runtime"' && \
+ echo ' (lambda () (load "runtime.sf")))') \
| $(HOST_SYNTAXER)
# CREF
| $(HOST_COMPILER)
.PHONY: syntax-cross-cref
-syntax-cross-cref: cref-cross-cref
+syntax-cross-cref: compile-cross-runtime # for runtime.pkd
(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: compile-cross-sf
| $(HOST_COMPILER)
.PHONY: syntax-cross-sf
-syntax-cross-sf: cref-cross-sf
+syntax-cross-sf: compile-cross-runtime # for runtime.pkd
(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
+# *PARSER
-# 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: compile-kludgerous-star-parser
-compile-kludgerous-star-parser: cref-kludgerous-runtime
+.PHONY: compile-cross-star-parser
+compile-cross-star-parser: compile-cross-runtime # for runtime.pkd
(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)
+ echo ' (lambda () (load "compile.scm")))') \
+ | $(HOST_COMPILER)