Make的隱式規則

2021-10-02 23:50:08 字數 368 閱讀 1626

隱式規則1:當依賴出現重名時,make將所有的依賴整合,形成最後的依賴。2:當目標中的命令出現重複時,make將發出警告,使用後來的命令執行結果來替換前面的命令執行結果,因此在makefile中使用include時應避免在include所包含的檔案中使用命令。

隱式規則2:make會提供一些自定義的變數,例如:(cc

),

(cc),

(cc)

,(rm ) 可以使用『echo 『.varibles』』來檢視定義了哪些變數。

實際工程中盡量不使用隱式規則,可以使用make -p | grep "***"來查詢對應的隱式規則。

如何禁用引用規則:1.區域性禁用: 可以自定義規則%.o:%.p 2.全域性禁用:make -r

第15課 make 的隱式規則(上)

mekefile 現同名目標時 eg all echo the one all all echo the two all all echo the three all 執行結果 什麼是隱式規則?示例 思考下面的makefile檔案是否可以執行 main.c includevoid func int ...

makefile 隱式規則

phony all all a.txt all b.txt a.txt echo this is b.txt echo this is 複製 示例2 makefile 現同名命令 phony all all echo command 1 all echo command 2 all echo thi...

makefile的隱式規則

target exe source code hello.c objs source code c o target objs gcc o clean rm target objs 一上來直接展示乙份makefile 功能 從功能角度來說,這份makefile 可以編譯出對應的目標檔案,並且順利執行...