| File: | config/auto/platform.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2001-2011, Parrot Foundation. | ||||
| 2 | |||||
| 3 - 11 | =head1 NAME config/auto/platform.pm - Platform Files =head1 DESCRIPTION Generates a list of platform object files. =cut | ||||
| 12 | |||||
| 13 | package auto::platform; | ||||
| 14 | |||||
| 15 | 2 2 2 | use strict; | |||
| 16 | 2 2 2 | use warnings; | |||
| 17 | |||||
| 18 | 2 2 2 | use base qw(Parrot::Configure::Step); | |||
| 19 | |||||
| 20 | 2 2 2 | use Parrot::Configure::Utils ':auto'; | |||
| 21 | |||||
| 22 | sub _init { | ||||
| 23 | 2 | my $self = shift; | |||
| 24 | 2 | my %data; | |||
| 25 | 2 | $data{description} = q{Generate a list of platform object files}; | |||
| 26 | 2 | $data{result} = q{}; | |||
| 27 | 2 | return \%data; | |||
| 28 | } | ||||
| 29 | |||||
| 30 | sub runstep { | ||||
| 31 | 1 | my ( $self, $conf ) = @_; | |||
| 32 | |||||
| 33 | 1 | $self->_set_implementations($conf); | |||
| 34 | |||||
| 35 | 1 | return 1; | |||
| 36 | } | ||||
| 37 | |||||
| 38 | sub _set_implementations { | ||||
| 39 | 1 | my $self = shift; | |||
| 40 | 1 | my $conf = shift; | |||
| 41 | 1 | my $platform = $conf->data->get('platform'); | |||
| 42 | 1 | my @impls = qw/ | |||
| 43 | io.c | ||||
| 44 | socket.c | ||||
| 45 | file.c | ||||
| 46 | time.c | ||||
| 47 | encoding.c | ||||
| 48 | env.c | ||||
| 49 | dl.c | ||||
| 50 | math.c | ||||
| 51 | itimer.c | ||||
| 52 | exec.c | ||||
| 53 | misc.c | ||||
| 54 | hires_timer.c | ||||
| 55 | sysmem.c | ||||
| 56 | uid.c | ||||
| 57 | error.c | ||||
| 58 | asm.s | ||||
| 59 | entropy.c | ||||
| 60 | /; | ||||
| 61 | 1 | my @impl_files; | |||
| 62 | |||||
| 63 | 1 | for my $im (@impls) { | |||
| 64 | 17 | my $impl_file; | |||
| 65 | |||||
| 66 | 17 | if ( -e "src/platform/$platform/$im" ) { | |||
| 67 | 1 | $impl_file = "src/platform/$platform/$im"; | |||
| 68 | } | ||||
| 69 | elsif ( -e "src/platform/generic/$im" ) { | ||||
| 70 | 15 | $impl_file = "src/platform/generic/$im"; | |||
| 71 | } | ||||
| 72 | else { | ||||
| 73 | 1 | next; | |||
| 74 | } | ||||
| 75 | |||||
| 76 | 16 | $impl_file =~ s/\.[cs]\z/\$(O)/; | |||
| 77 | |||||
| 78 | 16 | push(@impl_files, $impl_file); | |||
| 79 | } | ||||
| 80 | |||||
| 81 | 1 | $conf->data->set(TEMP_platform_o => join(' ', @impl_files)); | |||
| 82 | |||||
| 83 | 1 | return 1; | |||
| 84 | } | ||||
| 85 | |||||
| 86 | 1; | ||||
| 87 | |||||
| 88 | # Local Variables: | ||||
| 89 | # mode: cperl | ||||
| 90 | # cperl-indent-level: 4 | ||||
| 91 | # fill-column: 100 | ||||
| 92 | # End: | ||||
| 93 | # vim: expandtab shiftwidth=4: | ||||