我发现在erl -make
以下的情况下不会编译文件。
a.erl
a.erl
a.erl
a.erl
未编译然后我在OS X上测试了它,a.erl
编译成功。
在上述两种情况下,唯一的区别是当我使用cp
命令复制文件时OS X中的“上次修改时间”发生了更改,而在没有命令的情况下在Windows中没有更改。
答案 0 :(得分:2)
听起来你已经弄清楚了:当源文件比编译文件更新时会触发重新编译。您的Windows shell保留了修改时间,因此我们不会重新编译。 Mac OS终端shell(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下,他们也会更新恢复文件的修改时间。