我的項目的頂級目錄proj
與子目錄runtime
和test
。基本上,test
取決於runtime
,但它有點複雜。如何使一個目標取決於另一個目標的QMAKE_EXTRA_COMPILERS
預期的行爲:如果您在runtime
修改一個文件,然後進行runtime
,然後進行test
,這應該重建test
。
實際行爲:對於test
,您將得到「make:無法爲'first'完成」。
下面是項目文件的相關摘錄。
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
在runtime
的Makefile,存在用於目標compiler_runtime_make_all
規則這似乎對應於QMAKE_EXTRA_COMPILERS
。這個規則生成的文件(foo.bc和bar.bc)位於OBJECTS
列表中,因此當您創建該Makefile時,它們就會生成。
在test
的Makefile中,還有一個針對目標compiler_runtime_make_all
的規則,但它沒有配方,並且它沒有被引用到任何地方。
那麼我該如何告訴test
它應該取決於QMAKE_EXTRA_COMPILERS
的runtime
?