【问题标题】:Can Make "assume-new" globally?可以在全球范围内“假设新”吗?
【发布时间】:2017-01-03 15:04:12
【问题描述】:

默认情况下,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 中定义的所有目标全局假定此选项?

【问题讨论】:

    标签: unix makefile gnu-make


    【解决方案1】:

    我认为这可行:MAKEFLAGS=--assume-new=$(MAKECMDGOALS)

    这样做有什么负面影响吗?

    【讨论】:

    • 注意MAKECMDGOALS只包含命令行提供的目标;您特别要求 Makefile 中定义的所有目标。如果您稍作备份并描述了您真正想要完成的工作,那么回答您的问题会更简单。
    猜你喜欢
    • 2016-01-03
    • 1970-01-01
    • 2022-01-20
    • 1970-01-01
    • 1970-01-01
    • 2021-11-23
    • 1970-01-01
    • 2015-12-09
    • 1970-01-01
    相关资源
    最近更新 更多