My project has top-level directory proj with subdirectories runtime and test. Basically, test depends on runtime, but it’s a little more complicated.
Expected behavior: If you modify a file in runtime, then make runtime, then make test, this should rebuild test.
Actual behavior: For test, you get “make: Nothing to be done for `first’.”
Here are the relevant excerpts from the project files.
proj.pro:
test.depends = runtime
runtime.pro:
TEMPLATE = lib
CONFIG = no_link target_predeps staticlib
TARGET =
# Avoid building libruntime.a
QMAKE_AR_CMD = @true
QMAKE_RANLIB = @true
include(../proj.pri)
RUNTIME_SOURCES += \
foo.c
bar.c
proj.pri:
CLANG_RUNTIME_FLAGS = -emit-llvm
runtime.input = RUNTIME_SOURCES
runtime.output = lib${QMAKE_FILE_IN_BASE}.bc
runtime.commands = $$CLANG $$CLANG_RUNTIME_FLAGS -c ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
QMAKE_EXTRA_COMPILERS += runtime
In runtime‘s Makefile, there is a rule for target compiler_runtime_make_all that seems to correspond to the QMAKE_EXTRA_COMPILERS. The files built by this rule (foo.bc and bar.bc) are in the OBJECTS list, so they get built when you make this Makefile.
In test‘s Makefile, there is also a rule for target compiler_runtime_make_all, but it has no recipe and it’s not referred to anywhere.
So how do I tell test that it should depend on the QMAKE_EXTRA_COMPILERS for runtime?
In the top-level
proj.pro(which I assume isTEMPLATE = subdirs), specifying thattestdepends onruntimeonly affects the order in which the top-levelmakeis run on the specifiedSUBDIRS. It does not introduce any additional dependencies in any of the subdirectories — those are all totally independent invocations ofqmakeandmake.So, to solve this, you’ll need to have
test.proindicate the specificruntimefiles it depends on. See thePOST_TARGETDEPSvariable.Or if you’re using
QMAKE_EXTRA_COMPILERSto build the sources intest.pro, you could add something like this: