5

有没有办法告诉 qmake 向 Makefile 添加一个包含指令以包含其他 Makefile。

我需要在生成的 Makefile 开头添加一行:

包括 custom.inc

也许只有一种方法可以将文本从 qmake 输出到 Makfile,但我找不到。

4

3 回答 3

3

您可以使用未记录的QMAKE_EXTRA_INCLUDES变量,例如

QMAKE_EXTRA_INCLUDES += /path/to/your/file.mk

于 2017-04-15T14:32:15.853 回答
0

I haven't found a way to include a Makefile, but I have had a similar problem where I wanted one file to contain a common set of build variables. The solution I came up with was to use the QMake command include(filename.pro) (see QMake reference page). This causes QMake to include another project file. In my case, that contained all of the common settings.

于 2012-10-15T13:11:49.973 回答
0

您可以在 make 文件中定义一个新目标,然后告诉该目标做什么:

mytarget.target = .buildfile
mytarget.commands = make -f AnotherMakeFile
QMAKE_EXTRA_TARGETS += mytarget
PRE_TARGETDEPS += .buildfile

最后 2 个语句将您的目标 .buildfile 添加到 Makefile 并将 mytarget 添加到 Qt 编译过程

在这里您可以获得更多信息:http: //qt-project.org/doc/qt-4.8/qmake-environment-reference.html

于 2012-10-12T15:55:46.717 回答