[quote author="sigrid" date="1308306646"]If you are using QMAKE_EXTRA_COMPILERS then you can use "depend_command":http://doc.qt.nokia.com/latest/qmake-environment-reference.html#customizing-makefile-output or depends to set an extra dependency on the compiler to force it to build again.[/quote]
Thanks for this hint.
However I ran into deep problem with the different makefile generators:
make (linux)
nmake
jom
msbuild
It seems to be not possible to trigger an extra build for these for backends with one generic pro file.
I finally ended up in:
@
Rules to update a header file: windows_version_revision.rc with the current svn revision.
Have an qmake extra compiler called for each run of make to update windows_version_revision.rc,
but only if needed, to prevent dependent compiles.
A special script is used: update_svn_revision (for details look into the script)
- replace placeholders in windows_version_revision.rc.SubWCRev with the current svn revision number
- output a temporary file and if this is different to windows_version_revision.rc, then copy it over (updating the time stamp)
It is importand to have the .variable_out set to HEADERS so that the Makefile rules recognize the dependency on the
windows_version_revision.rc
To trigger this conditional update of windows_version_revision.rc we need a dependency with an extra target that is never fullfilled.
This forces make to call this target each time.
.depends on extra target: preprocesssvnrev_check
preprocesssvnrev_check.commands just echos
However under windows everything is different:
have special handling for MS IDE backend
there we need an extra PRE_TAGETDEPS that must not be used under nmake
nmake on the other side does not recognize that the conditional touched file was not touched in each nmake
and fires a relink anyway, while jom does not .... clever jom :-)
create the resource file from a template.
PREPROCESS_FILES = windows_version_revision.rc.SubWCRev
preprocesssvnrev.name = "Update svn revision number in windows_version_revision.rc (if needed)."
preprocesssvnrev.input = PREPROCESS_FILES
preprocesssvnrev.output = ${QMAKE_FILE_BASE}
update revision from the current directory
win32:preprocesssvnrev.commands = $${PWD}/update_svn_revision.bat $${PWD} $${PWD}/${QMAKE_FILE_IN} $${PWD}/${QMAKE_FILE_BASE}
unix: preprocesssvnrev.commands = @sh $${PWD}/update_svn_revision.sh $${PWD} $${PWD}/${QMAKE_FILE_IN} $${PWD}/${QMAKE_FILE_BASE}
trigger creation when outside MS IDE (part 1)
contains(TEMPLATE,lib) {
preprocesssvnrev.variable_out = HEADERS
preprocesssvnrev.depends = preprocesssvnrev_check
message (Creating extra dependencies for nmake/make)
}
QMAKE_EXTRA_COMPILERS += preprocesssvnrev
trigger creation when inside MS IDE
contains(TEMPLATE,vclib) {
message (Creating extra dependencies for MS IDE)
PRE_TARGETDEPS += compiler_preprocesssvnrev_make_all
}
trigger creation when outside MS IDE (part 2)
contains(TEMPLATE,lib) {
preprocesssvnrev_check.commands = @echo Trigger conditional svn revision update.
preprocesssvnrev_check.CONFIG += recursive
QMAKE_EXTRA_TARGETS += preprocesssvnrev_check
message (Creating extra dependencies for nmake/make)
}
@