2017-05-10 25 views
0

我的項目的Makefile包含另一個我們不想進行本地修改的makefile。前綴繼承的Makefile目標

從中我們繼承了一個名爲test的目標。 我該如何編輯我自己的Makefile,以確保自定義命令得到運行之前繼承了make test目標?

我現在通過定義一個新的itest目標來解決這個問題,但我寧願只能撥打make test

include: other-project/rules.mk 

.PHONY: itest 
itest: 
    <my-command> $(MAKE) test 

回答

1

只需添加一個先決條件:

include: other-project/rules.mk 

test: itest 

.PHONY: itest 
itest: 
    <my-command>