Function-only pro-file, how to suppress generating Makefile?
-
Hi,
I have pro-file that contains only function call, for example
@
#test.pro
message("hello")
@Running qmake on this pro-file generates Makefile. This Makefile is useless. How to suppress generating it?
Thank you!
-
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.
-
[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!
-
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.
-
If you want a simple example, you can take a look at my QEasyShell project: "link":https://github.com/sierdzio/qeasyshell.
-
Unfortunately function-only test.pri file also generates Makefile.
-
Oops ;-) Sorry for a bad pointer, then. I guess this leaves you with QMAKE_MAKEFILE option.
-
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
-
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? -
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.
-
OK, thank you, sierdzio!