As issues like #13088 and #13076 exist (and there's more than that), and this appears to be an issue with auto-generated (.gen.) files, then maybe the build system should delete them every time something is compiled.
I thought about that, but I fear that it would force a rebuild of most of the engine, since there are many generated files used all over the place, so SCons might consider that most of the code changed, even if the generated files are the same (different timestamps). Might be worth testing though.
This is a bad idea. Windows multi-core compilation fails because of the generated files (#5042), so it runs fine after the files are already generated. If you delete them every time, the build will never complete, forcing Windows to use single-core compilation, unless we also make some workaround to avoid the issue.
Also, when working on something I rebuild the engine multiple times, which is usually fast because it only rebuilds what I changed. If files are regenerated, it'll take more time than it's needed. At least there should be an option to bypass that.
Let's change the proposal to be about adding a SCons option to delete generated files instead, or extend the existing scons -c so that it takes care of it.
The side effect feature of SCons might be the right one for this.
https://bitbucket.org/scons/scons/wiki/SConsMethods/SideEffect
Also as a easy work-around you can always use
git clean -fdx
If you aren't sure what that will do try:
git clean -idx
This is already covered by git clean -dfxi (see the above comment), closing. You can use git clean -dfXi (note the uppercase X) to remove only ignored files and not untracked files.
Note that scons -c works fine too, but you need to use the same build arguments as for a build (e.g. scons p=x11 target=release_debug -c).
Most helpful comment
Let's change the proposal to be about adding a SCons option to delete generated files instead, or extend the existing
scons -cso that it takes care of it.