changed syntax for file, md5, once, and always from ?thunk into ?action0 ...
This commit is contained in:
parent
b7ba049edd
commit
d587e4152f
113
macros.scm
113
macros.scm
|
@ -1,17 +1,9 @@
|
||||||
;;; MAKEFILE:
|
;;; MAKEFILE:
|
||||||
;;; =========
|
;;; =========
|
||||||
|
|
||||||
;;; (define-syntax makefile
|
|
||||||
;;; (syntax-rules ()
|
|
||||||
;;; ((makefile ?rule0 ...)
|
|
||||||
;;; (let ((rule-candidates '()))
|
|
||||||
;;; (let* ((rule-candidates (?rule0 rule-candidates))
|
|
||||||
;;; ...)
|
|
||||||
;;; rule-candidates)))))
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; <makefile> ::= '(' + "makefile" + <makerule-clause>* + ')'
|
;;; <makefile> ::= '(' + "makefile" + <makerule-clause>* + ')'
|
||||||
;;; <makerule-clause> ::= <rule-clause>
|
;;; <makerule-clause> ::= <file-clause>
|
||||||
;;; | <md5-clause>
|
;;; | <md5-clause>
|
||||||
;;; | <always-clause>
|
;;; | <always-clause>
|
||||||
;;; | <once-clause>
|
;;; | <once-clause>
|
||||||
|
@ -23,68 +15,73 @@
|
||||||
((makefile ?rule0 ?rule1 ...) (?rule0 (makefile ?rule1 ...)))))
|
((makefile ?rule0 ?rule1 ...) (?rule0 (makefile ?rule1 ...)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; <rule-clause>
|
;;; <file-clause>
|
||||||
;;;
|
;;;
|
||||||
;;; to achieve consistency only rule will use the rule-tmpvars
|
;;; to achieve consistency only rule will use the rule-tmpvars
|
||||||
;;; macro directly and all other macros use this clause
|
;;; macro directly and all other macros use this clause
|
||||||
;;;
|
;;;
|
||||||
(define-syntax makefile-rule
|
(define-syntax makefile-rule
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((makefile-rule ?target ?prereqs ?thunk) (rule ?target ?prereqs ?thunk))))
|
((makefile-rule ?target ?prereqs ?action0 ...)
|
||||||
|
(file ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax is-out-of-date?
|
(define-syntax is-out-of-date?
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((is-out-of-date? ?target ?prereqs ?thunk) (rule ?target ?prereqs ?thunk))))
|
((is-out-of-date? ?target ?prereqs ?action0 ...)
|
||||||
|
(file ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule
|
(define-syntax file
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule ?target (?prereq0 ...) ?thunk)
|
((file ?target (?prereq0 ...) ?action0 ...)
|
||||||
(rule-tmpvars () ?target (?prereq0 ...) ?thunk))))
|
(file-tmpvars () ?target (?prereq0 ...) ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-tmpvars
|
(define-syntax file-tmpvars
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-tmpvars (tmp1 ...) ?target () ?thunk)
|
((file-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
||||||
(let ((target ?target)
|
(let ((target ?target)
|
||||||
(prereqs (list tmp1 ...)))
|
(prereqs (list tmp1 ...))
|
||||||
|
(thunk (lambda () ?action0 ...)))
|
||||||
(lambda (rule-candidates)
|
(lambda (rule-candidates)
|
||||||
(cons (list target
|
(cons (list target
|
||||||
prereqs
|
prereqs
|
||||||
(make-is-out-of-date? target tmp1 ...)
|
(make-is-out-of-date? target tmp1 ...)
|
||||||
(make-rule-build-func target prereqs ?thunk))
|
(make-file-build-func target prereqs thunk))
|
||||||
rule-candidates))))
|
rule-candidates))))
|
||||||
((rule-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk)
|
((file-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
||||||
(let ((tmp2 ?prereq0))
|
(let ((tmp2 ?prereq0))
|
||||||
(rule-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk)))))
|
(file-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; <md5-clause>
|
;;; <md5-clause>
|
||||||
;;;
|
;;;
|
||||||
;;; to achieve consistency only rule-md5 will use the rule-md5-tmpvars
|
;;; to achieve consistency only file-md5 will use the file-md5-tmpvars
|
||||||
;;; macro directly and all other macros use this clause
|
;;; macro directly and all other macros use this clause
|
||||||
;;;
|
;;;
|
||||||
(define-syntax md5
|
(define-syntax md5
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((md5 ?target ?prereqs ?thunk) (rule-md5 ?target ?prereqs ?thunk))))
|
((md5 ?target ?prereqs ?action0 ...)
|
||||||
|
(file-md5 ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-md5
|
(define-syntax file-md5
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-md5 ?target (?prereq0 ...) ?thunk)
|
((file-md5 ?target (?prereq0 ...) ?action0 ...)
|
||||||
(rule-md5-tmpvars () ?target (?prereq0 ...) ?thunk))))
|
(file-md5-tmpvars () ?target (?prereq0 ...) ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-md5-tmpvars
|
(define-syntax file-md5-tmpvars
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-md5-tmpvars (tmp1 ...) ?target () ?thunk)
|
((file-md5-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
||||||
(let ((target ?target)
|
(let ((target ?target)
|
||||||
(prereqs (list tmp1 ...)))
|
(prereqs (list tmp1 ...))
|
||||||
|
(thunk (lambda () ?action0 ...)))
|
||||||
(lambda (rule-candidates)
|
(lambda (rule-candidates)
|
||||||
(cons (list target
|
(cons (list target
|
||||||
prereqs
|
prereqs
|
||||||
(make-md5-sum-changed? target tmp1 ...)
|
(make-md5-sum-changed? target tmp1 ...)
|
||||||
(make-md5-build-func target prereqs ?thunk))
|
(make-md5-build-func target prereqs thunk))
|
||||||
rule-candidates))))
|
rule-candidates))))
|
||||||
((rule-md5-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk)
|
((file-md5-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
||||||
(let ((tmp2 ?prereq0))
|
(let ((tmp2 ?prereq0))
|
||||||
(rule-md5-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk)))))
|
(file-md5-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; <always-clause>
|
;;; <always-clause>
|
||||||
|
@ -94,36 +91,39 @@
|
||||||
;;;
|
;;;
|
||||||
(define-syntax phony
|
(define-syntax phony
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((phony ?target ?prereqs ?thunk) (rule-always ?target ?prereqs ?thunk))))
|
((phony ?target ?prereqs ?action0 ...)
|
||||||
|
(file-always ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax always
|
(define-syntax always
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((always ?target ?prereqs ?thunk) (rule-always ?target ?prereqs ?thunk))))
|
((always ?target ?prereqs ?action0 ...)
|
||||||
|
(file-always ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax is-out-of-date!
|
(define-syntax is-out-of-date!
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((is-out-of-date! ?target ?prereqs ?thunk)
|
((is-out-of-date! ?target ?prereqs ?action0 ...)
|
||||||
(rule-always ?target ?prereqs ?thunk))))
|
(file-always ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-always
|
(define-syntax file-always
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-always ?target (?prereq0 ...) ?thunk)
|
((file-always ?target ?prereqs ?action0 ...)
|
||||||
(rule-always-tmpvars () ?target (?prereq0 ...) ?thunk))))
|
(file-always-tmpvars () ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-always-tmpvars
|
(define-syntax file-always-tmpvars
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-always-tmpvars (tmp1 ...) ?target () ?thunk)
|
((file-always-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
||||||
(let ((target ?target)
|
(let ((target ?target)
|
||||||
(prereqs (list tmp1 ...)))
|
(prereqs (list tmp1 ...))
|
||||||
|
(thunk (lambda () ?action0 ...)))
|
||||||
(lambda (rule-candidates)
|
(lambda (rule-candidates)
|
||||||
(cons (list target
|
(cons (list target
|
||||||
prereqs
|
prereqs
|
||||||
(make-is-out-of-date! target tmp1 ...)
|
(make-is-out-of-date! target tmp1 ...)
|
||||||
(make-always-build-func target prereqs ?thunk))
|
(make-always-build-func target prereqs thunk))
|
||||||
rule-candidates))))
|
rule-candidates))))
|
||||||
((rule-always-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk)
|
((file-always-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
||||||
(let ((tmp2 ?prereq0))
|
(let ((tmp2 ?prereq0))
|
||||||
(rule-always-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk)))))
|
(file-always-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; <once-clause>
|
;;; <once-clause>
|
||||||
|
@ -133,25 +133,26 @@
|
||||||
;;;
|
;;;
|
||||||
(define-syntax once
|
(define-syntax once
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((once ?target ?prereqs ?thunk)
|
((once ?target ?prereqs ?action0 ...)
|
||||||
(rule-once ?target ?prereqs ?thunk))))
|
(file-once ?target ?prereqs ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-once
|
(define-syntax file-once
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-once ?target (?prereq0 ...) ?thunk)
|
((file-once ?target (?prereq0 ...) ?action0 ...)
|
||||||
(rule-once-tmpvars () ?target (?prereq0 ...) ?thunk))))
|
(file-once-tmpvars () ?target (?prereq0 ...) ?action0 ...))))
|
||||||
|
|
||||||
(define-syntax rule-once-tmpvars
|
(define-syntax file-once-tmpvars
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((rule-once-tmpvars (tmp1 ...) ?target () ?thunk)
|
((file-once-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
||||||
(let ((target ?target)
|
(let ((target ?target)
|
||||||
(prereqs (list tmp1 ...)))
|
(prereqs (list tmp1 ...))
|
||||||
|
(thunk (lambda () ?action0 ...)))
|
||||||
(lambda (rule-candidates)
|
(lambda (rule-candidates)
|
||||||
(cons (list target
|
(cons (list target
|
||||||
prereqs
|
prereqs
|
||||||
(make-once target tmp1 ...)
|
(make-once target tmp1 ...)
|
||||||
(make-once-build-func target prereqs ?thunk))
|
(make-once-build-func target prereqs thunk))
|
||||||
rule-candidates))))
|
rule-candidates))))
|
||||||
((rule-once-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk)
|
((file-once-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
||||||
(let ((tmp2 ?prereq0))
|
(let ((tmp2 ?prereq0))
|
||||||
(rule-once-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk)))))
|
(file-once-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
||||||
|
|
Loading…
Reference in New Issue