diff --git a/templates.scm b/templates.scm index da15584..75e615e 100644 --- a/templates.scm +++ b/templates.scm @@ -6,7 +6,7 @@ (let ((cooked-state (last args)) (prereqs-results (cdr (reverse (cdr args))))) (cons (begin - (display ";;; rule : ") + (display ";;; file : ") (display target) (newline) (bind-fluids-gnu target prereqs prereqs-results thunk)) @@ -61,18 +61,22 @@ (cons (file-not-exists? target) init-state)))) (define (make-is-out-of-date? target . prereqs) - (lambda args + (lambda args ; (breakpoint "make-is-out-of-date?") (let ((init-state (last args))) - (cons (or (file-not-exists? target) - (and (not (null? prereqs)) - (let for-each-prereq ((prereq (car prereqs)) - (todo (cdr prereqs))) - (cond - ((file-not-exists? prereq) #t) - ((> (file-last-mod prereq) (file-last-mod target)) #t) - ((null? todo) #f) - (else (for-each-prereq (car todo) (cdr todo))))))) + (cons (if (file-not-exists? target) + #t + (if (null? prereqs) + #f + (let ((target-mtime (file-last-mod target))) + (let for-each-prereq ((prereq (car prereqs)) + (todo (cdr prereqs))) + (cond + ((file-not-exists? prereq) + (error "nonexistent prerequisite" prereq)) + ((> (file-last-mod prereq) target-mtime) #t) + ((null? todo) #f) + (else (for-each-prereq (car todo) (cdr todo)))))))) init-state)))) (define (make-md5-sum-changed? target . prereqs) @@ -86,13 +90,13 @@ (let* ((bname (string-append basename extension)) (file (expand-file-name bname (cwd)))) (if (file-exists? file) - (let* ((outport (open-input-file file)) - (strls (port->string-list outport))) - ;; (display ";;; using : ") (display bname) (newline) - (if (null? strls) - #f - (string->number (car strls)))) - #f))) + (let* ((outport (open-input-file file)) + (strls (port->string-list outport))) + ;; (display ";;; using : ") (display bname) (newline) + (if (null? strls) + #f + (string->number (car strls)))) + #f))) (define (checksum-into-file basename extension checksum) (let* ((bname (string-append basename extension))