Building Qt: 'make clean' causes everything to get recompiled?
Solution 1
I don't know where you got the idea that doing a make clean
before a make install
was somehow something you should be doing.
The canonical INSTALL
file for autotools spells out the process:
./configure
make
make check
(optional)make install
make installcheck
(optional)
At item 6, it says:
You can remove the program binaries and object files from the source code directory by typing
make clean
.
(Emphasis mine.)
make clean
is something you do before recompiling, to make sure you get a clean build and don't have left-over by-products from previous runs. You can do it after a make install
if you want to free some space but keep the source and configuration around. You should not do it before installing.
Solution 2
Qt build script works like this:
1 First build qmake
2 Generate Makefile for a subprojects (*.pro)
3 Start building libaries, then examples and demo projects
Yes, make clean will clean everything but your config file generated by Qt.
My trick is remove the "demo" and "examples" in the top *.pro file, which save about 40% time (on a i5 CPU)
Anway, you could setup ccache to speed up compiling, but that requires about 2G+ disk space for buffering
Related videos on Youtube
Comments
-
syntaxerror over 1 year
(This applies to
Qt
versions >= 4.7.3.) I made an attempt to buildQt
with custom parameters on my Debian box and it actually took AGES to compile (IIRC more than 6 hours on a single-core CPU). That's why I wanted to make sure I won't make any stupid mistakes in the process. However, I chose to do amake clean
to get the*.o
files and other stuff cleaned up after successful linking. It seemed a bad idea! For I did amake install
just after that, and you won't believe it, themake clean
attempt caused everything to get recompiled after the cleanup process! Though up to now, I've been thinking thatmake clean
does allow a neat installation even with all object files and related stuff removed. Obviously, withQt
, things are different.In the official documentation for
Qt 4.7
(cf. http://qt-project.org/doc/qt-4.7/install-x11.html), they did not even mention an optionalmake clean
in the sequence of commands. As I know now, for a good reason. All the same, I can't call this "complying with standards" as I've already compiled hundreds of open-source apps, and NEVER didmake clean
trigger any recompilation process nor remove anything that should be kept (unless there was a bug in there)-
Amitav Pajni over 11 yearsIn any sane system,
make clean
cleans up the build directory. Of course everything would get compiled again. I don't know what you've been working with thatmake clean
wouldn't have this effect, but it doesn't sound particularly sane.
-
-
syntaxerror over 11 yearsYeah, you're right: that demos/examples stuff is indeed a very huge part of the story. Saved me lots of time indeed. I knew that already, but thanks for pointing it out anyway. :)
-
syntaxerror over 11 yearsWell, I think my main problem was that I thought what you were trying to explain was "already" a
make distclean
and notmake clean
. I had assumedmake clean
to be a lot less "drastic". :) Obviously I was wrong.