1
votes

The problems is that if pro-file was changed 'qmake' trying to generate new makefile during 'make clean'.

Steps to reproduce this situation:

  1. qmake test.pro
  2. touch test.pro && make clean

Here's an minimal example of pro:

TARGET = qmake-runs-on-make-clean  
TEMPLATE = app

warning(qmake runs even if it's make clean)

I want to get rid of this behaviour or at least make qmake do not proceed some parts of pro-file on 'make clean'

How can I achieve this ?

2

2 Answers

2
votes

After some research i came out with a not good looking but working solution. qmake has an undocumented option named 'no_autoqmake'. So i passed it to CONFIG and then wrote my own Makefile target.

CONFIG += no_autoqmake
for(arg, QMAKE_ARGS){
    tmp = $$section(arg, =, 0, 0)
    !equals(tmp, MAKE_ARGS){
        QMAKE_ARGUMENTS += $$arg
    }
}

promod.name      = on_pro_modified
promod.target    = Makefile
promod.commands  = $$QMAKE_QMAKE $$_PRO_FILE_ $$QMAKE_ARGUMENTS MAKE_ARGS='$(MAKECMDGOALS)'
promod.depends   = $$_PRO_FILE_ $$QMAKE_INTERNAL_INCLUDED_FILES

PRE_TARGETDEPS += $$_PRO_FILE_
QMAKE_EXTRA_TARGETS += promod

contains(MAKE_ARGS, clean) : CLEAN_MODE_ACTIVATED=1

If someonen find out a better solution, please share.

0
votes

Edit the generated Makefile and remove the part where qmake is invoked.

But the rule is there for a reason. Maybe you are trying to solve a different problem?