2016-08-26 88 views
2

默認情況下,Make會「觸摸」提供的目標文件以「使其更新」。 爲了避免這種情況,你可以使用this option可以在全球範圍內設定「假設新」嗎?

-W file, --what-if=file, --new-file=file, --assume-new=file 
     Pretend that the target file has just been modified. When used 
     with the -n flag, this shows you what would happen if you were to 
     modify that file. Without -n, it is almost the same as running a 
     touch command on the given file before running make, except that 
     the modification time is changed only in the imagination of make. 

是否有一個相當於在Makefile本身(也許是MAKEFLAGS選項)設置在全球範圍內承擔此選項在Makefile中定義的所有目標?

回答

0

我想這樣的作品:MAKEFLAGS=--assume-new=$(MAKECMDGOALS)

有沒有做這種方式的任何負面的副作用?

+0

請注意,'MAKECMDGOALS'只包含在命令行上提供的目標;你特別要求在Makefile中定義的所有目標。如果你備份了一點,並描述了你實際想要完成的事情,那麼回答你的問題會更簡單。 – MadScientist