GNU make manual 翻译( 一百零四)
生活随笔
收集整理的這篇文章主要介紹了
GNU make manual 翻译( 一百零四)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
繼續翻譯
4.7 Rules without Recipes or Prerequisites ==========================================If a rule has no prerequisites or recipe, and the target of the rule is a nonexistent file, then `make' imagines this target to have been updated whenever its rule is run. This implies that all targets depending on this one will always have their recipe run.An example will illustrate this:clean: FORCErm $(objects)FORCE:Here the target `FORCE' satisfies the special conditions, so the target `clean' that depends on it is forced to run its recipe. There is nothing special about the name `FORCE', but that is one name commonly used this way.As you can see, using `FORCE' this way has the same results as using `.PHONY: clean'. Using `.PHONY' is more explicit and more efficient. However, other versions of `make' do not support `.PHONY'; thus `FORCE' appears in many makefiles. *Note Phony Targets::.4.7 沒有片段或前提條件的規則
==========================================
如果一個規則沒有前提條件或者片段,并且此規則的目的是一個尚未存在的文件,那么 make 將認為此目的在任何一次make 運行時都已經被更新。這暗示著每個依賴于此的目的都總是運行其片段。
例子是這樣的:
clean: FORCE
rm $(objects)
FORCE:
這里,目的 FORCE 滿足前面所述的特定的條件,于是依賴此 目的的 目的 clean 被強制執行。這里的名字 FORCE 沒有任何特殊之處,但是是一個通常被使用的名字。
如你所見,采用這種方法用 FORCE 和用 .PHONY: clean 是一樣的效果。
使用 .PHONY 更佳的明確和更有效率,但是其他版本的 make ,有的不支持 .PHONY 語法;因此你會在某些 makefile里面看到 FORCE 出現。 *Note Phony Targets::
后文待續
轉載于:https://www.cnblogs.com/gaojian/archive/2012/09/20/2695334.html
總結
以上是生活随笔為你收集整理的GNU make manual 翻译( 一百零四)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 个人使命宣言
- 下一篇: (转)千万别熬夜:身体器官晚上工作时间表