;;; MAKEFILE: ;;; ========= ;;; ;;; ::= '(' + "makefile" + * + ')' ;;; ::= ;;; | ;;; | ;;; | ;;; ;;; (define-syntax makefile (syntax-rules () ((makefile) (list)) ((makefile ?rule0 ?rule1 ...) (?rule0 (makefile ?rule1 ...))))) ;;; ;;; ;;; ;;; to achieve consistency only rule will use the rule-tmpvars ;;; macro directly and all other macros use this clause ;;; (define-syntax makefile-rule (syntax-rules () ((makefile-rule ?target ?prereqs ?action0 ...) (file ?target ?prereqs ?action0 ...)))) (define-syntax is-out-of-date? (syntax-rules () ((is-out-of-date? ?target ?prereqs ?action0 ...) (file ?target ?prereqs ?action0 ...)))) (define-syntax file (syntax-rules () ((file ?target (?prereq0 ...) ?action0 ...) (file-tmpvars () ?target (?prereq0 ...) ?action0 ...)))) (define-syntax file-tmpvars (syntax-rules () ((file-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) (prereqs (list tmp1 ...)) (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-is-out-of-date? target tmp1 ...) (make-file-build-func target prereqs thunk)) rule-candidates)))) ((file-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) (file-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...))))) ;;; ;;; ;;; ;;; to achieve consistency only file-md5 will use the file-md5-tmpvars ;;; macro directly and all other macros use this clause ;;; (define-syntax md5 (syntax-rules () ((md5 ?target ?prereqs ?action0 ...) (file-md5 ?target ?prereqs ?action0 ...)))) (define-syntax file-md5 (syntax-rules () ((file-md5 ?target (?prereq0 ...) ?action0 ...) (file-md5-tmpvars () ?target (?prereq0 ...) ?action0 ...)))) (define-syntax file-md5-tmpvars (syntax-rules () ((file-md5-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) (prereqs (list tmp1 ...)) (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-md5-sum-changed? target tmp1 ...) (make-md5-build-func target prereqs thunk)) rule-candidates)))) ((file-md5-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) (file-md5-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...))))) ;;; ;;; ;;; ;;; 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 () ((phony ?target ?prereqs ?action0 ...) (file-always ?target ?prereqs ?action0 ...)))) (define-syntax always (syntax-rules () ((always ?target ?prereqs ?action0 ...) (file-always ?target ?prereqs ?action0 ...)))) (define-syntax is-out-of-date! (syntax-rules () ((is-out-of-date! ?target ?prereqs ?action0 ...) (file-always ?target ?prereqs ?action0 ...)))) (define-syntax file-always (syntax-rules () ((file-always ?target ?prereqs ?action0 ...) (file-always-tmpvars () ?target ?prereqs ?action0 ...)))) (define-syntax file-always-tmpvars (syntax-rules () ((file-always-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) (prereqs (list tmp1 ...)) (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-is-out-of-date! target tmp1 ...) (make-always-build-func target prereqs thunk)) rule-candidates)))) ((file-always-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) (file-always-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...))))) ;;; ;;; ;;; ;;; 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 () ((once ?target ?prereqs ?action0 ...) (file-once ?target ?prereqs ?action0 ...)))) (define-syntax file-once (syntax-rules () ((file-once ?target (?prereq0 ...) ?action0 ...) (file-once-tmpvars () ?target (?prereq0 ...) ?action0 ...)))) (define-syntax file-once-tmpvars (syntax-rules () ((file-once-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) (prereqs (list tmp1 ...)) (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-once target tmp1 ...) (make-once-build-func target prereqs thunk)) rule-candidates)))) ((file-once-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) (file-once-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))