除了源之外,什么会导致执行显式规则以生成 makefile 目标?
从这两个 ls 可以明显看出目标比源更新 comands:
[metaperl@andLinux ~/edan/pkg/gist.el] ls -l ../../wares/gist.el/gist.elc #target
-rw-r--r-- 1 metaperl metaperl 10465 Jul 18 10:56 ../../wares/gist.el/gist.elc
[metaperl@andLinux ~/edan/pkg/gist.el] ls -l yank/gist.el/gist.el #source
-rw-r--r-- 1 metaperl metaperl 13025 Jul 18 10:57 yank/gist.el/gist.el
[metaperl@andLinux ~/edan/pkg/gist.el]
但是,当我运行 makepp -v 时,我被告知该规则不仅取决于 在列出的目标上,还可以在 cd 和 mv 命令上。
makepplog:目标 /home/metaperl/edan/wares/gist.el/gist.elc' 依赖于/usr/local/bin/emacs', /home/metaperl/edan/pkg/gist.el/yank/gist.el/gist.el', /bin/mv'
make 逻辑的哪个方面规定了生成 目标是决定是否进行的依赖链的一部分 目标?
在我看来,只有列出的来源才会影响是否 目标已重建。
整个 makepp -v 输出相当长,位于: http://gist.github.com/480468
我的 makepp 文件:
include main.makepp
#VER
PKG := gist.el
URL := http://github.com/defunkt/$(PKG).git
TARGET := $(WARES)gist.el/gist.elc
$(TARGET) : yank/gist.el/gist.el
cd $(dir $(input)) && $(BYTECOMPILE) gist.el
mv $(dir $(input)) $(WARES)
perl {{
print 'github username: ';
my $username = <STDIN>;
print 'github API token: ';
my $api_token = <STDIN>;
system "git config --global github.user $username";
system "git config --global github.token $api_token";
use File::Butler;
my $lines = Butler('init.el', 'read');
my $loc = sprintf '%s%s', $EDAN_PKG, "$PKG/";
$lines =~ s/__LOC__/$loc/g;
$lines =~ s/__PKG__/$PKG/g;
Butler( $EDAN_EL, prepend => \$lines );
}}
yank/gist.el/gist.el : yank
cd yank && git clone http://github.com/defunkt/gist.el.git
yank:
mkdir yank
$(phony clean):
$(RM) -rf $(dir $(TARGET)) yank
It is clear that the target is newer than the source from these two ls
comands:
[metaperl@andLinux ~/edan/pkg/gist.el] ls -l ../../wares/gist.el/gist.elc #target
-rw-r--r-- 1 metaperl metaperl 10465 Jul 18 10:56 ../../wares/gist.el/gist.elc
[metaperl@andLinux ~/edan/pkg/gist.el] ls -l yank/gist.el/gist.el #source
-rw-r--r-- 1 metaperl metaperl 13025 Jul 18 10:57 yank/gist.el/gist.el
[metaperl@andLinux ~/edan/pkg/gist.el]
However when I run makepp -v
I am told that this rule depends not only
on the listed target, but also on the cd and mv commands.
makepplog: Targets
/home/metaperl/edan/wares/gist.el/gist.elc'
/usr/local/bin/emacs',
depend on/home/metaperl/edan/pkg/gist.el/yank/gist.el/gist.el',
/bin/mv'
What aspect of make logic dictates that the actions to produce the
target are part of the dependency chain of deciding on whether to make
the target?
To my mind, only the listed sources should affect whether or not the
target is rebuilt.
The entire makepp -v
output is quite long, and exists at:
http://gist.github.com/480468
My makepp file:
include main.makepp
#VER
PKG := gist.el
URL := http://github.com/defunkt/$(PKG).git
TARGET := $(WARES)gist.el/gist.elc
$(TARGET) : yank/gist.el/gist.el
cd $(dir $(input)) && $(BYTECOMPILE) gist.el
mv $(dir $(input)) $(WARES)
perl {{
print 'github username: ';
my $username = <STDIN>;
print 'github API token: ';
my $api_token = <STDIN>;
system "git config --global github.user $username";
system "git config --global github.token $api_token";
use File::Butler;
my $lines = Butler('init.el', 'read');
my $loc = sprintf '%s%s', $EDAN_PKG, "$PKG/";
$lines =~ s/__LOC__/$loc/g;
$lines =~ s/__PKG__/$PKG/g;
Butler( $EDAN_EL, prepend => \$lines );
}}
yank/gist.el/gist.el : yank
cd yank && git clone http://github.com/defunkt/gist.el.git
yank:
mkdir yank
$(phony clean):
$(RM) -rf $(dir $(TARGET)) yank
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用标准 make,在决定是否重建目标时不会考虑创建目标的命令内容。只考虑依赖关系;如果您在其他地方声明了依赖项,这可能会超出源代码。
你没有显示你的 makeppfile,所以我不能确定,但是
Parsing command
... 来自makepp -v
的消息让我怀疑 makepp 的行为与就此而言,标准制造。With a standard make, the contents of the commands to make a target are not taken into account when deciding whether to rebuild the target. Only the dependencies are taken into account; this can go beyond the source if you have dependencies declared elsewhere.
You don't show your makeppfile, so I can't be sure, but the
Parsing command
... messages frommakepp -v
make me suspect that makepp behaves differently from standard make on this count.如果任何依赖项发生更改或命令发生更改,
makepp
将重建目标。在您的情况下,我怀疑您在规则中使用的一些变量来生成$(TARGET)
已更改,或者makepp
看到命令已构造动态地并自动重建目标。尝试使用makepp
的-m target_newer
选项来强制它使用旧的 GNUmake
方法(即,仅在以下情况下重新构建)源比目标新)。链接
makepp
will rebuild a target if any of the dependencies have changed or if the command has changes. In your case, I suspect that either some of the variables that you use in the rule to make$(TARGET)
have changed or thatmakepp
is seeing that the commands are constructed dynamically and is automatically rebuilding the target. Try using the-m target_newer
option tomakepp
to force it to use the old GNUmake
method (that is, only re-build if the source is newer than the target).Link