PDA

View Full Version : Qmake Extra Targets



ChrisW67
7th September 2009, 09:08
Hi All,

I wanted to roll building my Assistant-based help into the general qmake build process so I thought I'd just shoehorn it into the pro file. I looked at the usually very clear docs and found them somewhat lacking. Nothing I did seem to generate an extra target. This is the session where I created a basic empty project and pasted the example from the docs:

chrisw@newton ~/workspace/zzbug $ cat test.pro
TARGET = test
TEMPLATE = app
CONFIG += qt warn_on
SOURCES += main.cpp

mytarget.target = .buildfile
mytarget.commands = touch $$mytarget.target
mytarget.depends = mytarget2

mytarget2.commands = @echo Building $$mytarget.target

QMAKE_EXTRA_TARGETS += mytarget mytarget2

chrisw@newton ~/workspace/zzbug $ qmake test.pro

chrisw@newton ~/workspace/zzbug $ make mytarget2
Building .buildfile

chrisw@newton ~/workspace/zzbug $ make mytarget
make: *** No rule to make target `mytarget'. Stop.

chrisw@newton ~/workspace/zzbug $
Nothing I do generates a target "mytarget" in the Makefile although "mytarget2" does get inserted. What obvious step am I missing?

The example is on Linux/Qt 4.5.2 but I get the same (non-) result on Windows(2009.3 SDK).

Chris

wysota
7th September 2009, 10:23
Run qmake with "-d" parameter and see what comes out.

ChrisW67
7th September 2009, 11:25
Yikes... what exactly am I supposed to look for? Here are the bits surrounding mentions of the extra targets:
DEBUG 1: Project file: reading /home/chrisw/workspace/zzbug/test.pro
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:4 :TARGET: :=: (test)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:5 :TEMPLATE: :=: (app)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:6 :CONFIG: :+=: (qt warn_on)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:7 :SOURCES: :+=: (main.cpp)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:9 :mytarget.target: :=: (.buildfile)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:10 :mytarget.commands: :=: (touch .buildfile)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:11 :mytarget.depends: :=: (mytarget2)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:13 :mytarget2.commands: :=: (@echo Building .buildfile)
DEBUG 1: Project Parser: /home/chrisw/workspace/zzbug/test.pro:15 :QMAKE_EXTRA_TARGETS: :+=: (mytarget mytarget2)
DEBUG 1: Processing default_post: lex::yacc::warn_on::debug::uic::resources::qt::war n_on::release::incremental::link_prl::no_mocdepend ::release::stl::qt_no_framework::qt::warn_on
DEBUG 1: Project Parser: load'ing file /usr/share/qt4/mkspecs/features/default_post.prf.
DEBUG 1: Running project test: CONFIG(debug::debug|release) [10]

and


DEBUG 1: QMAKE_EXTENSION_SHLIB === so
DEBUG 1: QMAKE_EXTRA_COMPILERS === moc_header :: rcc :: image_collection :: moc_source :: uic :: yacc_decl :: yacc_impl :: lex
DEBUG 1: QMAKE_EXTRA_TARGETS === mytarget :: mytarget2 :: mocclean :: mocables
DEBUG 1: QMAKE_EXT_C === .c
DEBUG 1: QMAKE_EXT_CPP === .cpp :: .cc :: .cxx :: .C
DEBUG 1: QMAKE_EXT_CPP_MOC === .moc
DEBUG 1: QMAKE_EXT_H === .h :: .hpp :: .hh :: .hxx :: .H


I cannot see any obvious error messages. The complete output is attached (gzipped).

jpn
7th September 2009, 18:01
You renamed the target as ".buildfile". So try invoking "make .buildfile".

ChrisW67
7th September 2009, 23:13
D'oh! It was always going to be something dumb! :o