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: Ludovic Courtès
Subject: Re: [ANN] (potato make) - makefiles in scheme
Date: Fri, 26 Feb 2021 18:40:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi Mike,

Mike Gran <spk121@yahoo.com> skribis:

> 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.
>
> 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)

Nice!

As you may know, Guix is reducing its “binary seeds” (pre-built binaries
used to bootstrap the whole distribution) so that everything can be
built from source.

Part of the strategy revolves around doing more things in Scheme on top
of Guile or Mes, and that’s why people wrote Gash (POSIX shell + core
utilities).  With a makefile parser, (potato make) could be a useful
addition!

Also, we could imagine adding a Guix backend to (potato make), such that
each target is built as a Guix “derivation”.

Food for thought…

Ludo’.




reply via email to

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