unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* [ANN] (potato make) - makefiles in scheme
       [not found] <20210215172651.GA3034884.ref@spikycactus.com>
@ 2021-02-15 17:26 ` Mike Gran
  2021-02-15 18:03   ` Olivier Dion via General Guile related discussions
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mike Gran @ 2021-02-15 17:26 UTC (permalink / raw)
  To: guile-user

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ANN] (potato make) - makefiles in scheme
  2021-02-15 17:26 ` [ANN] (potato make) - makefiles in scheme Mike Gran
@ 2021-02-15 18:03   ` Olivier Dion via General Guile related discussions
  2021-02-26 17:40   ` Ludovic Courtès
  2021-04-02 15:44   ` Xinglu Chen
  2 siblings, 0 replies; 4+ messages in thread
From: Olivier Dion via General Guile related discussions @ 2021-02-15 18:03 UTC (permalink / raw)
  To: Mike Gran, guile-user

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ANN] (potato make) - makefiles in scheme
  2021-02-15 17:26 ` [ANN] (potato make) - makefiles in scheme Mike Gran
  2021-02-15 18:03   ` Olivier Dion via General Guile related discussions
@ 2021-02-26 17:40   ` Ludovic Courtès
  2021-04-02 15:44   ` Xinglu Chen
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2021-02-26 17:40 UTC (permalink / raw)
  To: guile-user

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ANN] (potato make) - makefiles in scheme
  2021-02-15 17:26 ` [ANN] (potato make) - makefiles in scheme Mike Gran
  2021-02-15 18:03   ` Olivier Dion via General Guile related discussions
  2021-02-26 17:40   ` Ludovic Courtès
@ 2021-04-02 15:44   ` Xinglu Chen
  2 siblings, 0 replies; 4+ messages in thread
From: Xinglu Chen @ 2021-04-02 15:44 UTC (permalink / raw)
  To: Mike Gran, guile-user

On Mon, Feb 15 2021, Mike Gran 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.

Cool project!  How would I try this out on my own Guile project?  I
can't find any instructions in the repo. :)



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-02 15:44 UTC | newest]

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

unofficial mirror of guile-user@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-user/0 guile-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-user guile-user/ https://yhetil.org/guile-user \
		guile-user@gnu.org
	public-inbox-index guile-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.user
	nntp://news.gmane.io/gmane.lisp.guile.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git