user951313
user951313

Reputation: 13

How to execute a library's Makefile from qmake

I have a Qt project and a subfolder libparanoia that has it's own Makefile (few .mk's) and a RULES/conf folder. When I execute make in the libparanoia folder it generates the .o files in a subfolder.

How can I, when I build my Qt application, run the makefile from libparanoia (a subfolder in the Qt project folder) and add the .o library to my Qt project (ok that's LIBS+=)?

Upvotes: 1

Views: 2460

Answers (2)

jwernerny
jwernerny

Reputation: 7048

I am going to guess you will want to use QMAKE_EXTRA_TARGETS to do the work in your .pro file.

libpara_lib = <...some lib file...>
LIBS += libpara_lib


libpara.target = libpara_lib
libpara.commands = cd libparanoia && make -f Makefile

QT_EXTRA_TARGETS += libpara

Upvotes: 5

rwhenderson
rwhenderson

Reputation: 84

Small correction: it's QMAKE_EXTRA_TARGETS not QT_EXTRA_TARGETS.

As for clean: add a custom clean target to your QMAKE_EXTRA_TARGETS:

libpara_clean.commands = cd libparanoia && make -f Makefile clean

This doesn't add that to the list of CLEAN dependencies; would love to know how to do that.

Upvotes: 2

Related Questions