aboutsummaryrefslogtreecommitdiff
path: root/src/lisp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-08-13 17:42:35 +0000
committerdos-reis <gdr@axiomatics.org>2008-08-13 17:42:35 +0000
commit22e34c3f799e43cba446af4bae3b5557df74b0e7 (patch)
tree73a283aaa8c6bf30d49bbf26b44b44b2769bfea4 /src/lisp
parentcd4b966f39550403099a0abf1e993af1e7e79139 (diff)
downloadopen-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/lisp')
-rw-r--r--src/lisp/Makefile.in29
-rw-r--r--src/lisp/core.lisp.in44
2 files changed, 58 insertions, 15 deletions
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|)