diff options
author | dos-reis <gdr@axiomatics.org> | 2008-08-13 17:42:35 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-08-13 17:42:35 +0000 |
commit | 22e34c3f799e43cba446af4bae3b5557df74b0e7 (patch) | |
tree | 73a283aaa8c6bf30d49bbf26b44b44b2769bfea4 /src | |
parent | cd4b966f39550403099a0abf1e993af1e7e79139 (diff) | |
download | open-axiom-22e34c3f799e43cba446af4bae3b5557df74b0e7.tar.gz |
* lisp/core.lisp.in (LINKSET-FROM): New.
(SYSTEM-SUBDIRECTORY): Likewise.
(LINKSET-FROM-IF): Likewise.
(COMPLETE-FASL-LIST-FOR-LINK): Use it.
(getPrologue): New.
(link): Take an additional optional parameter for prologue. Tidy.
(makeHandler): Adjust.
* lisp/Makefile.in: Use LNKEXT where appropriate.
(oa_base_lisp_linkset): New.
($(oa_target_lispdir)/core.$(LNKEXT)): New rule.
(base-lisp$(EXEEXT)): Now depends on $(oa_base_lisp_linkset).
(mostlyclean-local): Remove $(oa_target_lispdir) too.
* boot/Makefile.in: Use LNKEXT instead of FASLEXT.
(boot_objects_extra): Remove.
(oa_target_bootdir): New.
(oa_boot_linkset): Likewise.
(stamp): Require $(oa_boot_linkset).
($(oa_target_bootdir)/%.$(LNKEXT)): New rule.
(strap/bootsys$(EXEEXT)): Add prologue code.
(stage1/bootsys$(EXEEXT)): Likewise.
(stage2/bootsys$(EXEEXT)): Likewise.
(mostlyclean-local): Remove $(oa_target_bootdir) too.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 25 | ||||
-rw-r--r-- | src/boot/Makefile.in | 68 | ||||
-rw-r--r-- | src/lisp/Makefile.in | 29 | ||||
-rw-r--r-- | src/lisp/core.lisp.in | 44 |
4 files changed, 123 insertions, 43 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bf490f90..deb2deb6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,28 @@ +2008-08-13 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * lisp/core.lisp.in (LINKSET-FROM): New. + (SYSTEM-SUBDIRECTORY): Likewise. + (LINKSET-FROM-IF): Likewise. + (COMPLETE-FASL-LIST-FOR-LINK): Use it. + (getPrologue): New. + (link): Take an additional optional parameter for prologue. Tidy. + (makeHandler): Adjust. + * lisp/Makefile.in: Use LNKEXT where appropriate. + (oa_base_lisp_linkset): New. + ($(oa_target_lispdir)/core.$(LNKEXT)): New rule. + (base-lisp$(EXEEXT)): Now depends on $(oa_base_lisp_linkset). + (mostlyclean-local): Remove $(oa_target_lispdir) too. + * boot/Makefile.in: Use LNKEXT instead of FASLEXT. + (boot_objects_extra): Remove. + (oa_target_bootdir): New. + (oa_boot_linkset): Likewise. + (stamp): Require $(oa_boot_linkset). + ($(oa_target_bootdir)/%.$(LNKEXT)): New rule. + (strap/bootsys$(EXEEXT)): Add prologue code. + (stage1/bootsys$(EXEEXT)): Likewise. + (stage2/bootsys$(EXEEXT)): Likewise. + (mostlyclean-local): Remove $(oa_target_bootdir) too. + 2008-08-12 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/patches.lisp (RESTART0): Don't duplicate code; call diff --git a/src/boot/Makefile.in b/src/boot/Makefile.in index bbb17612..ab05adca 100644 --- a/src/boot/Makefile.in +++ b/src/boot/Makefile.in @@ -56,21 +56,20 @@ boot_SOURCES = initial-env.lisp $(boot_sources) boot_sources = tokens.boot includer.boot scanner.boot \ pile.boot ast.boot parser.boot translator.boot boot_clisp = $(boot_sources:.boot=.clisp) -boot_objects = initial-env.$(FASLEXT) $(boot_sources:.boot=.$(FASLEXT)) +boot_objects = initial-env.$(LNKEXT) $(boot_sources:.boot=.$(LNKEXT)) + +oa_target_bootdir = $(axiom_targetdir)/boot +ifeq (@axiom_lisp_flavor@,ecl) +oa_boot_linkset = \ + $(addprefix $(oa_target_bootdir)/, $(boot_objects)) +else +oa_boot_linkset = +endif # Garbage produced by GCL during compilation boot_data = $(boot_sources:.boot=.data) boot_fn = $(boot_sources:.boot=.fn) -## -## 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 - # reference to this directory from toplevel subdir = src/boot/ @@ -80,7 +79,7 @@ all: all-ax all-boot all-ax all-boot: stamp -stamp: $(axiom_target_bindir)/bootsys$(EXEEXT) +stamp: $(axiom_target_bindir)/bootsys$(EXEEXT) $(oa_boot_linkset) @rm -f stamp $(STAMP) $@ @@ -89,7 +88,14 @@ $(axiom_target_bindir)/bootsys$(EXEEXT): stage2/bootsys$(EXEEXT) $(mkdir_p) $(axiom_target_bindir) cp -p $< $@ +$(oa_target_bootdir)/%.$(LNKEXT): stage2/%.$(LNKEXT) $(oa_target_bootdir) + cp $< $@ + +$(oa_target_bootdir): + $(mkdir_p) $(oa_target_bootdir) + .PRECIOUS: strap/%.$(FASLEXT) +.PRECIOUS: strap/%.$(LNKEXT) ## ## The bootstrapping `bootsys' image. @@ -108,8 +114,9 @@ strap/stamp: strap/bootsys$(EXEEXT) strap/bootsys$(EXEEXT): $(strap_boot_objects) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|"\ - --output=$@ --load-directory=strap \ - $(boot_objects_extra) $(strap_boot_objects) + --system=$(axiom_targetdir) \ + --prologue='(pushnew :open-axiom-boot *features*)' \ + --output=$@ --load-directory=strap $(strap_boot_objects) $(strap_boot_objects): $(AXIOM_LOCAL_LISP) @@ -119,6 +126,7 @@ $(strap_boot_objects): $(AXIOM_LOCAL_LISP) ## .PRECIOUS: stage1/%.$(FASLEXT) +.PRECIOUS: stage1/%.$(LNKEXT) .PRECIOUS: stage1/%.clisp stage1_boot_clisp = $(addprefix stage1/, $(boot_clisp)) @@ -132,8 +140,9 @@ stage1/stamp: stage1/bootsys$(EXEEXT) stage1/bootsys$(EXEEXT): $(stage1_boot_objects) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \ - --output=$@ --load-directory=stage1 \ - $(boot_objects_extra) $(stage1_boot_objects) + --system=$(axiom_targetdir) \ + --prologue='(pushnew :open-axiom-boot *features*)' \ + --output=$@ --load-directory=stage1 $(stage1_boot_objects) stage1/%.clisp: %.boot strap/stamp stage1/.started strap/bootsys -- --translate --output=$@ $< @@ -144,6 +153,7 @@ stage1/%.clisp: %.boot strap/stamp stage1/.started ## .PRECIOUS: stage2/%.$(FASLEXT) +.PRECIOUS: stage2/%.$(LNKEXT) .PRECIOUS: stage2/%.clisp stage2_boot_clisp = $(addprefix stage2/, $(boot_clisp)) @@ -157,8 +167,9 @@ stage2/stamp: stage2/bootsys$(EXEEXT) stage2/bootsys$(EXEEXT): $(stage2_boot_objects) $(AXIOM_LOCAL_LISP) -- --make --main="|AxiomCore|::|topLevel|" \ - --output=$@ --load-directory=stage2 \ - $(boot_objects_extra) $(stage2_boot_objects) + --system=$(axiom_targetdir) \ + --prologue='(pushnew :open-axiom-boot *features*)' \ + --output=$@ --load-directory=stage2 $(stage2_boot_objects) stage2/%.clisp: %.boot stage1/stamp stage2/.started stage1/bootsys -- --translate --output=$@ $< @@ -176,31 +187,31 @@ stage2/%.clisp: %.boot stage1/stamp stage2/.started ## FIXME: This should be automatically extracted from the ## Boot source file at packaging time. -%/initial-env.$(FASLEXT): initial-env.lisp %/.started +%/initial-env.$(LNKEXT): initial-env.lisp %/.started $(AXIOM_LOCAL_LISP) -- --compile --output=$@ $< -%/tokens.$(FASLEXT): %/tokens.clisp %/initial-env.$(FASLEXT) +%/tokens.$(LNKEXT): %/tokens.clisp %/initial-env.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< -%/includer.$(FASLEXT): %/includer.clisp %/tokens.$(FASLEXT) +%/includer.$(LNKEXT): %/includer.clisp %/tokens.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< -%/scanner.$(FASLEXT): %/scanner.clisp %/tokens.$(FASLEXT) %/includer.$(FASLEXT) +%/scanner.$(LNKEXT): %/scanner.clisp %/tokens.$(LNKEXT) %/includer.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< -%/pile.$(FASLEXT): %/pile.clisp %/scanner.$(FASLEXT) %/includer.$(FASLEXT) +%/pile.$(LNKEXT): %/pile.clisp %/scanner.$(LNKEXT) %/includer.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< -%/ast.$(FASLEXT): %/ast.clisp %/includer.$(FASLEXT) +%/ast.$(LNKEXT): %/ast.clisp %/includer.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< -%/parser.$(FASLEXT): %/parser.clisp %/ast.$(FASLEXT) %/scanner.$(FASLEXT) \ - %/includer.$(FASLEXT) +%/parser.$(LNKEXT): %/parser.clisp %/ast.$(LNKEXT) %/scanner.$(LNKEXT) \ + %/includer.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< -%/translator.$(FASLEXT): %/translator.clisp %/parser.$(FASLEXT) \ - %/ast.$(FASLEXT) %/pile.$(FASLEXT) %/scanner.$(FASLEXT) \ - %/includer.$(FASLEXT) +%/translator.$(LNKEXT): %/translator.clisp %/parser.$(LNKEXT) \ + %/ast.$(LNKEXT) %/pile.$(LNKEXT) %/scanner.$(LNKEXT) \ + %/includer.$(LNKEXT) $(AXIOM_LOCAL_LISP) -- --output=$@ --compile --load-directory=$* $< @@ -212,6 +223,7 @@ mostlyclean-local: @rm -f $(axiom_target_bindir)/bootsys$(EXEEXT) @rm -rf prev-stage @rm -rf strap stage1 stage2 + @rm -rf $(oa_target_bootdir) @rm -f *.data *.fn @rm -f stamp diff --git a/src/lisp/Makefile.in b/src/lisp/Makefile.in index be8f7f0a..4ca6535e 100644 --- a/src/lisp/Makefile.in +++ b/src/lisp/Makefile.in @@ -31,6 +31,7 @@ OUT = $(axiom_build_bindir) +oa_target_lispdir = $(axiom_targetdir)/lisp subdir = src/lisp/ @@ -55,6 +56,16 @@ GCL_LTLD = $(if $(findstring mingw, $(target)),"","$(LIBTOOL) --mode=link ") fasl_ext = $(if $(findstring mingw, $(target)),.lisp,.$(FASLEXT)) FASLS = $(patsubst %,"%", $(addsuffix $(fasl_ext),core)) + +ifeq (@axiom_lisp_flavor@,ecl) +base_lisp_objects = ("core.$(LNKEXT)") +oa_base_lisp_linkset = $(oa_target_lispdir)/core.$(LNKEXT) +else +base_lisp_objects = nil +oa_base_lisp_linkset = +endif + + .PHONY: all all-lisp all: all-ax all-lisp @@ -64,6 +75,11 @@ stamp: $(OUT)/lisp$(EXEEXT) @rm -f stamp $(STAMP) $@ +$(oa_target_lispdir)/core.$(LNKEXT): core.$(LNKEXT) + $(mkdir_p) $(oa_target_lispdir)/ + cp $< $@ + + ## Create a fresh image for building interpsys and AXIOMsys ## These objects files are the C runtime support ## and must be compiled into the Lisp image, @@ -101,14 +117,7 @@ else cp -p $< $@ && cp -p $< lisp$(EXEEXT) endif -ifeq (@axiom_lisp_flavor@,ecl) -base_lisp_objects = ("core.$(OBJEXT)") -else -base_lisp_objects = nil -endif - - -base-lisp$(EXEEXT): core.$(FASLEXT) +base-lisp$(EXEEXT): core.$(FASLEXT) $(oa_base_lisp_linkset) $(AXIOM_LISP) \ $(eval_flags) '(load "core")' \ $(eval_flags) '(|AxiomCore|::|link| "$@" (quote $(base_lisp_objects)) "|AxiomCore|::|topLevel|")' @@ -133,6 +142,7 @@ edit = sed \ -e 's|@SHREXT[@]|$(SHREXT)|g' \ -e 's|@LIBEXT[@]|$(LIBEXT)|g' \ -e 's|@oa_c_runtime_extra[@]|$(oa_c_runtime_extra)|g' \ + -e 's|@oa_base_lisp_linkset[@]|$(base_lisp_objects)|g' \ -e 's|@void_type[@]|$(void_type)|g' \ -e 's|@char_type[@]|$(char_type)|g' \ -e 's|@int_type[@]|$(int_type)|g' \ @@ -150,7 +160,7 @@ ifeq (@axiom_lisp_flavor@,ecl) $(AXIOM_LISP) $(quiet_flags) \ $(eval_flags) '(require (quote cmp))' \ $(eval_flags) '(compile-file "$<" :system-p t)' \ - $(eval_flags) '(c::build-fasl "$@" :lisp-files (quote ("core.$(OBJEXT)")))' \ + $(eval_flags) '(c::build-fasl "$@" :lisp-files (quote ("core.$(LNKEXT)")))' \ $(eval_flags) '(quit)' else $(AXIOM_LISP) $(quiet_flags) \ @@ -161,6 +171,7 @@ endif mostlyclean-local: rm -f *.$(FASLEXT) @rm -f $(OUT)/lisp$(EXEEXT) lisp$(EXEEXT) + rm -rf $(oa_target_lispdir) @rm -f stamp clean-local: mostlyclean diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in index 76b9753c..6dff8f44 100644 --- a/src/lisp/core.lisp.in +++ b/src/lisp/core.lisp.in @@ -126,10 +126,9 @@ '(@axiom_optimize_options@)) (proclaim '(optimize @axiom_optimize_options@)) - ;; Return true if the Boot system is complete bootstrapped. (defun boot-completed-p nil - (member :open-axiom-boot-complete *features*)) + (member :open-axiom-boot *features*)) ;; ;; -*- Hosting Lisp System -*- @@ -217,8 +216,29 @@ (concatenate 'string (|systemRootDirectory|) "lib/")))) +;; Return the list of linkable fasls in in the directory `dir'. +(defun linkset-from (dir) + (directory (make-pathname :directory (pathname-directory dir) + :name :wild + :type |$effectiveFaslType|))) + +;; Return a path to the the subdirectory `subdir' within the +;; OpenAxiom filesystem. +(defun system-subdirectory (subdir) + (concatenate 'string (|systemRootDirectory|) subdir)) + +;; Like linkset-from when `feature' in on the features list. +(defun linkset-from-if (dir pred) + (if (member feature *features*) + (linkset-from (system-subdirectory dir)) + nil)) + +;; Return a complete list of fasls as appropriate for building +;; an executable program user thought consists only of `fasls'. (defun complete-fasl-list-for-link (fasls) - (mapcar #'|compileFilePathname| fasls)) + (append (linkset-from-if "lisp/" :open-axiom-base-lisp) + (linkset-from-if "boot/" :open-axiom-boot) + (map 'list #'|compileFilePathname| fasls))) ;; ;; -*- OpenAxiom Driver Table -*- @@ -232,6 +252,7 @@ ;; --sysalg=<dir>: specify <dir> as directory containing algebras ;; --compile: boot or lisp files ;; --translate: boot files +;; --prologue=<lisp-code>: Run <lisp-code> just before the main entry point. ;; --make: boot, lisp, or fasl files (defparameter |$driverTable| (make-hash-table :test #'equal :size 5)) @@ -330,6 +351,10 @@ (defun |getMainEntryPoint| (options) (|getOptionValue| (|Option| "main") options)) +(defun |getPrologue| (options) + (let ((prologue (|getOptionValue| (|Option| "prologue") options))) + (if prologue (read-from-string prologue) nil))) + ;; Save current image on disk as executable and quit. (defun |saveCore| (core-image &optional (entry-point nil)) ;; When building the OpenAxiom system, and in many other cases I suspect, @@ -533,7 +558,9 @@ ;; 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)) +(defun |link| (core-image lisp-files + &optional (entry-point nil) (prologue nil)) + #-:ecl (declare (ignore prologue)) (if (and entry-point (stringp entry-point)) (setq entry-point `(read-from-string ,entry-point))) #-:ecl (progn @@ -546,7 +573,11 @@ :lisp-files (complete-fasl-list-for-link lisp-files) :ld-flags (extra-runtime-libs) - :epilogue-code `(funcall ,entry-point)) + :epilogue-code + `(progn + (pushnew :open-axiom-base-lisp *features*) + ,prologue + (funcall ,entry-point))) (|coreQuit|))) @@ -637,7 +668,8 @@ (|link| (or (|getOutputPathname| options) "a.out") args - (|getMainEntryPoint| options)) + (|getMainEntryPoint| options) + (|getPrologue| options)) (|coreQuit|)) (|installDriver| (|Option| "make") #'|makeHandler|) |