[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ANN] (potato make) - makefiles in scheme
From: |
Mike Gran |
Subject: |
[ANN] (potato make) - makefiles in scheme |
Date: |
Mon, 15 Feb 2021 09:26:51 -0800 |
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.
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
- [ANN] (potato make) - makefiles in scheme,
Mike Gran <=