Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Function-only pro-file, how to suppress generating Makefile?
Qt 6.11 is out! See what's new in the release blog

Function-only pro-file, how to suppress generating Makefile?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #2

    I don't think you can completely turn it off, but you can at least change the name so that it does not interfere with your project build. This can be done using:
    @
    QMAKE_MAKEFILE = newName
    @

    More info: "link":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#qmake-makefile.

    Or, you can change .pro file into a .pri file, which does not generate any makefiles.

    (Z(:^

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alexey
      wrote on last edited by
      #3

      [quote author="sierdzio" date="1401696949"]
      Or, you can change .pro file into a .pri file, which does not generate any makefiles.[/quote]

      Where in the documentation can I read about it? Thank you very much!

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #4

        A bit more information is here: "link":http://qt-project.org/doc/qt-5/qmake-test-function-reference.html#include-filename. In general, just try it out. .pri files have exactly the same syntax as .pro files.

        (Z(:^

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #5

          If you want a simple example, you can take a look at my QEasyShell project: "link":https://github.com/sierdzio/qeasyshell.

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Alexey
            wrote on last edited by
            #6

            Unfortunately function-only test.pri file also generates Makefile.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #7

              Oops ;-) Sorry for a bad pointer, then. I guess this leaves you with QMAKE_MAKEFILE option.

              (Z(:^

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #8

                I took a look through the docs, and there are 2 more interesting variables for you to play with:

                • "MAKEFILE":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#makefile
                • "MAKEFILE_GENERATOR":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#makefile-generator Maybe you can set it to something like /dev/null and it will work

                (Z(:^

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Alexey
                  wrote on last edited by
                  #9

                  I've added this line
                  @
                  MAKEFILE_GENERATOR=/dev/null
                  @
                  to my pro-file and indeed no Makefile was generated. But qmake prints me the following text:
                  Unknown generator specified: /dev/null
                  I do not know if this is a harmless warning or error. Is it safe to use this workaround in production code?

                  1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #10

                    I think that for production a cleaner solution would be better. /dev/null is only available on Mac and Linux, so it will probably not work on Windows. Maybe some dummy "do nothing" cross-platform script can be devised. Personally, I would probably choose to change the Makefile name to something harmless like tmp_makefile, and then add it to .gitignore so that it is not accidentally added to version control. Or, if you are in a hardcore mood, you could modify qmake binary itself to stop it from generating makefiles.

                    (Z(:^

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Alexey
                      wrote on last edited by
                      #11

                      OK, thank you, sierdzio!

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved