~ chicken-core (chicken-5) d8c60219874deef3555b16e0b64581f2e97548b2
commit d8c60219874deef3555b16e0b64581f2e97548b2 Author: Felix <bunny351@gmail.com> AuthorDate: Sun Nov 8 00:59:33 2009 +0100 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Mon Nov 23 17:47:20 2009 +0100 import lib only generated if changed Signed-off-by: felix <felix@call-with-current-continuation.org> diff --git a/compiler.scm b/compiler.scm index 41258492..dd8a629f 100644 --- a/compiler.scm +++ b/compiler.scm @@ -486,21 +486,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) diff --git a/manual/Declarations b/manual/Declarations index e62a79ce..deabbeee 100644 --- a/manual/Declarations +++ b/manual/Declarations @@ -77,13 +77,6 @@ The opposite of {{hide}}. All given identifiers will be exported and all topleve not listed will be hidden and not be accessible outside of this compilation unit. -=== emit-exports - - [declaration specifier] (emit-exports STRING) - -Write exported toplevel variables to file with name {{STRING}}. - - === emit-external-prototypes-first [declaration specifier] (emit-external-prototypes-first) @@ -116,7 +109,10 @@ compiler option). Declares that any following definition of a module named {{MODULENAME}} should be written to an external file (either a specified one or a file named {{"MODULENAME.import.scm"}}). -The compiler option {{-emit-import-library}} may also be used. +The compiler option {{-emit-import-library}} may also be used instead. + +Note that the import library is only generated if it cannot be found in the current +directory, or if it exists but is not equal to the one that would be generated. === inlineTrap