suffix rules in zuo (as a make / shake replacment) ?
Andreas Reuleaux <[email protected]> Tue, 25 Oct 2022 05:38:15 +0100
| Newsgroups | gmane.comp.lang.racket.user,gmane.lisp.scheme.plt |
|---|---|
| Message-ID | <87v8o8a56w.fsf@laptop> |
Hi,
I am trying to use zuo (as a make / shake ) replacement.
starting out from the example given
at https://docs.racket-lang.org/zuo/zuo-build.html
main.zuo
--------------------
#lang zuo
=20
(provide-targets targets-at)
=20
(define (targets-at at-dir vars)
(define demo (at-dir (.exe "demo")))
=20
(define main.c (at-source "main.c"))
(define main.o (at-dir (.c->.o "main.c")))
=20
(define helper.c (at-source "helper.c"))
(define helper.o (at-dir (.c->.o "helper.c")))
=20
(make-targets
`([:target ,demo (,main.o ,helper.o)
,(lambda (dest token)
(c-link dest (list main.o helper.o) vars))]
[:target ,main.o (,main.c)
,(lambda (dest token)
(c-compile dest main.c vars))]
[:target ,helper.o (,helper.c)
,(lambda (dest token)
(c-compile dest helper.c vars))]
[:target clean ()
,(lambda (token)
(for-each rm* (list main.o helper.o demo)))])))
--------------------
I can add some definitions / targets to build a letter.pdf from a
letter.fo with fop in my case:
main.zuo
--------------------
...
(require zuo/shell)
...
(define (targets-at at-dir vars)
(define letter.pdf (at-source "letter.pdf"))
(define letter.fo (at-source "letter.fo"))
...
(make-targets
`(
...
[:target ,letter.pdf (,letter.fo)
,(lambda (dest token)
(shell/wait "fop -c cfg -fo" "letter.fo" "-pdf" dest)
)]
...
))
)
--------------------
So I can create letter.pdf with
zuo . letter.pdf
So far, so good. Now I am a little more ambitious: I want a make/shake
style suffix rule, how to create (in general) a .pdf from a .fo
And things start to get complicated - there should an easy
solution to this, I guess.
My attempt:
main.zuo
--------------------
...
(require zuo/shell)
...
(define (targets-at at-dir vars)
(define .pdf ????)
...
(make-targets
`(
...
[:target ,.pdf `(,(path-replace-extension ,.pdf #".fo"))
,(lambda (dest token)
`(shell/wait "fop -c cfg -fo" ,.fo "-pdf" dest)
=20
...
))
)
--------------------
Somehow like this? How? Thanks in advance.
I have looked at some of the .zuo files in the racket source tree, but
haven't seen such suffix rules.
Btw in shake I would use
--------------------
; "*.pdf" %> \pdf -> do {
; let fo =3D pdf -<.> "fo"
; need [fo]
; need ["cfg"]
; cmd Shell "fop" ["-c", "cfg",=20
"-fo", fo,=20
"-pdf", pdf]
}
--------------------
-Andreas
--=20
You received this message because you are subscribed to the Google Groups "=
Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion on the web visit https://groups.google.com/d/msgid/=
racket-users/beaa2ef6-afd2-4686-829a-390eb69f5620n%40googlegroups.com.
Beyond the Racket Users Google Group, Racket Discussions take place on Disc=
ourse ( https://racket.discourse.group/ ) and Discord ( https://discord.gg/=
6Zq8sH5 ). Discussion (but less active) also takes place on the Racket Slac=
k https://racket.slack.com/ ( sign up at https://racket-slack.herokuapp.com=
/ ), and IRC #racket https://kiwiirc.com/nextclient/irc.libera.chat/#racket
---=20
You received this message because you are subscribed to the Google Groups "=
Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion on the web visit https://groups.google.com/d/msgid/=
racket-users/87v8o8a56w.fsf%40laptop.