[Scons-users] How do you get scons to clean up side-effect files?

Gary Oberbrunner garyo at oberbrunner.com
Tue Jun 12 08:17:03 EDT 2012


On Mon, Jun 11, 2012 at 9:17 PM, M Busche <spammymatt94 at yahoo.com> wrote:


> ...

> Running scons will create mytest.o and mytest (executable), but (due to

> the -fprofile-arcs and -ftest-coverage compiler options) also creates the

> file mytest.gcno needed for subsequent code coverage analysis. This is

> exactly what I wanted. But I'd like scons -c to remove this gcno file.

> It does not. How can I modify the simple SConsctruct file above to

> clean this file at the same time mytest.o is cleaned?



I think env.Clean() is what you want.

Clean(*targets*, *files_or_dirs*)*env*.Clean(*targets*, *files_or_dirs*)This
specifies a list of files or directories which should be removed whenever
the targets are specified with the *-c* command line option. The specified
targets may be a list or an individual target. Multiple calls to *Clean*()
are legal, and create new targets or add files and directories to the clean
list for the specified targets.

Multiple files or directories should be specified either as separate
arguments to the *Clean*() method, or as a list. *Clean*() will also accept
the return value of any of the construction environment Builder methods.
Examples:

The related *NoClean*() function overrides calling *Clean*() for the same
target, and any targets passed to both functions will *not* be removed by
the *-c* option.

Examples:

Clean('foo', ['bar', 'baz'])
Clean('dist', env.Program('hello', 'hello.c'))
Clean(['foo', 'bar'], 'something_else_to_clean')


In this example, installing the project creates a subdirectory for the
documentation. This statement causes the subdirectory to be removed if the
project is deinstalled.

Clean(docdir, os.path.join(docdir, projectname))




--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120612/51a6cc98/attachment.htm>


More information about the Scons-users mailing list