Important: Please read the Qt Code of Conduct -

Qmake commands tokens

  • When defining new Makefile target commands it is appropriate to use variables provided by qmake that define the appropriate command for the operation on the target platform. For example, I've discovered (by grepping through the mkspeks/features files) that QMAKE_DEL_FILE provides the appropriate command to delete a file. There are obviously other such qmake variables for host system commands, but I have been unable to find them in the qmake manual's Variable Reference, or anywhere else.

    Where are the qmake commands variables listed?

  • [quote author="Castalia" date="1306548274"]Where are the qmake commands variables listed?

    Please take a look at the "documentation":

  • you're right
    QMAKE_DEL_FILE is not in the qmake reference documentation. You could let the docs guys know about it?

    there is an example in devnet wiki, maybe this is of some help :
    "Building Qt for Embedded Linux":

    and also :
    "external tools on qmake":

  • The qmake commands variables are not list in the documentation that is referenced. Take as an example the QMAKE_DEL_FILE variable; not found in the documentation.

    The commands variables are used when specifying target.commands. An inspection of a generated Makefile reveals that these variables produce Makefile macros that are defined in the Makefile as the specific host system commands to be used. This is the conventional solution to providing Makefile portability. The difficulty is providing the appropriate specifications in the .pro file that generates the Makefile. The current solution that I am using is to use the Makefile macros found by inspecting a Makefile generated by qmake from the .pro file. But this is not a reliable solution: If the .pro file is used by someone else with different mkspecs, even for the same platform, the resulting Makefile macros might be different and so the target.commands from the .pro file will no longer work correctly.

    Abstraction is good. Opaque abstraction, not so good. So the question remains: Where are the qmake commands variables listed?

  • One of our Trolls mention in this thread that the qmake docs should be improved."QMAKE: how to write more complex project?":

  • No joy (yet). The Building Qt for Embedded Linux includes some QMAKE_XXX variables that look like the desired qmake commands variables. This is suggestive, but not definitive. The external tools on qmake link leads on to a Qt Centre’s Undocumented qmake page which, unfortunately, doesn't list any of the qmake commands variables.

    The route I've taken is to crawl through the mkspecs .conf files. In various places various commands variables can be found. The pattern seems to be that the command macro names found in a Makefile generated by qmake are provided by a qmake variable with the same name prefixed by QMAKE_. But this pattern is not completely reliable. For example, A Makefile.Release file generated by qmake contains a SED macro for the sed string editor (which I happen to need), but no QMAKE_SED variable can be found anywhere under mkspecs. The definition of the SED macro is obviously defined somewhere for qmake to know to use it. But it's hidden in the bowls of the beast, and very likely isn't available as a qmake variable at all.

    The Qt docs folks almost certainly are aware of the shortcomings of the qmake documentation. I don't wonder that they are not eager to venture into the depths to completely document a mechanism that has become so crufty that it may no longer be possible to complete document.

    So it goes....

  • The QMAKE: how to write more complex project? posting is an acknowledgement of the problem. As it happens, I've already obtained the Creator source that the poster suggests looking into. More crawling through configuration files ....

    The gist seems to be that becoming proficient with "advanced" qmake usage is a rite of passage: Surviving results in a degree of capability to generate sophisticated Makefiles portable from .pro files. Most do not attempt the passage, not to mention survive.

Log in to reply