fixed pattern problem:
now, a normal rule can be inside common-%. this will work: (common-% "foo" ("%.c") (run (gcc -o ,($@) ,($<)))) added head->rc/-%/-rx, tail->rc/-%/-rx
This commit is contained in:
parent
b161de726d
commit
4198c5e46a
30
make.scm
30
make.scm
|
@ -25,6 +25,12 @@
|
|||
(define (file->rc target prereqs thunk)
|
||||
(make-rc target prereqs file thunk))
|
||||
|
||||
(define (head->rc target prereqs thunk)
|
||||
(make-rc target prereqs head thunk))
|
||||
|
||||
(define (tail->rc target prereqs thunk)
|
||||
(make-rc target prereqs tail thunk))
|
||||
|
||||
(define (once->rc target prereqs thunk)
|
||||
(make-rc target prereqs once thunk))
|
||||
|
||||
|
@ -53,11 +59,13 @@
|
|||
pattern 'pre 1 match 3 'post))
|
||||
|
||||
(define (%-pattern->match pattern no)
|
||||
(match:substring (regexp-search (rx (: (submatch (: bos (* any)))
|
||||
(submatch "%")
|
||||
(submatch (: (* any) eos))))
|
||||
pattern)
|
||||
no))
|
||||
(let ((re (rx (: (submatch (: bos (* any)))
|
||||
(submatch "%")
|
||||
(submatch (: (* any) eos)))))
|
||||
(found-%? (regexp-search (rx (: "%")) pattern)))
|
||||
(if found-%?
|
||||
(match:substring (regexp-search re pattern) no)
|
||||
(if (= no 2) pattern ""))))
|
||||
|
||||
(define (%-pattern->rx pattern)
|
||||
(let* ((left (%-pattern->match pattern 1))
|
||||
|
@ -75,6 +83,12 @@
|
|||
(define (file-rx target prereqs thunk)
|
||||
(rx->func string=? target prereqs file thunk))
|
||||
|
||||
(define (head-rx target prereqs thunk)
|
||||
(rx->func string=? target prereqs head thunk))
|
||||
|
||||
(define (tail-rx target prereqs thunk)
|
||||
(rx->func string=? target prereqs tail thunk))
|
||||
|
||||
(define (once-rx target prereqs thunk)
|
||||
(rx->func string=? target prereqs once thunk))
|
||||
|
||||
|
@ -104,6 +118,12 @@
|
|||
(define (file-% target prereqs thunk)
|
||||
(%->func string=? target prereqs file thunk))
|
||||
|
||||
(define (head-% target prereqs thunk)
|
||||
(%->func string=? target prereqs head thunk))
|
||||
|
||||
(define (tail-% target prereqs thunk)
|
||||
(%->func string=? target prereqs tail thunk))
|
||||
|
||||
(define (once-% target prereqs thunk)
|
||||
(%->func string=? target prereqs once thunk))
|
||||
|
||||
|
|
Loading…
Reference in New Issue