guile-user
[Top][All Lists]
Advanced

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

Re: Guile support in GNU make


From: Ludovic Courtès
Subject: Re: Guile support in GNU make
Date: Tue, 17 Jan 2012 23:42:06 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

Hi Paul,

Paul Smith <address@hidden> skribis:

> On Sun, 2012-01-15 at 23:02 +0100, Ludovic Courts wrote:
>> And thanks for the great news!  :-)
>
> I promoted the feature to GNU make CVS (I know, still CVS!!) on
> Savannah.  I hope to generate a test dist file sometime this week.  I'll
> email when it's available if people want to take a look.

Excellent!

I just tried this:

--8<---------------cut here---------------start------------->8---
$(guile (display "hello, world\n"))

$(guile (pk (resolve-interface '(gnu make))))
--8<---------------cut here---------------end--------------->8---

And then “make -f ./the-file.mk”.

It works as intended ;-) but hits a segfault fixed with this patch:

--- guile.c.~2.3.~      2012-01-16 04:32:49.000000000 +0100
+++ guile.c     2012-01-17 23:35:53.000000000 +0100
@@ -92,9 +92,12 @@ func_guile (char *o, char **argv, const
   if (argv[0] && argv[0][0] != '\0')
     {
       char *str = scm_with_guile (internal_guile_eval, argv[0]);
+      if (str != NULL)
+       {
       o = variable_buffer_output (o, str, strlen (str));
       free (str);
     }
+    }
 
   return o;
 }
Anyway, nice job!  :-)

>> Paul Smith <address@hidden> skribis:
>> >> - The ‘#t => t’ distinguishes the symbol t from others, which feels wrong.
>> >>   I suggest #t => ""; #f => error.
>> >
>> > Hm. The problem with this is that we can't easily use Guile booleans in
>> > GNU make.  For example, the syntax for make's $(if ...) function is:
>> >
>> >         $(if <condition>,<then>[,<else>])
>> >
>> > The <condition> is expanded as a makefile expression and if it's empty
>> > it's considered false.  If it's non-empty it's considered true.
>> 
>> Would it be possible for Make to delay the conversion of SCMs to
>> strings, and in turn to differentiate between conditions as strings, and
>> conditions that are SCMs?
>
> I don't think this is possible.  Make has no "data types" at all.  It
> just manipulates strings--every operation in make is a string operation,
> and the "results" of operations are just constructing new string buffers
> by doing string manipulations, then passing that string to the next
> function (or whatever).
>
> There's just no facility anywhere internal to make to store or
> manipulate a non-string item.

OK, I see.

> I suppose one option would be to have #f translate to the string "#f"
> and change the definition in make of "false" to be "either the empty
> string OR the string #f".  Since "#" is a comment character in make it's
> highly unlikely (although not impossible) someone would have that as a
> valid value.

It is possible to write valid GNU Make code that generates strings
containing “#”?

> However, this would be a lot of effort (finding all the places in make
> that use the empty string as "false" and modifying them).  And I'm not
> sure it wouldn't cause other issues.  I think, all in all, it's better
> to leave it as-is unless someone can point out a real problem with it
> (besides a general unpleasant aftertaste).

Yeah.

These are different “value worlds” (as Jim Blandy says), and one of them
has a single data type, so this may be the best that can be done without
introducing other data types in the Make language.

Thanks!

Ludo’.

reply via email to

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