2005-02-04 03:05:55 -05:00
|
|
|
;;; MAKEFILE:
|
|
|
|
;;; =========
|
2005-01-18 10:45:27 -05:00
|
|
|
|
2005-02-04 03:05:55 -05:00
|
|
|
;;;
|
|
|
|
;;; <makefile> ::= '(' + "makefile" + <makerule-clause>* + ')'
|
2005-02-15 06:29:08 -05:00
|
|
|
;;; <makerule-clause> ::= <file-clause>
|
2005-02-04 03:05:55 -05:00
|
|
|
;;; | <md5-clause>
|
|
|
|
;;; | <always-clause>
|
|
|
|
;;; | <once-clause>
|
|
|
|
;;;
|
|
|
|
;;;
|
2005-01-20 05:18:07 -05:00
|
|
|
(define-syntax makefile
|
|
|
|
(syntax-rules ()
|
2005-02-04 03:05:55 -05:00
|
|
|
((makefile) (list))
|
|
|
|
((makefile ?rule0 ?rule1 ...) (?rule0 (makefile ?rule1 ...)))))
|
2005-01-18 10:45:27 -05:00
|
|
|
|
2005-02-04 03:05:55 -05:00
|
|
|
;;;
|
2005-02-15 06:29:08 -05:00
|
|
|
;;; <file-clause>
|
2005-02-04 03:05:55 -05:00
|
|
|
;;;
|
|
|
|
;;; to achieve consistency only rule will use the rule-tmpvars
|
|
|
|
;;; macro directly and all other macros use this clause
|
|
|
|
;;;
|
2005-01-18 10:45:27 -05:00
|
|
|
(define-syntax makefile-rule
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((makefile-rule ?target ?prereqs ?action0 ...)
|
|
|
|
(file ?target ?prereqs ?action0 ...))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
|
|
|
(define-syntax is-out-of-date?
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((is-out-of-date? ?target ?prereqs ?action0 ...)
|
|
|
|
(file ?target ?prereqs ?action0 ...))))
|
2005-01-18 10:45:27 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file
|
2005-01-18 10:45:27 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file ?target (?prereq0 ...) ?action0 ...)
|
|
|
|
(file-tmpvars () ?target (?prereq0 ...) ?action0 ...))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-tmpvars
|
2005-02-04 03:05:55 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
2005-02-04 03:05:55 -05:00
|
|
|
(let ((target ?target)
|
2005-02-15 06:29:08 -05:00
|
|
|
(prereqs (list tmp1 ...))
|
|
|
|
(thunk (lambda () ?action0 ...)))
|
2005-02-04 03:05:55 -05:00
|
|
|
(lambda (rule-candidates)
|
|
|
|
(cons (list target
|
|
|
|
prereqs
|
|
|
|
(make-is-out-of-date? target tmp1 ...)
|
2005-02-15 06:29:08 -05:00
|
|
|
(make-file-build-func target prereqs thunk))
|
2005-02-04 03:05:55 -05:00
|
|
|
rule-candidates))))
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
2005-01-18 10:45:27 -05:00
|
|
|
(let ((tmp2 ?prereq0))
|
2005-02-15 06:29:08 -05:00
|
|
|
(file-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; <md5-clause>
|
|
|
|
;;;
|
2005-02-15 06:29:08 -05:00
|
|
|
;;; to achieve consistency only file-md5 will use the file-md5-tmpvars
|
2005-02-04 03:05:55 -05:00
|
|
|
;;; macro directly and all other macros use this clause
|
|
|
|
;;;
|
|
|
|
(define-syntax md5
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((md5 ?target ?prereqs ?action0 ...)
|
|
|
|
(file-md5 ?target ?prereqs ?action0 ...))))
|
2005-01-18 10:45:27 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-md5
|
2005-01-18 10:45:27 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-md5 ?target (?prereq0 ...) ?action0 ...)
|
|
|
|
(file-md5-tmpvars () ?target (?prereq0 ...) ?action0 ...))))
|
2005-01-18 10:45:27 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-md5-tmpvars
|
2005-01-18 10:45:27 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-md5-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
2005-02-04 03:05:55 -05:00
|
|
|
(let ((target ?target)
|
2005-02-15 06:29:08 -05:00
|
|
|
(prereqs (list tmp1 ...))
|
|
|
|
(thunk (lambda () ?action0 ...)))
|
2005-02-04 03:05:55 -05:00
|
|
|
(lambda (rule-candidates)
|
|
|
|
(cons (list target
|
|
|
|
prereqs
|
|
|
|
(make-md5-sum-changed? target tmp1 ...)
|
2005-02-15 06:29:08 -05:00
|
|
|
(make-md5-build-func target prereqs thunk))
|
2005-02-04 03:05:55 -05:00
|
|
|
rule-candidates))))
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-md5-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
2005-01-18 10:45:27 -05:00
|
|
|
(let ((tmp2 ?prereq0))
|
2005-02-15 06:29:08 -05:00
|
|
|
(file-md5-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
2005-01-19 09:50:45 -05:00
|
|
|
|
2005-02-04 03:05:55 -05:00
|
|
|
;;;
|
|
|
|
;;; <always-clause>
|
|
|
|
;;;
|
|
|
|
;;; to achieve consistency only rule-always will use the rule-always-tmpvars
|
|
|
|
;;; macro directly and all other macros use this clause
|
|
|
|
;;;
|
|
|
|
(define-syntax phony
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((phony ?target ?prereqs ?action0 ...)
|
|
|
|
(file-always ?target ?prereqs ?action0 ...))))
|
2005-01-19 09:50:45 -05:00
|
|
|
|
2005-02-04 03:05:55 -05:00
|
|
|
(define-syntax always
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((always ?target ?prereqs ?action0 ...)
|
|
|
|
(file-always ?target ?prereqs ?action0 ...))))
|
2005-01-19 09:50:45 -05:00
|
|
|
|
2005-02-04 03:05:55 -05:00
|
|
|
(define-syntax is-out-of-date!
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((is-out-of-date! ?target ?prereqs ?action0 ...)
|
|
|
|
(file-always ?target ?prereqs ?action0 ...))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-always
|
2005-02-04 03:05:55 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-always ?target ?prereqs ?action0 ...)
|
|
|
|
(file-always-tmpvars () ?target ?prereqs ?action0 ...))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-always-tmpvars
|
2005-02-04 03:05:55 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-always-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
2005-02-04 03:05:55 -05:00
|
|
|
(let ((target ?target)
|
2005-02-15 06:29:08 -05:00
|
|
|
(prereqs (list tmp1 ...))
|
|
|
|
(thunk (lambda () ?action0 ...)))
|
2005-02-04 03:05:55 -05:00
|
|
|
(lambda (rule-candidates)
|
|
|
|
(cons (list target
|
|
|
|
prereqs
|
|
|
|
(make-is-out-of-date! target tmp1 ...)
|
2005-02-15 06:29:08 -05:00
|
|
|
(make-always-build-func target prereqs thunk))
|
2005-02-04 03:05:55 -05:00
|
|
|
rule-candidates))))
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-always-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
2005-02-04 03:05:55 -05:00
|
|
|
(let ((tmp2 ?prereq0))
|
2005-02-15 06:29:08 -05:00
|
|
|
(file-always-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; <once-clause>
|
|
|
|
;;;
|
|
|
|
;;; to achieve consistency only rule-once will use the rule-once-tmpvars
|
|
|
|
;;; macro directly and all other macros use this clause
|
|
|
|
;;;
|
|
|
|
(define-syntax once
|
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((once ?target ?prereqs ?action0 ...)
|
|
|
|
(file-once ?target ?prereqs ?action0 ...))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-once
|
2005-02-04 03:05:55 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-once ?target (?prereq0 ...) ?action0 ...)
|
|
|
|
(file-once-tmpvars () ?target (?prereq0 ...) ?action0 ...))))
|
2005-02-04 03:05:55 -05:00
|
|
|
|
2005-02-15 06:29:08 -05:00
|
|
|
(define-syntax file-once-tmpvars
|
2005-02-04 03:05:55 -05:00
|
|
|
(syntax-rules ()
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-once-tmpvars (tmp1 ...) ?target () ?action0 ...)
|
2005-02-04 03:05:55 -05:00
|
|
|
(let ((target ?target)
|
2005-02-15 06:29:08 -05:00
|
|
|
(prereqs (list tmp1 ...))
|
|
|
|
(thunk (lambda () ?action0 ...)))
|
2005-02-04 03:05:55 -05:00
|
|
|
(lambda (rule-candidates)
|
|
|
|
(cons (list target
|
|
|
|
prereqs
|
|
|
|
(make-once target tmp1 ...)
|
2005-02-15 06:29:08 -05:00
|
|
|
(make-once-build-func target prereqs thunk))
|
2005-02-04 03:05:55 -05:00
|
|
|
rule-candidates))))
|
2005-02-15 06:29:08 -05:00
|
|
|
((file-once-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...)
|
2005-02-04 03:05:55 -05:00
|
|
|
(let ((tmp2 ?prereq0))
|
2005-02-15 06:29:08 -05:00
|
|
|
(file-once-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))
|