This file is indexed.

/usr/bin/plmake is in libmakefile-parser-perl 0.215-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/env perl

use strict;
use warnings;

use constant {
    UP_TO_DATE => 1,
    REBUILT    => 2,
};
use Makefile::Parser;
use Getopt::Std;
#use Smart::Comments;

$Makefile::Parser::Runtime = 1;

my $parser;

sub get_rule_by_target ($) {
    $parser->target($_[0]);
}

sub make ($);

sub make ($) {
    my $goal = shift;
    my $rule = get_rule_by_target($goal);
    if (!$rule) {
        if (-f $goal) {
            return UP_TO_DATE;
        } else {
            die "No rule to build target $goal";
        }
    }
    my $out_of_date = !-f $goal;
    for my $prereq ($rule->prereqs) {
        my $res = make($prereq);
        if ($res == REBUILT) {
            $out_of_date = 1;
        } elsif ($res == UP_TO_DATE) {
            if (!$out_of_date) {
                if (-M $prereq < -M $goal) {
                    ### prereq file is newer: $prereq
                    $out_of_date = 1;
                }
            }
        } else {
            die "Unexpected returned value: $res";
        }
    }
    if ($out_of_date) {
        $rule->run_commands;
        return REBUILT;
    }
    return UP_TO_DATE;
}

my %opts;
getopts('f:', \%opts);

my $makefile = $opts{f} || 'Makefile';
$parser = Makefile::Parser->new;
#die $parser->var('TEST_VERBOSE');
my %vars = %ENV;
my @goals;
for my $arg (@ARGV) {
    if ($arg =~ /(.*?)=(.*)/) {
        $vars{$1} = $2;
    } else {
        push @goals, $arg;
    }
}
$parser->parse($makefile, \%vars) or
    die Makefile::Parser->error;
push @goals, $parser->target->name if !@goals;
for my $goal (@goals) {
    my $res = make($goal);
    ### goal: $goal
    ### result: $res
}

__END__

=head1 NAME

plmake - Experimental "make" utility based on Makefile::Parser

=head1 VERSION

This document describes plmake 0.14 released on March 10, 2007.

=head1 SYNOPSIS

    $ plmake
    $ plmake test
    $ plmake -f Makefile all

=head1 DESCRIPTION

This utility mainly serves as a quick check for what does and what does not
work in L<Makefile::Parser>. Please don't use it in production.

=head1 LIMITATIONS

There are quite a lot of limitations in the underlying
L<Makefile::Parser>:

=over

=item *

Directives are not supported.

=item *

Double colon rules don't work

=item *

Multi-target rules are not supported.

=item *

.PHONY is not supported.

=back

=head1 AUTHOR

Zhang "agentzh" Yichun E<lt>agentzh@gmail.comE<gt>

=head1 COPYRIGHT

Copyright (c) 2007 by Zhang "agentzh" Yichun. All rights reserved.

This program is free-software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

L<Makefile::Parser>, L<gvmake>, L<pmake>.