From 49b463ac7b732042e970866294339ed1599dd03d Mon Sep 17 00:00:00 2001 From: alex-eg Date: Tue, 20 Oct 2026 11:46:13 +0300 Subject: [PATCH] keep a root file named after a CHICKEN module out of the graph Only the eggs were told apart from the modules, so a scheme.scm became the scheme every unit imports, a dependency of every object and of itself, and the build went on to link it. --- tools/module-deps.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/module-deps.scm b/tools/module-deps.scm index 100662ef..d5f3e357 100644 --- a/tools/module-deps.scm +++ b/tools/module-deps.scm @@ -23,6 +23,7 @@ (import scheme (chicken base) (chicken condition) + (chicken eval) (chicken file) (chicken io) (chicken pathname) @@ -43,11 +44,22 @@ ;;; module the tests import (define eggs (call-with-input-file "dependencies.txt" read-list)) +;;; A scheme.scm is not the module every unit imports. Asked from /, +;;; since here a NAME.import.scm built from NAME.scm would answer +(define (chicken-module? name) + (let ((here (current-directory))) + (dynamic-wind + (lambda () (change-directory "/")) + (lambda () (handle-exceptions exn #f (module-environment name) #t)) + (lambda () (change-directory here))))) + (define (module-file name) (and (symbol? name) (not (memq name eggs)) (let ((file (string-append (symbol->string name) ".scm"))) - (and (file-exists? file) file)))) + (and (file-exists? file) + (not (chicken-module? name)) + file)))) ;;; FILE's forms, or the end of the scan, naming the file that has none (define (forms-of file)