Question

I'm working on implementing a build system using scons for a somewhat large software project. There is a directory structure which separates the code for individual libraries and programs into their own directories. With our existing make system, I can do a "make clean" in a single program directory and it will only clean the files associated with the source in that directory. If I do an "scons -c" though, it recognizes that the program depends on a slew of libraries that are in sibling (or cousin) directories and cleans all of the files for those as well. This is not what I want since I then have to rebuild all of these libraries which can take several minutes.

I have tried playing with the "NoClean()" command, but have not gotten it to work in the way I need. Given the size of the code base and complexity of the directory structure, I can't realistically have a NoClean() line for every file in every library.

Is there any way to tell scons to ignore any dependencies above the current directory when doing a clean (i.e. scons -c) ?

Was it helpful?

Solution

I'd love to have a good answer to this myself.

The only solution that I can offer for now is that you get Noclean working. So in your library, you should have something like this

lib_objs = SharedObject(source_list)
mylib = SharedLibrary('libname', lib_objs)

So for this we want to protect the library and the sources from being cleaned.

NoClean([mylib, lib_objs])

Notice that I had to split the building of the object files from the library because I want to be able to pass them to NoClean as well.

OTHER TIPS

Try using the target name when cleaning.

scons -c aTargetName

You can use the SCons Alias() function to simplify the target name and to also group several target names into one alias.

With this approach you'll have to add an alias in each appropriate subdir, which isn't necessarily a bad thing :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top