unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mike Gran <spk121@yahoo.com>
To: guile-user@gnu.org
Subject: [ANN] (potato make) - makefiles in scheme
Date: Mon, 15 Feb 2021 09:26:51 -0800	[thread overview]
Message-ID: <20210215172651.GA3034884@spikycactus.com> (raw)
In-Reply-To: 20210215172651.GA3034884.ref@spikycactus.com

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



       reply	other threads:[~2021-02-15 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210215172651.GA3034884.ref@spikycactus.com>
2021-02-15 17:26 ` Mike Gran [this message]
2021-02-15 18:03   ` [ANN] (potato make) - makefiles in scheme Olivier Dion via General Guile related discussions
2021-02-26 17:40   ` Ludovic Courtès
2021-04-02 15:44   ` Xinglu Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210215172651.GA3034884@spikycactus.com \
    --to=spk121@yahoo.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).