views:

118

answers:

1

In a Qt project, I need to provide a custom make dist. So I added the following lines to the *.pro file:

QMAKE_EXTRA_TARGETS += dist
dist.commands = [...]

That works, but shows the following warnings each time I run make:

Makefile:209: warning: overriding commands for target `dist'
Makefile:188: warning: ignoring old commands for target `dist'

Apart from that, it works pretty well and completely overwrites Qmake's default make dist target. But the warnings are really annoying.

I could use a different target name such as make dist-all, but make dist is an established standard command. Is it possible to overwrite Qmake's make dist without getting warnings?

Maybe I'm on the wrong track? Should I handle this issue in a different way?

A: 

the warning is generated by make not by qmake, because dist gets defined twice - which is not allowed. You can't redefine the dist target without recompiling qmake, because the dist target is hardcoded in qmake/generators/unix/unixmake.cpp

to solve the problem you could edit the makefile after it is generated by qmake (using a script for example that wrapps the qmake call and then removes the standard dist target)

or use another target-name like 'myDist'

Nikolaus Gradwohl
Just a nitpick: The question already states that the warnings come from make, not qmake. Nevertheless, it is qmake that generates the duplicate dist target in the first place. It could simply suppress writing its own dist target if the *.pro file redefines it. But for some strange reason, it instead writes them both into the Makefile.
vog
Rewriting the Makefile afterwards is not reliable, because the Makefile regenerates itself (by calling qmake) after each change to the *.pro file.
vog
the reason why the default-'dist'-target gets written in the makefile isn't strange at all - it's hardcoded in the qmake source.
Nikolaus Gradwohl