File Coverage

File:config/gen/makefiles.pm
Coverage:100.0%

linestmtbrancondsubcode
1# Copyright (C) 2001-2010, Parrot Foundation.
2
3 - 11
=head1 NAME

config/gen/makefiles.pm - Build various Makefiles

=head1 DESCRIPTION

Generates the various F<Makefile>s and other files needed to build Parrot.

=cut
12
13package gen::makefiles;
14
15
3
3
3
use strict;
16
3
3
3
use warnings;
17
18
19
3
3
3
use base qw(Parrot::Configure::Step);
20
21
3
3
3
use Parrot::Configure::Utils ':gen';
22
23sub _init {
24
3
    my $self = shift;
25
3
    my %data;
26
3
    $data{description} = q{Generate makefiles and other build files};
27
3
    $data{result} = q{};
28
3
    $data{makefiles} = {
29        'Makefile' => {
30            SOURCE => 'config/gen/makefiles/root.in',
31        },
32        'compilers/imcc/Rules.mak' => {
33             SOURCE => 'compilers/imcc/Rules.in',
34        },
35        'src/dynoplibs/Rules.mak' => {
36             SOURCE => 'src/dynoplibs/Rules.in',
37        },
38        'src/dynoplibs/Defines.mak' => {
39             SOURCE => 'src/dynoplibs/Defines.in',
40        },
41
42        'src/dynpmc/Rules.mak' => {
43             SOURCE => 'src/dynpmc/Rules.in',
44        },
45        'src/dynpmc/Defines.mak' => {
46             SOURCE => 'src/dynpmc/Defines.in',
47        },
48        'editor/Makefile' =>
49            { SOURCE => 'config/gen/makefiles/editor.in' },
50
51        'docs/Makefile' => { SOURCE => 'config/gen/makefiles/docs.in' },
52    };
53
3
    return \%data;
54}
55
56sub runstep {
57
2
    my ( $self, $conf ) = @_;
58
59
2
    $self->makefiles($conf);
60
61
2
    $conf->shebang_mod( 'tools/dev/mk_language_shell.in'
62                         => 'tools/dev/mk_language_shell.pl', );
63
64
2
    return 1;
65}
66
67sub makefiles {
68
2
    my ( $self, $conf ) = @_;
69
70
2
    my $targets = $conf->options->get('target');
71
1
    my @targets =
72        defined $targets
73        ? split ' ', $targets
74
2
        : keys %{ $self->{makefiles} };
75
76
2
    foreach my $target (@targets) {
77
9
        my $args = $self->{makefiles}->{$target};
78
9
        my $source = delete $args->{SOURCE};
79
80
9
        $conf->genfile($source => $target, %$args );
81    }
82
2
    return;
83}
84
851;
86
87# Local Variables:
88# mode: cperl
89# cperl-indent-level: 4
90# fill-column: 100
91# End:
92# vim: expandtab shiftwidth=4: