Hi Paul,
Under at least SOME conditions, “make clean” appears to delete qmake-related files that it needs itself later on to complete its work.
I think that should not be the case. Make clean should clean all object files and all generated source files but should keep the Makefiles intact. If you run ‘make distclean’ the Makefiles will be gone too and then you’ll need to invoke qmake again.
Under at least SOME conditions, make fails to rebuild missing generated header files — I think that to get around this I had to run qmake again between “make clean” and “make” — is that just what people do?
That is true - sometimes make will not generate Mock or Driver testing sources - the solution is to ‘del Makefile* && qmake && make’. The reason is that the Makefiles are generated by qmake when you invoke it. qmake would scan the dependencies of each source file and will create the Makefiles accordingly. When you modify a source or a header file the dependencies written in the Makefile will not be updated unless you rebuild the Makefiles. Normally, ‘make qmake’ would do the job but it does not work in our case due to the hierarchical nesting of project files. The workaround is to manually remove the Makefiles and invoke qmake again (as the command above does). I was thinking about trying to fix qmake so that ‘make qmake’ does propagate to subprojects but I never came to that.
So to answer you question:
What is the correct way to “rebuild from scratch” using the same source files after a previous full or partial (aborted) build, to be sure not to rely on any previous build products?
make distclean && qmake && make
I typically run just ‘make’ and if I get problems caused from bad dependencies, I’d run ‘del Makefile* && qmake’ and then ‘make’ again. By doing so I would avoid recompiling all object files that are practically not out of date.
Did you have the dependency problem only after playing around with some source files? If you have a clean source tree all you need to do is ‘qmake && make’ and all should do smoothly.
Regards,
Peter
