From 91e3f58e72d13cd2c3d0cf725dca5f5580ef8098 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 2 Dec 2007 06:24:29 +0000 Subject: src/boot/ 2007-12-02 Gabriel Dos Reis * 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 * 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/boot/ChangeLog | 7 +++++++ src/boot/Makefile.in | 14 +++++++++++--- src/boot/Makefile.pamphlet | 14 +++++++++++--- src/interp/parse.boot | 1 - src/lisp/ChangeLog | 11 +++++++++++ src/lisp/Makefile.in | 18 +++++++++++++++--- src/lisp/Makefile.pamphlet | 18 +++++++++++++++--- src/lisp/core.lisp.in | 30 +++++++++++++++++------------- 8 files changed, 87 insertions(+), 26 deletions(-) diff --git a/src/boot/ChangeLog b/src/boot/ChangeLog index 8e2680ec..cf135562 100644 --- a/src/boot/ChangeLog +++ b/src/boot/ChangeLog @@ -1,3 +1,10 @@ +2007-12-02 Gabriel Dos Reis + + * Makefile.pamphlet (boot_objects_extra): New. + (stage0/bootsys$(EXEEXT)): Use it. + (stage1/bootsys$(EXEEXT)): Likewise. + (stage2/bootsys$(EXEEXT)): Likewise. + 2007-11-18 Gabriel Dos Reis * ast.boot.pamphlet (bfReduce): Compute left reduction, not right diff --git a/src/boot/Makefile.in b/src/boot/Makefile.in index 262d6d8f..013cf2bf 100644 --- a/src/boot/Makefile.in +++ b/src/boot/Makefile.in @@ -4,6 +4,14 @@ PROCLAIMS=(load "$(srcdir)/boot-proclaims.lisp") boot_objects = initial-env.$(FASLEXT) $(boot_sources:.boot=.$(FASLEXT)) +## ECL's program construction model is not based on image-dumping. It is +## closer to `traditional C' application building. Therefore, since +## bootsys is an augmentation of base-lisp, we need to have the objects +## that made up base-lisp too. +ifeq (@axiom_lisp_flavor@,ecl) +boot_objects_extra = ../lisp/core.$(FASLEXT) +endif + boot_SOURCES = \ initial-env.lisp.pamphlet \ $(addsuffix .pamphlet, $(boot_sources)) @@ -53,7 +61,7 @@ stage0/stamp: stage0/bootsys$(EXEEXT) stage0/bootsys$(EXEEXT): $(stage0_boot_objects) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|"\ --output=$@ --load-directory=stage0 \ - $(stage0_boot_objects) + $(boot_objects_extra) $(stage0_boot_objects) .PRECIOUS: %/.started @@ -79,7 +87,7 @@ stage1/stamp: stage1/bootsys$(EXEEXT) stage1/bootsys$(EXEEXT): $(addprefix stage1/, $(boot_objects)) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \ --output=$@ --load-directory=stage1 \ - $(addprefix stage1/, $(boot_objects)) + $(boot_objects_extra) $(addprefix stage1/, $(boot_objects)) stage1/%.clisp: %.boot stage0/stamp stage1/.started stage0/bootsys -- --translate --output=$@ $< @@ -94,7 +102,7 @@ stage2/stamp: stage2/bootsys$(EXEEXT) stage2/bootsys$(EXEEXT): $(addprefix stage2/, $(boot_objects)) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \ --output=$@ --load-directory=stage2 \ - $(addprefix stage2/, $(boot_objects)) + $(boot_objects_extra) $(addprefix stage2/, $(boot_objects)) stage2/%.clisp: %.boot stage1/stamp stage2/.started stage1/bootsys -- --translate --output=$@ $< diff --git a/src/boot/Makefile.pamphlet b/src/boot/Makefile.pamphlet index d4e26ccc..6555b896 100644 --- a/src/boot/Makefile.pamphlet +++ b/src/boot/Makefile.pamphlet @@ -1215,6 +1215,14 @@ boot translator image. <>= boot_objects = initial-env.$(FASLEXT) $(boot_sources:.boot=.$(FASLEXT)) +## ECL's program construction model is not based on image-dumping. It is +## closer to `traditional C' application building. Therefore, since +## bootsys is an augmentation of base-lisp, we need to have the objects +## that made up base-lisp too. +ifeq (@axiom_lisp_flavor@,ecl) +boot_objects_extra = ../lisp/core.$(FASLEXT) +endif + boot_SOURCES = \ initial-env.lisp.pamphlet \ $(addsuffix .pamphlet, $(boot_sources)) @@ -1400,7 +1408,7 @@ stage0/stamp: stage0/bootsys$(EXEEXT) stage0/bootsys$(EXEEXT): $(stage0_boot_objects) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|"\ --output=$@ --load-directory=stage0 \ - $(stage0_boot_objects) + $(boot_objects_extra) $(stage0_boot_objects) .PRECIOUS: %/.started @@ -1431,7 +1439,7 @@ stage1/stamp: stage1/bootsys$(EXEEXT) stage1/bootsys$(EXEEXT): $(addprefix stage1/, $(boot_objects)) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \ --output=$@ --load-directory=stage1 \ - $(addprefix stage1/, $(boot_objects)) + $(boot_objects_extra) $(addprefix stage1/, $(boot_objects)) stage1/%.clisp: %.boot stage0/stamp stage1/.started stage0/bootsys -- --translate --output=$@ $< @@ -1451,7 +1459,7 @@ stage2/stamp: stage2/bootsys$(EXEEXT) stage2/bootsys$(EXEEXT): $(addprefix stage2/, $(boot_objects)) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \ --output=$@ --load-directory=stage2 \ - $(addprefix stage2/, $(boot_objects)) + $(boot_objects_extra) $(addprefix stage2/, $(boot_objects)) stage2/%.clisp: %.boot stage1/stamp stage2/.started stage1/bootsys -- --translate --output=$@ $< diff --git a/src/interp/parse.boot b/src/interp/parse.boot index b4cf2d73..92e70aaf 100644 --- a/src/interp/parse.boot +++ b/src/interp/parse.boot @@ -486,7 +486,6 @@ scriptTranRow1 x == parseVCONS l == ["VECTOR",:parseTranList l] - --% Register special parsers. for x in [["<=", :function parseLessEqual],_ 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 + + * 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 * 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