From 91e3f58e72d13cd2c3d0cf725dca5f5580ef8098 Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Sun, 2 Dec 2007 06:24:29 +0000
Subject: src/boot/ 2007-12-02  Gabriel Dos Reis  <gdr@cs.tamu.edu>

	* Makefile.pamphlet (boot_objects_extra): New.
	(stage0/bootsys$(EXEEXT)): Use it.
	(stage1/bootsys$(EXEEXT)): Likewise.
	(stage2/bootsys$(EXEEXT)): Likewise.

src/lisp/
2007-12-02  Gabriel Dos Reis  <gdr@cs.tamu.edu>

	* Makefile.pamphlet (base_lisp_objects): New. Abstract over
	Lisp compilation models.
	(core.$(FASLEXT)): Tidy.
	* core.lisp.in (|getOutputPathname|): Make unary.
	(|link|): Make sure object files are used to construct ECL
	programs.
	(|makeHandler|): Adjust.
	(|compileLispFile|): Likewise.
---
 src/lisp/ChangeLog         | 11 +++++++++++
 src/lisp/Makefile.in       | 18 +++++++++++++++---
 src/lisp/Makefile.pamphlet | 18 +++++++++++++++---
 src/lisp/core.lisp.in      | 30 +++++++++++++++++-------------
 4 files changed, 58 insertions(+), 19 deletions(-)

(limited to 'src/lisp')

diff --git a/src/lisp/ChangeLog b/src/lisp/ChangeLog
index 14dc4c84..58511687 100644
--- a/src/lisp/ChangeLog
+++ b/src/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2007-12-02  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+	* Makefile.pamphlet (base_lisp_objects): New. Abstract over
+	Lisp compilation models.
+	(core.$(FASLEXT)): Tidy.
+	* core.lisp.in (|getOutputPathname|): Make unary.
+	(|link|): Make sure object files are used to construct ECL
+	programs. 
+	(|makeHandler|): Adjust.
+	(|compileLispFile|): Likewise.
+
 2007-10-10  Gabriel Dos Reis  <gdr@cs.tamu.edu>
 
 	* core.lisp.in (|%systemOptions|): New.
diff --git a/src/lisp/Makefile.in b/src/lisp/Makefile.in
index 870a838d..b2288482 100644
--- a/src/lisp/Makefile.in
+++ b/src/lisp/Makefile.in
@@ -73,11 +73,17 @@ ifeq (@axiom_lisp_flavor@,gcl)
 	$(INSTALL_PROGRAM) lisp$(EXEEXT) $(OUT)
 endif
 
+ifeq (@axiom_lisp_flavor@,ecl)
+base_lisp_objects = ("core.$(OBJEXT)")
+else
+base_lisp_objects = nil
+endif
+
 
 base-lisp$(EXEEXT): core.$(FASLEXT)
 	$(AXIOM_LISP) \
 		$(eval_flags) '(load "core")' \
-		$(eval_flags) '(|AxiomCore|::|link| "$@" (quote nil) (function |AxiomCore|::|topLevel|))'
+		$(eval_flags) '(|AxiomCore|::|link| "$@" (quote $(base_lisp_objects)) (quote |AxiomCore|::|topLevel|))'
 
 
 axiom_optimize_options = @axiom_optimize_options@
@@ -94,10 +100,16 @@ core.lisp: $(srcdir)/core.lisp.in
 	$(top_srcdir)/config/move-if-change $@.tmp $@
 
 core.$(FASLEXT): core.lisp
+ifeq (@axiom_lisp_flavor@,ecl)
 	$(AXIOM_LISP) $(quiet_flags) \
-		$(eval_flags) '(progn #-:ecl (compile-file "$<"))' \
-		$(eval_flags) '(progn #+:ecl (progn (require (quote cmp)) (compile-file "$<" :system-p t) (c::build-fasl "$@" :lisp-files (quote ("core.$(OBJEXT)")))))' \
+		$(eval_flags) '(require (quote cmp))' \
+		$(eval_flags) '(compile-file "$<" :system-p t)' \
+		$(eval_flags) '(c::build-fasl "$@" :lisp-files (quote ("core.$(OBJEXT)")))' \
 		$(eval_flags) '(quit)'
+else
+	$(AXIOM_LISP) $(quiet_flags) \
+		$(eval_flags) '(progn (compile-file "$<") (quit))'
+endif
 
 
 mostlyclean-local:
diff --git a/src/lisp/Makefile.pamphlet b/src/lisp/Makefile.pamphlet
index 76809b71..4fe2bacd 100644
--- a/src/lisp/Makefile.pamphlet
+++ b/src/lisp/Makefile.pamphlet
@@ -60,11 +60,17 @@ ifeq (@axiom_lisp_flavor@,gcl)
 	$(INSTALL_PROGRAM) lisp$(EXEEXT) $(OUT)
 endif
 
+ifeq (@axiom_lisp_flavor@,ecl)
+base_lisp_objects = ("core.$(OBJEXT)")
+else
+base_lisp_objects = nil
+endif
+
 
 base-lisp$(EXEEXT): core.$(FASLEXT)
 	$(AXIOM_LISP) \
 		$(eval_flags) '(load "core")' \
