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

M Busche spammymatt94 at yahoo.com
Mon Jun 11 21:17:29 EDT 2012


I tried to send this once before, but I don't think it showed up.

I'm using scons with gcc on ubuntu.  I'm both an scons and python noob,
but I've managed to get Scons to build my unit-test application with the
compiler options necessary for gcov/lcov code coverage analysis.  Here
is a much stripped and simplified version of my SConscript file sufficient
to show my problem:

obj = Object(
    "mytest.cpp",
    CPPPATH=Split("/home/matt/dev/gtest/gtest-1.6.0/include"),
    CCFLAGS=Split("-Wall -fprofile-arcs -ftest-coverage"))

Program(
    obj,
    LIBS=Split("gtest pthread gcov"),
    LIBPATH=Split("/home/matt/dev/gtest/gtest-1.6.0/"))

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've seen a few
postings about emitters, but the stuff I've read does not make it clear to
me how to use an emitter with the existing Object Builder.

Much thanks.

Matt



More information about the Scons-users mailing list