| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# App::hopen::T::Gnu::C::CompileCmd - compile C source using the GNU toolset |
|
2
|
|
|
|
|
|
|
# TODO RESUME HERE - put .o files in the dest dir |
|
3
|
|
|
|
|
|
|
package App::hopen::T::Gnu::C::CompileCmd; |
|
4
|
1
|
|
|
1
|
|
7
|
use Data::Hopen; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
60
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Data::Hopen::Base; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.000011'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1301
|
use parent 'App::hopen::G::Cmd'; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
5
|
|
|
11
|
1
|
|
|
1
|
|
69
|
use Class::Tiny qw(compiler); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
211
|
use App::hopen::BuildSystemGlobals; # For $DestDir. |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
102
|
|
|
14
|
|
|
|
|
|
|
# TODO make the dirs available to nodes through the context. |
|
15
|
1
|
|
|
1
|
|
6
|
use App::hopen::Util::BasedPath; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
44
|
|
|
16
|
|
|
|
|
|
|
#use Config; |
|
17
|
1
|
|
|
1
|
|
6
|
use Data::Hopen qw(getparameters); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
|
|
#use Data::Hopen::G::GraphBuilder; |
|
19
|
|
|
|
|
|
|
#use Data::Hopen::Util::Data qw(forward_opts); |
|
20
|
1
|
|
|
1
|
|
475
|
use Data::Hopen::Util::Filename; |
|
|
1
|
|
|
|
|
2224
|
|
|
|
1
|
|
|
|
|
45
|
|
|
21
|
|
|
|
|
|
|
#use Deep::Hash::Utils qw(deepvalue); |
|
22
|
|
|
|
|
|
|
#use File::Which (); |
|
23
|
1
|
|
|
1
|
|
12
|
use Path::Class; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
331
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $_FN = Data::Hopen::Util::Filename->new; # for brevity |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Docs {{{1 |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
App::hopen::T::Gnu::C::CompileCmd - compile C source using the GNU toolset |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
In a hopen file: |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $cmd = App::hopen::T::Gnu::C::CompileCmd->new( |
|
38
|
|
|
|
|
|
|
compiler => '/usr/bin/gcc', |
|
39
|
|
|
|
|
|
|
name => 'compilation command' # optional |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
The inputs come from earlier in the build graph. |
|
43
|
|
|
|
|
|
|
TODO support specifying compiler arguments. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 compiler |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
The compiler to use. TODO is this a full path or just a name? |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 MEMBER FUNCTIONS |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# }}}1 |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 _run |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Create the compile command line. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _run { |
|
64
|
2
|
|
|
2
|
|
688
|
my ($self, %args) = getparameters('self', [qw(phase visitor ; *)], @_); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Currently we only do things at gen time. |
|
67
|
2
|
50
|
|
|
|
195
|
return $self->passthrough(-nocontext=>1) if $args{phase} ne 'Gen'; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Pull the inputs |
|
70
|
2
|
|
|
|
|
16
|
my $lrSourceFiles = $self->input_assets; |
|
71
|
2
|
|
|
0
|
|
15
|
hlog { 'found source files', Dumper($lrSourceFiles) } 2; |
|
|
0
|
|
|
|
|
0
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
18
|
my @objFiles; |
|
74
|
2
|
|
|
|
|
8
|
foreach my $src (@$lrSourceFiles) { |
|
75
|
2
|
50
|
|
|
|
19
|
die "Cannot compile non-file $src" unless $src->isdisk; |
|
76
|
|
|
|
|
|
|
|
|
77
|
2
|
|
|
|
|
14
|
my $to = based_path(path => file($_FN->obj($src->target->path)), |
|
78
|
|
|
|
|
|
|
base => $DestDir); |
|
79
|
2
|
|
|
|
|
477
|
my $how = $self->compiler . " -c #first -o #out"; |
|
80
|
2
|
|
|
|
|
27
|
my $obj = App::hopen::Asset->new( |
|
81
|
|
|
|
|
|
|
target => $to, |
|
82
|
|
|
|
|
|
|
made_by => $self, |
|
83
|
|
|
|
|
|
|
); |
|
84
|
2
|
|
|
|
|
27
|
push @objFiles, $obj; |
|
85
|
|
|
|
|
|
|
|
|
86
|
2
|
|
|
|
|
15
|
$args{visitor}->asset($obj, -how => $how); |
|
87
|
2
|
|
|
|
|
42
|
$args{visitor}->connect($src, $obj); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
2
|
|
|
|
|
7035
|
$self->make(\@objFiles); |
|
90
|
2
|
|
|
|
|
8
|
return {}; |
|
91
|
|
|
|
|
|
|
} #_run() |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
__END__ |
|
95
|
|
|
|
|
|
|
# vi: set fdm=marker: # |