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
 
(provide-targets targets-at)
 
(define (targets-at at-dir vars)
  (define demo (at-dir (.exe "demo")))
 
  (define main.c (at-source "main.c"))
  (define main.o (at-dir (.c->.o "main.c")))
 
  (define helper.c (at-source "helper.c"))
  (define helper.o (at-dir (.c->.o "helper.c")))
 
  (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)
  

...
      ))



  )
--------------------

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 = pdf -<.> "fo"
    ; need [fo]
    ; need ["cfg"]
    ; cmd Shell "fop" ["-c", "cfg", 
                       "-fo", fo, 
                       "-pdf", pdf]
    }
--------------------





-Andreas

-- 
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 email 
to [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 
Discourse ( https://racket.discourse.group/ ) and Discord ( 
https://discord.gg/6Zq8sH5 ). Discussion (but less active) also takes place on 
the Racket Slack https://racket.slack.com/ ( sign up at 
https://racket-slack.herokuapp.com/ ), and IRC #racket 
https://kiwiirc.com/nextclient/irc.libera.chat/#racket
--- 
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 email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/87v8o8a56w.fsf%40laptop.

Reply via email to