manpagez: man pages & more
info make
Home | html | info | man

File: make.info,  Node: Guile Types,  Next: Guile Interface,  Prev: Guile_Integration.php">Guile Integration,  Up: Guile_Integration.php">Guile Integration

12.1.1 Conversion of Guile Types
--------------------------------

There is only one "data type" in 'make': a string.  GNU Guile, on the
other hand, provides a rich variety of different data types.  An
important aspect of the interface between 'make' and GNU Guile is the
conversion of Guile data types into 'make' strings.

   This conversion is relevant in two places: when a makefile invokes
the 'guile' function to evaluate a Guile expression, the result of that
evaluation must be converted into a make string so it can be further
evaluated by 'make'.  And secondly, when a Guile script invokes one of
the procedures exported by 'make' the argument provided to the procedure
must be converted into a string.

   The conversion of Guile types into 'make' strings is as below:

'#f'
     False is converted into the empty string: in 'make' conditionals
     the empty string is considered false.

'#t'
     True is converted to the string '#t': in 'make' conditionals any
     non-empty string is considered true.

'symbol'
'number'
     A symbol or number is converted into the string representation of
     that symbol or number.

'character'
     A printable character is converted to the same character.

'string'
     A string containing only printable characters is converted to the
     same string.

'list'
     A list is converted recursively according to the above rules.  This
     implies that any structured list will be flattened (that is, a
     result of ''(a b (c d) e)' will be converted to the 'make' string
     'a b c d e').

'other'
     Any other Guile type results in an error.  In future versions of
     'make', other Guile types may be converted.

   The translation of '#f' (to the empty string) and '#t' (to the
non-empty string '#t') is designed to allow you to use Guile boolean
results directly as 'make' boolean conditions.  For example:

     $(if $(guile (access? "myfile" R_OK)),$(info myfile exists))

   As a consequence of these conversion rules you must consider the
result of your Guile script, as that result will be converted into a
string and parsed by 'make'.  If there is no natural result for the
script (that is, the script exists solely for its side-effects), you
should add '#f' as the final expression in order to avoid syntax errors
in your makefile.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.