免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2004 | 回复: 3
打印 上一主题 下一主题

how gnu make tells if file's been changed? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-03-19 06:29 |只看该作者 |倒序浏览
Hi, all

I am writing a program to test if the file has been modified recently, and am thinking about how to implement it.

To know if a file has been changed, there has to be a reference to compared. My primitive idea was to check the modified stamp and the accessed stamp of the file, if they were not the same, probabaly the file has been changed. But after some experiments, it was not like what I supposed.

I also thought to keep a copy of the file, so I could compare the time stamps between them, but if the volume of the files were large, that certainly causes some overhead.

As I know, GNU make only compile those source files that have been modified. How does it do to tell if a file's changed or not?

thanks.

论坛徽章:
0
2 [报告]
发表于 2008-03-19 08:37 |只看该作者
应该是将原文件的一些属性(如果最近修改间)记录在一个文件中,之后与它比较吧

论坛徽章:
0
3 [报告]
发表于 2008-03-19 09:13 |只看该作者
假设 a.o 依赖a.c
make只是去看 a.c 的修改时间是否比 a.o 的修改时间新,是的话就需要重新编译,
不需要存上次的修改时间

论坛徽章:
0
4 [报告]
发表于 2008-03-19 09:19 |只看该作者
make只是比较目标和依赖的时间,就一个文件而言没有什么是否修改,因为只有一个更改时间
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP