2006-12-24 04:08:18 -05:00
|
|
|
#!/usr/bin/env ikarus -b ikarus.boot --script
|
2006-11-23 19:44:29 -05:00
|
|
|
|
2007-05-01 05:49:33 -04:00
|
|
|
(library (ikarus makefile)
|
2007-05-01 17:39:17 -04:00
|
|
|
(export)
|
|
|
|
(import (scheme))
|
|
|
|
|
|
|
|
(define scheme-library-files
|
2007-05-02 00:06:44 -04:00
|
|
|
;;; Listed in the order in which they're loaded.
|
|
|
|
;;;
|
|
|
|
;;; Loading of the boot file may segfault if a library is
|
|
|
|
;;; loaded before its dependencies are loaded first.
|
|
|
|
;;;
|
|
|
|
;;; reason is that the base libraries are not a hierarchy of
|
|
|
|
;;; dependencies but rather an eco system in which every
|
|
|
|
;;; part depends on the other.
|
|
|
|
;;;
|
|
|
|
;;; For example, the printer may call error if it finds
|
|
|
|
;;; an error (e.g. "not an output port"), while the error
|
|
|
|
;;; procedure may call the printer to display the message.
|
|
|
|
;;; This works fine as long as error does not itself cause
|
|
|
|
;;; an error (which may lead to the infamous Error: Error:
|
|
|
|
;;; Error: Error: Error: Error: Error: Error: Error: ...).
|
|
|
|
;;;
|
|
|
|
'("libhandlers.ss"
|
|
|
|
"libcontrol.ss"
|
|
|
|
"libcollect.ss"
|
|
|
|
"librecord.ss"
|
|
|
|
"libcxr.ss"
|
|
|
|
"libnumerics.ss"
|
|
|
|
"libguardians.ss"
|
|
|
|
"libcore.ss"
|
|
|
|
"libchezio.ss"
|
|
|
|
"libhash.ss"
|
|
|
|
"libwriter.ss"
|
|
|
|
"libtokenizer.ss"
|
|
|
|
"libassembler.ss"
|
|
|
|
"libintelasm.ss"
|
|
|
|
"libfasl.ss"
|
|
|
|
"libtrace.ss"
|
|
|
|
"libcompile.ss"
|
|
|
|
"libsyntax.ss"
|
|
|
|
"libpp.ss"
|
|
|
|
"libcafe.ss"
|
|
|
|
"libposix.ss"
|
|
|
|
"libtimers.ss"
|
2007-05-01 17:39:17 -04:00
|
|
|
"libtoplevel.ss"))
|
2007-05-02 00:06:44 -04:00
|
|
|
|
2007-05-01 17:39:17 -04:00
|
|
|
(define (read-file file)
|
|
|
|
(with-input-from-file file
|
|
|
|
(lambda ()
|
|
|
|
(let f ()
|
|
|
|
(let ([x (read)])
|
|
|
|
(if (eof-object? x)
|
|
|
|
'()
|
|
|
|
(cons x (f))))))))
|
|
|
|
|
2007-05-02 01:52:11 -04:00
|
|
|
(define (expand-file filename codes env)
|
|
|
|
(with-input-from-file filename
|
|
|
|
(lambda ()
|
|
|
|
(let f ()
|
|
|
|
(let ([x (read)])
|
|
|
|
(cond
|
|
|
|
[(eof-object? x) (values codes env)]
|
|
|
|
[else
|
|
|
|
(let-values ([(code e)
|
|
|
|
(boot-library-expand x)])
|
|
|
|
(let-values ([(codes e*) (f)])
|
|
|
|
(values (cons code codes) (append e e*))))]))))))
|
|
|
|
|
|
|
|
(define (expand-files ls)
|
|
|
|
(cond
|
|
|
|
[(null? ls) (values '() '())]
|
|
|
|
[else
|
|
|
|
(let-values ([(codes env) (expand-files (cdr ls))])
|
|
|
|
(expand-file (car ls) codes env))]))
|
|
|
|
|
2006-11-23 19:44:29 -05:00
|
|
|
|
2007-05-01 17:39:17 -04:00
|
|
|
(define (expand-all ls)
|
2007-05-02 01:52:11 -04:00
|
|
|
(let-values ([(codes env) (expand-files ls)])
|
|
|
|
codes))
|
2006-11-23 19:44:29 -05:00
|
|
|
|
2007-05-01 17:39:17 -04:00
|
|
|
(printf "expanding ...\n")
|
2007-05-02 00:06:44 -04:00
|
|
|
|
2007-05-01 17:39:17 -04:00
|
|
|
(let ([core* (expand-all scheme-library-files)])
|
|
|
|
(printf "compiling ...\n")
|
|
|
|
(let ([p (open-output-file "ikarus.boot" 'replace)])
|
|
|
|
(for-each
|
|
|
|
(lambda (x) (compile-core-expr-to-port x p))
|
|
|
|
core*)
|
|
|
|
(close-output-port p)))
|
2007-05-02 00:06:44 -04:00
|
|
|
|
2007-05-01 17:39:17 -04:00
|
|
|
(printf "Happy Happy Joy Joy\n"))
|
2007-04-28 20:54:02 -04:00
|
|
|
|
2007-04-30 22:00:04 -04:00
|
|
|
|
|
|
|
;;; ;;; NEW ARCHITECTURE
|
|
|
|
;;;
|
|
|
|
;;; (define expander-input-env
|
|
|
|
;;; '(;[prim-name label (core-prim . prim-name)]
|
|
|
|
;;; [car car-label (core-prim . car)]))
|
|
|
|
;;;
|
|
|
|
;;; (define expander-output-env
|
|
|
|
;;; '(;[export-name export-loc]
|
|
|
|
;;; [ikarus-car #{ikarus-car |174V9RJ/FjzvmJVu|}]))
|
|
|
|
;;;
|
|
|
|
;;; (define bootstrap-knot
|
|
|
|
;;; '(;[prim-name export-name]
|
|
|
|
;;; [car ikarus-car]))
|
|
|
|
;;;
|
|
|
|
;;; (define compile-input-env
|
|
|
|
;;; '(;[prim-name export-loc]
|
|
|
|
;;; [car #{ikarus-car |174V9RJ/FjzvmJVu|}]))
|