help-make
[Top][All Lists]
Advanced

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

Using Guile in a Makefile


From: johol
Subject: Using Guile in a Makefile
Date: Wed, 14 Dec 2022 13:12:43 +0100
User-agent: Roundcube Webmail/1.4.13

I'm using GNU Make 4.4 compiled from source with Guile support in Linux and I try to understand how to use it. Below is my first attempt for a trivial Makefile using Guile

---- 8< ----
define FNORD
;; Simple initial Guile-test
(define (fnord value)
  value)

#f
endef

# Internalize the Guile code
$(guile $(FNORD))

FOO = $(guile (fnord “F N O R D”))
$(info $$FOO is [$(FOO)])

fnord:
        for i in "$(FOO)"; do echo $$i; done
---- 8< ----

and this happens when I run GNU Make

$ make --version
GNU Make 4.4
Built for x86-64-pc-linux-gnu
Copyright (C) 1988-2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, the the extent permitted by law.
$ make fnord
$FOO is [)]
for i in ")"; do echo $i; done
)
$

I guess I have made some error in the Makefile? Or does the make binary not have any Guile support? How can I tell if that is the case?

It does not matter if I change the implementation of Guile fnord function to
(define (fnord value)
  17)
or
(define (fnord value)
  "fNoRd")
or
(define (fnord value)
  (format #t "fNoRd"))

I still get a single ')' as the result from calling the Guile 'fnord' function...


Also I tried running GNU Make with option '-d' like this (replaced lots of text with '...')
$ make -d fnord
GNU Make 4.4
Built for x86-64-pc-linux-gnu
Copyright (C) 1988-2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, the the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
$FOO is [)]
Updating makefiles....
 Considering target file 'Makefile'.
  Looking for an implicit rule for 'Makefile'.
...
 No need to remake target 'Makefile'
Updating goal targets....
Considering target file 'fnord'.
 File 'fnord' does not exist.
 Finished prerequisites of target file 'fnord'.
Must remake target 'fnord'.
Makefile:16: update target 'fnord' due to: target does not exist
for i in ")"; do echo $i; done
Putting child 0x1ecea70 (fnord) PID 26627 on the chain.
Live child 0x1ecea70 (fnord) PID 26627
)
Reaping winning child 0x1ecea70 PID 26627
Removing child 0x1ecea70 PID 26627 from chain.
Successfully remade target file 'fnord'.
$


/John



reply via email to

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