[Qt-interest] Prettier Makefiles - qmake features
Frank Neuhaus
dtag00 at gmail.com
Sat Apr 11 16:52:50 CEST 2009
Hi,
I am trying to make qmake create nicer Makefiles. I.e instead of showing
> g++ blablablaLongLine bla.cpp
make it show
> Compiling bla.cpp...
After writing a couple of perl scripts to filter Qt generated Makefiles
(this worked quite well btw.) I eventually found out that something like
this exists in Qt already and can be called using the feature 'silent'
I.e. you use:
qmake -config silent
or
CONFIG += silent
inside my .pro file.
However the output doesn't look particularly nice and is hard to read. I
only want to do some minor changes to increase readability. I found out that
this silent feature resides mainly in my
/usr/lib/qt4/mkspecs/features/silent.prf file. I obviously do not want to
change the files in /usr/lib/...
So my first idea was to simply add the code from silent.prf:
QMAKE_CC = @echo "\*\*\* Compiling $<..." && $$QMAKE_CC
QMAKE_CXX = @echo "\*\*\* Compiling $<..." && $$QMAKE_CXX
QMAKE_LINK = @echo "\*\*\* Linking $@..." && $$QMAKE_LINK
QMAKE_LINK_SHLIB = @echo "\*\*\* Linking $@..." && $$QMAKE_LINK_SHLIB
to my .pro file. This works well for the compile and link steps. However it
does not work for the uic and moc step. This is because the silent support
was obviously 'hardcoded' into moc.prf and uic.prf. More specifically, there
are these lines:
...
moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands
moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands
uic.commands = @echo uic ${QMAKE_FILE_IN} && $$uic.commands
...
Scattered in these .prf files. So my idea was to simply add these lines to
my .pro file as well. However this does not work. These lines make CHANGES
to the moc_header.commands variable for example, which is not set at the
time of execution of my .pro file yet.
So the first question is: Is there any way to make this work? I.e. can I
force uic.prf/moc.prf to be processed BEFORE these lines?
A second thing i tried is: Create my own "feature" called mysilent.prf and
then put all this stuff into this file. First thing I noted was: there
appears to be a bug in qmake:
http://doc.trolltech.com/4.5/qmake-advanced-usage.html claims it searches
the project root directory for mysilent.prf. This does NOT appear to be the
case. After I moved my mysilent.prf to /usr/lib/qt4/mkspecs/features (which
is highly undesirable though) my file was processed. However the original
order problem (moc/uic have to be processed before my file) remained. Then i
played around inside my .pro file:
Instead of simply writing
CONFIG += mysilent
i wrote
CONFIG += moc uic mysilent
with no change...
then i tried
CONFIG += mysilent moc uic
and suddenly it worked - however the order of processing of these files is
_completely_ unclear to me.
So my second question is: Where can I learn about the order of processing of
these files? (And why is my .prf file not processed when it is in the
project root directory?) Am I doing 'evil' here? ;-)
Thanks a lot :-)
Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090411/db24764b/attachment.html
More information about the Qt-interest-old
mailing list