guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ANN] (potato make) - makefiles in scheme


From: Olivier Dion
Subject: Re: [ANN] (potato make) - makefiles in scheme
Date: Mon, 15 Feb 2021 13:03:38 -0500

On Mon, 15 Feb 2021, Mike Gran <spk121@yahoo.com> wrote:
> Hello All-
>
> I wrote a pure scheme Guile library (potato make) that lets one write
> makefiles in scheme.  The code lives at
> https://github.com/spk121/potato-make.

Interesting project!  I'm currently working on a small utility that
takes Scheme definition of a C project and generates a Makefile for it.
potato-make could make things easier to emit Makefile text from s-exp
templates.

>
> If you are familiar with the cryptic makefile syntax, and with scheme
> syntax, you may be able to decipher this makefile written in potato
> make.  Here ':=' is variable assignment, ':' is a target rule and '->'
> is a suffix rule.  The '~' syntax is a lazy concatenation operator
> that passes its output as a string to the system() procedure.
>
>   #!/usr/bin/env sh
>   exec guile -s "$0" "$@"
>   !#
>
>   (use-modules (potato make))
>   (initialize)
>
>   (:= CC "gcc")
>   (:= CFLAGS "-g -O2")
>
>   (: "all" '("foo"))
>   (: "foo" '("foo.o" "bar.o")
>     (~ ($ CC) "-o" $@ $^))
>   (-> ".c" ".o"
>     (~ ($ CC) "-c" $<))
>
>   (execute)
>
> There is quite a bit of flexibility here.  You can write your recipes
> in shell, in scheme, or in scheme that returns a string that gets
> passed to the shell.
>
> I'll probably rename the ':' syntax for the sake of SRFI-119 wisp
> compatibility.  Translated to wisp, this really would look like a
> dialect of makefile.
>
> No official tarball yet. I'll do that soonish after I get better
> coverage in the test suite.  I was just a bit proud of this silly
> hack, and wanted to show it off.  Thanks for reading.
>
> Regards,
> Mike Gran
>
-- 
Olivier Dion
PolyMtl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]