diff --git a/ChangeLog b/ChangeLog index 8c5b3e5d..5b0fcb59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2013-09-22 Paul Smith + * read.c (eval): If load_file() returns -1, don't add this to the + "to be rebuilt" list. + * doc/make.texi (load Directive): Document it. + * guile.c (guile_gmake_setup): Don't initialize Guile so early. (func_guile): Lazily initialize Guile the first time the $(guile ..) function is invoked. Guile can steal file descriptors which diff --git a/doc/make.texi b/doc/make.texi index 62c71910..f89f8b77 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -10910,7 +10910,8 @@ The @code{load} directive and extension capability is considered a ``technology preview'' in this release of GNU make. We encourage you to experiment with this feature and we appreciate any feedback on it. However we cannot guarantee to maintain backward-compatibility in the -next release. +next release. Consider using GNU Guile instead for extending GNU make +(@pxref{Guile Function, ,The @code{guile} Function}). @end quotation @end cartouche @@ -10978,7 +10979,9 @@ same directive. The initializing function will be provided the file name and line number of the invocation of the @code{load} operation. It should return a value of type @code{int}, which must be @code{0} on failure -and non-@code{0} on success. +and non-@code{0} on success. If the return value is @code{-1}, then +GNU make will @emph{not} attempt to rebuild the object file +(@pxref{Remaking Loaded Objects, ,How Loaded Objects Are Remade}). For example: diff --git a/read.c b/read.c index a4ca72d6..7f90b9b9 100644 --- a/read.c +++ b/read.c @@ -947,19 +947,27 @@ eval (struct ebuffer *ebuf, int set_default) PARSEFS_NOAR); free (p); - /* Load each file and add it to the list "to be rebuilt". */ + /* Load each file. */ while (files != 0) { struct nameseq *next = files->next; const char *name = files->name; struct dep *deps; + int r; + + /* Load the file. 0 means failure. */ + r = load_file (&ebuf->floc, &name, noerror); + if (! r && ! noerror) + fatal (&ebuf->floc, _("%s: failed to load"), name); free_ns (files); files = next; - if (! load_file (&ebuf->floc, &name, noerror) && ! noerror) - fatal (&ebuf->floc, _("%s: failed to load"), name); + /* Return of -1 means a special load: don't rebuild it. */ + if (r == -1) + continue; + /* It succeeded, so add it to the list "to be rebuilt". */ deps = alloc_dep (); deps->next = read_files; read_files = deps;