summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-09-29 13:16:21 -0400
committerPaul Smith <psmith@gnu.org>2013-09-29 13:16:21 -0400
commit3bf3fde98470549800147c6390fde17791862e1d (patch)
treeaa92a85b8b03d9a1d23723b5785cbaa017bf8801
parent543521cd475e7182e30a17bd032b9fe2bb740bcb (diff)
downloadgunmake-3bf3fde98470549800147c6390fde17791862e1d.tar.gz
Portability for Guile 1.8. Force UTF-8 encoding.
-rw-r--r--ChangeLog5
-rw-r--r--NEWS15
-rw-r--r--TODO.private24
-rw-r--r--guile.c15
4 files changed, 27 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index fa31980..14ea56d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-09-29 Paul Smith <psmith@gnu.org>
+ * guile.c (GSUBR_TYPE): Pre-2.0 Guile doesn't provide a typedef
+ for gsubr pointers. Create one.
+ (guile_define_module): Use it.
+ (internal_guile_eval): Force UTF-8 encoding for Guile strings.
+
* main.c (main): Clear GNUMAKEFLAGS after parsing, to avoid
proliferation of options.
* NEWS: Document it.
diff --git a/NEWS b/NEWS
index d190fd3..1250ca9 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,14 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
* Each backslash/newline (plus subsequent whitespace) is converted to a
single space
+* New feature: GNU Guile integration
+ This version of GNU make can be compiled with GNU Guile integration.
+ GNU Guile serves as an embedded extension language for make.
+ See the "Guile Function" section in the GNU Make manual for details.
+ Currently GNU Guile 1.8 and 2.0+ are supported. In Guile 1.8 there is no
+ support for internationalized character sets. In Guile 2.0+, scripts can be
+ encoded in UTF-8.
+
* New command line option: --output-sync (-O) enables grouping of output by
target or by recursive make. This is useful during parallel builds to avoid
mixing output from different jobs together giving hard-to-understand
@@ -47,6 +55,8 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
* New feature: "!=" shell assignment operator as an alternative to the
$(shell ...) function. Implemented for compatibility with BSD makefiles.
+ Note there are subtle differences between "!=" and $(shell ...). See the
+ description in the GNU make manual.
WARNING: Backward-incompatibility!
Variables ending in "!" previously defined as "variable!= value" will now be
interpreted as shell assignment. Change your assignment to add whitespace
@@ -58,11 +68,6 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
version of POSIX (see http://austingroupbugs.net/view.php?id=330). It is
not necessary to define the .POSIX target to access this operator.
-* New feature: GNU Guile integration
- This version of GNU make can be compiled with GNU Guile integration.
- GNU Guile serves as an embedded extension language for make.
- See the "Guile Function" section in the GNU Make manual for details.
-
* New feature: Loadable objects
This version of GNU make contains a "technology preview": the ability to
load dynamic objects into the make runtime. These objects can be created by
diff --git a/TODO.private b/TODO.private
index 5c73d9c..8faa63e 100644
--- a/TODO.private
+++ b/TODO.private
@@ -99,30 +99,6 @@ The Rest of the List
you just can't figure it out. The way variables are expanded now
means this isn't 100% trivial, but it probably won't be hard.
- 8) Integration of Guile as an embedded scripting language. This means:
- allowing Guile functions to be declared in makefiles somehow, then
- providing a syntax for invoking them. At least one formulation of
- that would have the function resolve to a string which would be
- substituted in the makefile, kind of like $(shell ...) does now, but
- using the embedded interpreter so there's no process forked of
- course. Obviously this is an optional add-on feature.
-
- It could be more advanced than that, even, who knows? Maybe make
- could provide Guile functions that allow Guile scripts more direct
- access to internal make structures, somehow. This kind of thing
- needs a lot of thought.
-
- Also there's always the flip side: in some very fundamental ways
- make isn't the best choice right now for a complex build tool. It's
- great for simple-to-medium tasks, but there are already other tools
- available for the really tough situations. Ask yourself,
- realistically, how much work is worthwhile to add to make, given the
- fundamentals you can't really overcome without significantly
- affecting backward compatibility--and then why not use another tool
- in the first place?
-
- Something to think about.
-
-------------------------------------------------------------------------------
Copyright (C) 1997-2013 Free Software Foundation, Inc.
diff --git a/guile.c b/guile.c
index 9c9bf5c..142c321 100644
--- a/guile.c
+++ b/guile.c
@@ -24,6 +24,15 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <libguile.h>
+/* Pre-2.0 versions of Guile don't have a typedef for gsubr function types. */
+#if SCM_MAJOR_VERSION < 2
+# define GSUBR_TYPE SCM (*) ()
+/* Guile 1.x doesn't really support i18n. */
+# define scm_from_utf8_string(_s) (_s)
+#else
+# define GSUBR_TYPE scm_t_subr
+#endif
+
static SCM make_mod = SCM_EOL;
static SCM obj_to_str = SCM_EOL;
@@ -72,10 +81,10 @@ guile_define_module (void *data UNUSED)
#include "gmk-default.h"
/* Register a subr for GNU make's eval capability. */
- scm_c_define_gsubr ("gmk-expand", 1, 0, 0, (scm_t_subr) guile_expand_wrapper);
+ scm_c_define_gsubr ("gmk-expand", 1, 0, 0, (GSUBR_TYPE) guile_expand_wrapper);
/* Register a subr for GNU make's eval capability. */
- scm_c_define_gsubr ("gmk-eval", 1, 0, 0, (scm_t_subr) guile_eval_wrapper);
+ scm_c_define_gsubr ("gmk-eval", 1, 0, 0, (GSUBR_TYPE) guile_eval_wrapper);
/* Define the rest of the module. */
scm_c_eval_string (GUILE_module_defn);
@@ -100,7 +109,7 @@ guile_init (void *arg UNUSED)
static void *
internal_guile_eval (void *arg)
{
- return cvt_scm_to_str (scm_c_eval_string (arg));
+ return cvt_scm_to_str (scm_eval_string (scm_from_utf8_string (arg)));
}
/* This is the function registered with make */