-		$(eval_flags) '(|AxiomCore|::|link| "$@" (quote nil) (function |AxiomCore|::|topLevel|))'
+		$(eval_flags) '(|AxiomCore|::|link| "$@" (quote $(base_lisp_objects)) (quote |AxiomCore|::|topLevel|))'
 
 
 axiom_optimize_options = @axiom_optimize_options@
@@ -81,10 +87,16 @@ core.lisp: $(srcdir)/core.lisp.in
 	$(top_srcdir)/config/move-if-change $@.tmp $@
 
 core.$(FASLEXT): core.lisp
+ifeq (@axiom_lisp_flavor@,ecl)
 	$(AXIOM_LISP) $(quiet_flags) \
-		$(eval_flags) '(progn #-:ecl (compile-file "$<"))' \
-		$(eval_flags) '(progn #+:ecl (progn (require (quote cmp)) (compile-file "$<" :system-p t) (c::build-fasl "$@" :lisp-files (quote ("core.$(OBJEXT)")))))' \
+		$(eval_flags) '(require (quote cmp))' \
+		$(eval_flags) '(compile-file "$<" :system-p t)' \
+		$(eval_flags) '(c::build-fasl "$@" :lisp-files (quote ("core.$(OBJEXT)")))' \
 		$(eval_flags) '(quit)'
+else
+	$(AXIOM_LISP) $(quiet_flags) \
+		$(eval_flags) '(progn (compile-file "$<") (quit))'
+endif
 
 @
 
diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in
index 3a5ef1ee..9b02b4df 100644
--- a/src/lisp/core.lisp.in
+++ b/src/lisp/core.lisp.in
@@ -238,9 +238,9 @@
 ;; current image and dumping the result on disk as an executable.
 
 
-(defun |getOutputPathname| (options &optional (default-output "a.out"))
+(defun |getOutputPathname| (options)
   (let ((output-option (assoc (|Option| "output") options)))
-    (if output-option
+    (when output-option
         ;; If an output file name was specified on the command line, it
         ;; is so relative to the current workding directory.  In 
         ;; particular we want to prevent overly zelous SBCL to mess
@@ -249,8 +249,7 @@
         ;; most cases, it is OK.
         #+:sbcl (merge-pathnames (cdr output-option)
                                  *default-pathname-defaults*)
-        #-:sbcl (cdr output-option)
-        default-output)))
+        #-:sbcl (cdr output-option))))
 
 
 (defun |getMainEntryPoint| (options)
@@ -434,6 +433,9 @@
 ;; ENTRY-POINT is the entry point of the program.  If not supplied, or
 ;; if null, then the entry entry is supposed to be the top level
 ;; read-eval-print loop of original Lisp system.
+;; Note, despite the name LISP-FILEs, we do not expect bare Lisp source
+;; files here.  We do insist on FASLs.  There is no check for that at
+;; this point.  You have been warned.
 (defun |link| (core-image lisp-files &optional (entry-point nil))
   (if (and entry-point (stringp entry-point))
       (setq entry-point `(read-from-string ,entry-point)))
@@ -444,8 +446,8 @@
            (unless entry-point
              (setq entry-point si::top-level))
            (c:build-program core-image 
-                            :lisp-files lisp-files
-                            :epilogue-code `(funcall ,entry-point))
+                            :lisp-files (mapcar #'|compileFilePathname| lisp-files)
+                            :epilogue-code `(,entry-point))
            (|coreQuit|)))
 
 
@@ -534,7 +536,9 @@
   (unless (> (length args) 0)
     (|fatalError| "--make requires at least one file"))
 
-  (|link| (|getOutputPathname| options) args (|getMainEntryPoint| options))
+  (|link| (or (|getOutputPathname| options) "a.out") 
+          args 
+          (|getMainEntryPoint| options))
   (|coreQuit|))
 
 (|installDriver| (|Option| "make") #'|makeHandler|)
@@ -589,9 +593,10 @@
 ;; standalone programs.  Consequently we must convince ECL to produce
 ;; object files.  Notice that when program components require that
 ;; previously compiled files be loaded in the startup environment, 
-;; the system will load the FASL file.  So, we end up compiling
-;; twice: once as object code, once as FASL.  That is surely wrong.  There
-;; me be ways to build one from the one with less work.
+;; the system will load the FASL file.  So, we end up with a 2-step
+;; compilation process for ECL:
+;;   (1) compile as object code;
+;;   (2) build a FASL from the result of (1).
 (defun |compileLispFile| (file out-file)
   ;; When OUT-FILE does not have a specified parent directory, it is
   ;; implied that the compiled file is placed in the current directory.
@@ -631,8 +636,8 @@
 
 (defun |compileLispHandler| (prog-name options in-file)
   (declare (ignore prog-name))
-  (let ((out-file (|getOutputPathname| options 
-                                       (|compileFilePathname| in-file))))
+  (let ((out-file (|compileFilePathname| (or (|getOutputPathname| options)
+					     in-file))))
     (|compileLispFile| in-file out-file)))
 
 (|associateRequestWithFileType| (|Option| "compile") |$LispFileType|
@@ -744,7 +749,6 @@
            #-:common-lisp (compile load eval)
                      (|importModule| ,module))))
 
-
 ;; 
 ;; -*- Feature Tests in Boot -*-
 ;; 
-- 
cgit v1.2.3