http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=105&set=custom
+* Allow a no-text-argument form of the $(file ...) function. Without a text
+ argument nothing is written to the file: it is simply opened in the
+ requested mode, then closed again.
+
* Change the fatal error for mixed explicit and implicit rules, that was
introduced in GNU make 3.82, to a non-fatal error. However, this syntax is
still deprecated and may return to being illegal in a future version of GNU
have reversed the change made in version 3.68 because it turned out to
cause a paradoxical situation in cases like:
- export variable = $(shell echo value)
+ export variable = $(shell echo value)
When Make attempted to put this variable in the environment for a
recipe, it would try expand the value by running the shell command
foo.a(b.o) bar.a(c.o) bar.a(d.o)'.
* A suffix rule `.X.a' now produces two pattern rules:
- (%.o): %.X # Previous versions produced only this.
- %.a: %.X # Now produces this as well, just like other suffixes.
+ (%.o): %.X # Previous versions produced only this.
+ %.a: %.X # Now produces this as well, just like other suffixes.
* The new flag `--warn-undefined-variables' says to issue a warning message
whenever Make expands a reference to an undefined variable.
no longer automatically put into the environments of the recipe lines that
Make runs. Instead, only variables specified on the command line or in
the environment are exported by default. To export others, use:
- export VARIABLE
+ export VARIABLE
or you can define variables with:
- export VARIABLE = VALUE
+ export VARIABLE = VALUE
or:
- export VARIABLE := VALUE
+ export VARIABLE := VALUE
You can use just:
- export
+ export
or:
- .EXPORT_ALL_VARIABLES:
+ .EXPORT_ALL_VARIABLES:
to get the old behavior. See the node `Variables/Recursion' in the manual
for a full description.
* A single `include' directive can now specify more than one makefile to
include, like this:
- include file1 file2
+ include file1 file2
You can also use shell file name patterns in an `include' directive:
- include *.mk
+ include *.mk
* The default directories to search for included makefiles, and for
libraries specified with `-lNAME', are now set by configuration.
* The `wildcard' variable expansion function now expands ~ and ~USER.
* Messages indicating failed recipe lines now contain the target name:
- make: *** [target] Error 1
+ make: *** [target] Error 1
* The `-p' output format has been changed somewhat to look more like
makefile rules and to give all information that Make has about files.
@example
@var{immediate} : @var{immediate} ; @var{deferred}
- @var{deferred}
+ @var{deferred}
@end example
That is, the target and prerequisite sections are expanded immediately,
The syntax of the @code{file} function is:
@example
-$(file @var{op} @var{filename},@var{text})
+$(file @var{op} @var{filename}[,@var{text}])
@end example
The operator @var{op} can be either @code{>} which indicates overwrite
expanded first, then the file indicated by @var{filename} will be
opened in the mode described by @var{op}. Finally @var{text} will be
written to the file. If @var{text} does not already end in a newline,
-a final newline will be written. The result of evaluating the
-@code{file} function is always the empty string.
+even if empty, a final newline will be written. If the @var{text}
+argument is not given, nothing will be written. The result of
+evaluating the @code{file} function is always the empty string.
It is a fatal error if the file cannot be opened for writing, or if
the write operation fails.
@example
@group
program: $(OBJECTS)
- $(file >$@@.in,) $(foreach O,$^,$(file >>$@@.in,$O))
+ $(file >$@@.in) $(foreach O,$^,$(file >>$@@.in,$O))
$(CMD) $(CMDFLAGS) @@$@@.in
@@rm $@@.in
@end group
const char *err = strerror (errno);
OSS (fatal, reading_file, _("open: %s: %s"), fn, err);
}
- else
+ if (argv[1])
{
int l = strlen (argv[1]);
- int nl = (l == 0 || argv[1][l-1] != '\n');
+ int nl = l == 0 || argv[1][l-1] != '\n';
if (fputs (argv[1], fp) == EOF || (nl && fputc ('\n', fp) == EOF))
{
const char *err = strerror (errno);
OSS (fatal, reading_file, _("write: %s: %s"), fn, err);
}
- fclose (fp);
}
+ fclose (fp);
}
else
OS (fatal, reading_file, _("Invalid file operation: %s"), fn);