2013-09-22 Paul Smith <psmith@gnu.org>
+ * 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
``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
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:
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;