goki
goki

Reputation: 322

qmake: generate include other Makefile in Makefile

Is there a way to tell qmake to add to Makefile an include directive to include other Makefile.

I need at the beginning of generated Makefile added one line:

include custom.inc

Maybe there is just a way to output text to Makfiles from qmake but I could not find.

Upvotes: 5

Views: 2636

Answers (3)

alexleutgoeb
alexleutgoeb

Reputation: 3123

You can use the undocumented QMAKE_EXTRA_INCLUDES variable, like

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

Upvotes: 3

jwernerny
jwernerny

Reputation: 7048

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.

Upvotes: 0

Alberto
Alberto

Reputation: 728

you can define a new target into make file and then tell what that target does:

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

last 2 statements add your target .buildfile to Makefile and mytarget to Qt compiling process

here you can get further info: http://qt-project.org/doc/qt-4.8/qmake-environment-reference.html

Upvotes: 0

Related Questions