首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >` `erl -make`是如何工作的?

` `erl -make`是如何工作的?
EN

Stack Overflow用户
提问于 2013-08-21 04:10:24
回答 1查看 344关注 0票数 1

我发现在下面使用erl -make的情况下不会编译文件。

  1. 编译文件a.erl
  2. 从其他目录复制旧版本的a.erl
  3. 编译文件a.erl
  4. a.erl未编译

然后我在OS上进行了测试,成功地编译了a.erl

在上述两种情况下,唯一的区别是在使用cp命令复制文件时更改了OS中的“最后修改时间”,而在没有命令的情况下没有更改。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-21 20:45:02

听起来您已经知道了:当源文件比编译文件更新时,就会触发重新编译。您的Windows保留了修改时间,因此我们不会重新编译。Mac终端外壳(bash)更新修改时间,因此旧文件看起来是新的。

以下是make(3)手册页的相关部分:

Traversing the set of modules, it then recompiles every module for which at least one of the following conditions apply: \* there is no object file, or \* the source file has been modified since it was last com- piled, or, \* an include file has been modified since the source file was last compiled. As a side effect, the function prints the name of each module it tries to compile. If compilation fails for a module, the make procedure stops and error is returned.

在Windows下,最好的选择是在要强制重新编译时删除已编译的模块。您也可能有更好的时间使用一些源代码管理(SVN,Git等)。我相信即使在Windows环境下,他们也会更新恢复文件的修改时间。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18348724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档