I'm using scons as my build system of c .
There's a sub directory that contains a static library.
I've tried to set:
NoClean("${PATH_TO_DIR}")
But the files in this directory are still removed by scons -c
.
Is there a way to prevent this command from removing all files generated in this directory?
CodePudding user response:
scons -c .
will only remove the target file under the certain directory. So this is a fallback to resolve my problem.
CodePudding user response:
The flag -c
works more or less like this:
- List all the files that could be built by this call of
scons
if the flag was not there. - Add to the list relevant files marked to be cleaned with
Clean()
. - Delete from the list the files marked with
NoClean()
(non-recursively). - Remove all the files that are remaining on the list.
SCons is very focused on files and it doesn't work that well with directories. Usually, it just creates them automatically whenever they are needed and for the rest of the time it pretends they doesn't exist and it is all a flat file-system. It doesn't even delete automatically created directories so your NoClean()
is double-ineffective :-) (You would need to call Clean()
on the directory for SCons to be able to remove it during cleaning.)
I think your only option is to call NoClean()
for every file that you create in this directory. (If you have the list/set of those files lying somewhere, you can just call NoClean()
once passing the list to it.)