我有一種情況,我重構了一些代碼,並移動了一個包含文件。make:依賴項丟失時無效的目標文件
試圖構建源樹產生一個錯誤:
make: *** No rule to make target `cmd/dispatcher.h', \
needed by `/tmp/test/dispatcher/main.o'. Stop.
如果我做了make clean
(刪除過時的main.o
文件),然後重建我得到一個不同的錯誤:
...src/test/dispatcher/main.cpp:3:28: fatal error: cmd/dispatcher.h: \
No such file or directory
問題:
有什麼辦法可以使無效10當其中一個依賴關係丟失?
我不這麼認爲。但是你可以告訴makefile始終在這樣的情況下進行構建 - 使用標誌使 – 2014-09-23 07:38:19
構建中不再需要'main.o'? – Beta 2014-09-23 11:24:53
@SagarSakre我想避免這種情況 - 讓'main.o'實現依賴''cmd/dispatcher.h'丟失會導致'main.cpp'重建而不重建世界其他地方 – 2014-09-23 23:20:33