what, besides the source, would cause an explicit rule to execute to produce a makefile target?

108 Views Asked by At

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' depend on/usr/local/bin/emacs', /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
2

There are 2 best solutions below

2
On BEST ANSWER

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 from makepp -v make me suspect that makepp behaves differently from standard make on this count.

0
On

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 that makepp is seeing that the commands are constructed dynamically and is automatically rebuilding the target. Try using the -m target_newer option to makepp to force it to use the old GNU make method (that is, only re-build if the source is newer than the target).

Link