bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request, with implementation, test and rationale.


From: Paul Smith
Subject: Re: Feature request, with implementation, test and rationale.
Date: Wed, 07 Nov 2012 10:19:25 -0500

On Wed, 2012-11-07 at 14:39 +0100, Fredrik Öhrström wrote:
> To get around this particular problem I implemented a workaround
> marcro called ListPathsSafely that writes the contents of a variable
> to disk.

There is already a new $(file ...) function in the current CVS version
of GNU make, which writes to a file.

The description in the manual reads:

---------
The `file' function allows the makefile to write to a file.  Two modes
of writing are supported: overwrite, where the text is written to the
beginning of the file and any existing content is lost, and append,
where the text is written to the end of the file, preserving the
existing content.  In all cases the file is created if it does not
exist.

   The syntax of the `file' function is:

     $(file OP FILENAME,TEXT)

   The operator OP can be either `>' which indicates overwrite mode, or
`>>' which indicates append mode.  The FILENAME indicates the file to
be written to.  There may optionally be whitespace between the operator
and the file name.

   When the `file' function is expanded all its arguments are expanded
first, then the file indicated by FILENAME will be opened in the mode
described by OP.  Finally TEXT will be written to the file.  If TEXT
does not already end in a newline, a final newline will be written.
The result of evaluating the `file' function is always the empty string.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]