line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# App::hopen::T::Gnu::C::CompileCmd - compile C source using the GNU toolset |
2
|
|
|
|
|
|
|
package App::hopen::T::Gnu::C::CompileCmd; |
3
|
1
|
|
|
1
|
|
7
|
use Data::Hopen; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
4
|
1
|
|
|
1
|
|
15
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
6
|
use Data::Hopen::Base; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000013'; # TRIAL |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1316
|
use parent 'App::hopen::G::OutputPerFileCmd'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
48
|
use Class::Tiny qw(compiler); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
202
|
use App::hopen::Asset; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
13
|
1
|
|
|
1
|
|
6
|
use App::hopen::BuildSystemGlobals; # For $DestDir. |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
107
|
|
14
|
|
|
|
|
|
|
# TODO make the dirs available to nodes through the context. |
15
|
1
|
|
|
1
|
|
7
|
use App::hopen::Util::BasedPath; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
63
|
|
16
|
1
|
|
|
1
|
|
6
|
use Data::Hopen qw(getparameters); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
43
|
|
17
|
1
|
|
|
1
|
|
536
|
use Data::Hopen::Util::Filename; |
|
1
|
|
|
|
|
3897
|
|
|
1
|
|
|
|
|
64
|
|
18
|
1
|
|
|
1
|
|
7
|
use Path::Class; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
273
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $_FN = Data::Hopen::Util::Filename->new; # for brevity |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Docs {{{1 |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
App::hopen::T::Gnu::C::CompileCmd - compile C source using the GNU toolset |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
In a hopen file: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $cmd = App::hopen::T::Gnu::C::CompileCmd->new( |
33
|
|
|
|
|
|
|
compiler => '/usr/bin/gcc', |
34
|
|
|
|
|
|
|
name => 'compilation command' # optional |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The inputs come from earlier in the build graph. |
38
|
|
|
|
|
|
|
TODO support specifying compiler arguments. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 compiler |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The compiler to use. TODO is this a full path or just a name? |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 MEMBER FUNCTIONS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# }}}1 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 _process_input |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Create the compile command line for a given asset. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _process_input { |
59
|
3
|
|
|
3
|
|
83
|
my ($self, %args) = getparameters('self', [qw(asset visitor ; *)], @_); |
60
|
3
|
|
|
|
|
261
|
my $src = $args{asset}; |
61
|
|
|
|
|
|
|
|
62
|
3
|
50
|
|
|
|
16
|
die "Cannot compile non-file $src" unless $src->isdisk; |
63
|
|
|
|
|
|
|
|
64
|
3
|
|
|
|
|
13
|
my $to = based_path(path => file($_FN->obj($src->target->path)), |
65
|
|
|
|
|
|
|
base => $DestDir); |
66
|
3
|
|
|
|
|
681
|
my $how = $self->compiler . " -c #first -o #out"; |
67
|
3
|
|
|
|
|
32
|
my $obj = App::hopen::Asset->new( |
68
|
|
|
|
|
|
|
target => $to, |
69
|
|
|
|
|
|
|
made_by => $self, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
3
|
|
|
|
|
44
|
return [$obj, $how]; |
73
|
|
|
|
|
|
|
} #_process_input() |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 _should_act |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns truthy if L</_process_input> should be called. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _should_act { |
82
|
3
|
|
|
3
|
|
88
|
my ($self, %args) = getparameters('self', [qw(visitor ; *)], @_); |
83
|
3
|
|
|
|
|
203
|
return ($Phase eq 'Gen'); |
84
|
|
|
|
|
|
|
} #_should_act() |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
# vi: set fdm=marker: # |