diff options
author | Paul Smith <psmith@gnu.org> | 2014-04-08 18:25:27 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2014-07-07 01:59:03 -0400 |
commit | e364498113e145b5ac424325e3903cc2287d7e7f (patch) | |
tree | e27af5556c7f8ff34393979ea4b2a3a206052202 /doc/make.texi | |
parent | 85047eb9044d4b72d50e6620c505c675d55ab98b (diff) | |
download | gunmake-e364498113e145b5ac424325e3903cc2287d7e7f.tar.gz |
[SV 41983] Support omitting the text argument to $(file ...)
Reported by Tim Murphy <tnmurphy@gmail.com>
* function.c (func_file): Only write TEXT if it is not NULL.
* NEWS, doc/make.texi: Document the new feature
* tests/scripts/functions/file: Verify that the no-text version of
$(file ...) works and doesn't add a newline.
Diffstat (limited to 'doc/make.texi')
-rw-r--r-- | doc/make.texi | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/make.texi b/doc/make.texi index 8fbdb61..21e32de 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -1528,7 +1528,7 @@ A rule is always expanded the same way, regardless of the form: @example @var{immediate} : @var{immediate} ; @var{deferred} - @var{deferred} + @var{deferred} @end example That is, the target and prerequisite sections are expanded immediately, @@ -7516,7 +7516,7 @@ exist. 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 @@ -7528,8 +7528,9 @@ When the @code{file} function is expanded all its arguments are 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. @@ -7556,7 +7557,7 @@ input file, you might write your recipe like this: @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 |