~ chicken-core (chicken-5) 1b0996e966da46d3bb02dc46a6dab3545fe5cbbe
commit 1b0996e966da46d3bb02dc46a6dab3545fe5cbbe
Author: unknown <felix@.(none)>
AuthorDate: Tue Nov 3 14:50:33 2009 +0100
Commit: unknown <felix@.(none)>
CommitDate: Tue Nov 3 14:50:33 2009 +0100
import-library is only generated if changed or doesn't exist (suggested by Joerg Wittenberger)
diff --git a/compiler.scm b/compiler.scm
index 7680ec99..8ae2907d 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -485,21 +485,27 @@
'() ) ))
(define (emit-import-lib name il)
- (let ((fname (if all-import-libraries
- (string-append (symbol->string name) ".import.scm")
- (cdr il))))
- (when verbose-mode
- (print "generating import library " fname " for module "
- name " ..."))
- (with-output-to-file fname
- (lambda ()
- (print ";;;; " fname " - GENERATED BY CHICKEN "
- (chicken-version) " -*- Scheme -*-\n")
- (for-each
- pretty-print
- (##sys#compiled-module-registration
- (##sys#current-module)))
- (print "\n;; END OF FILE")))))
+ (let* ((fname (if all-import-libraries
+ (string-append (symbol->string name) ".import.scm")
+ (cdr il)))
+ (imps (##sys#compiled-module-registration (##sys#current-module)))
+ (oldimps
+ (and (file-exists? fname)
+ (read-file fname) ) ) )
+ (cond ((equal? imps oldimps)
+ (when verbose-mode
+ (print "not generating import library `" fname "' for module `"
+ name "' because imports did not change")) )
+ (else
+ (when verbose-mode
+ (print "generating import library `" fname "' for module `"
+ name "' ..."))
+ (with-output-to-file fname
+ (lambda ()
+ (print ";;;; " fname " - GENERATED BY CHICKEN "
+ (chicken-version) " -*- Scheme -*-\n")
+ (for-each pretty-print imps)
+ (print "\n;; END OF FILE"))))) ) )
(define (walk x e se dest)
(cond ((symbol? x)
Trap