gpt4 book ai didi

c - make 如何知道要更新哪些文件

转载 作者:太空狗 更新时间:2023-10-29 16:22:30 24 4
gpt4 key购买 nike

我注意到当我对某些文件进行更改然后键入 make 时,它​​会运行与这些文件相关的某些命令。如果我不改变任何东西,那么 make 什么也不做,说程序是最新的。这告诉我 make 有办法知道自上次运行以来哪些文件发生了变化。它怎么知道的?它似乎没有在它运行的目录中放置任何东西,因此它必须将此信息存储在其他地方。

最佳答案

它检查文件系统的修改日期元信息。

例如,参见 stat() man pagestruct statst_mtime 成员。

它有内置规则告诉它(例如)如果相应的 .c 文件已更改,则需要重新生成 .o 文件; manual section on rule syntax说:

The criterion for being out of date is specified in terms of the prerequisites, which consist of file names separated by spaces. (Wildcards and archive members (see Archives) are allowed here too.) A target is out of date if it does not exist or if it is older than any of the prerequisites (by comparison of last-modification times).

关于c - make 如何知道要更新哪些文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1789705/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com