Latest update.
This commit is contained in:
@@ -450,7 +450,7 @@ my %targets = (
|
||||
# 32-bit message digests. (For the moment of this writing) HP C
|
||||
# doesn't seem to "digest" too many local variables (they make "him"
|
||||
# chew forever:-). For more details look-up MD32_XARRAY comment in
|
||||
# crypto/sha/sha_lcl.h.
|
||||
# crypto/sha/sha_local.h.
|
||||
# - originally there were 32-bit hpux-parisc2-* targets. They were
|
||||
# scrapped, because a) they were not interchangeable with other 32-bit
|
||||
# targets; b) performance-critical 32-bit assembly modules implement
|
||||
|
||||
+286
-53
@@ -2,37 +2,99 @@
|
||||
|
||||
use File::Basename;
|
||||
|
||||
my $debug_resolvedepends = $ENV{BUILDFILE_DEBUG_DEPENDS};
|
||||
my $debug_rules = $ENV{BUILDFILE_DEBUG_RULES};
|
||||
|
||||
# A cache of objects for which a recipe has already been generated
|
||||
my %cache;
|
||||
|
||||
# resolvedepends and reducedepends work in tandem to make sure
|
||||
# there are no duplicate dependencies and that they are in the
|
||||
# right order. This is especially used to sort the list of
|
||||
# libraries that a build depends on.
|
||||
# collectdepends, expanddepends and reducedepends work together to make
|
||||
# sure there are no duplicate or weak dependencies and that they are in
|
||||
# the right order. This is used to sort the list of libraries that a
|
||||
# build depends on.
|
||||
sub extensionlesslib {
|
||||
my @result = map { $_ =~ /(\.a)?$/; $` } @_;
|
||||
return @result if wantarray;
|
||||
return $result[0];
|
||||
}
|
||||
sub resolvedepends {
|
||||
|
||||
# collectdepends dives into the tree of dependencies and returns
|
||||
# a list of all the non-weak ones.
|
||||
sub collectdepends {
|
||||
return () unless @_;
|
||||
|
||||
my $thing = shift;
|
||||
my $extensionlessthing = extensionlesslib($thing);
|
||||
my @listsofar = @_; # to check if we're looping
|
||||
my @list = @{$unified_info{depends}->{$thing} //
|
||||
$unified_info{depends}->{$extensionlessthing}};
|
||||
my @newlist = ();
|
||||
if (scalar @list) {
|
||||
foreach my $item (@list) {
|
||||
my $extensionlessitem = extensionlesslib($item);
|
||||
# It's time to break off when the dependency list starts looping
|
||||
next if grep { extensionlesslib($_) eq $extensionlessitem } @listsofar;
|
||||
push @newlist, $item, resolvedepends($item, @listsofar, $item);
|
||||
}
|
||||
|
||||
print STDERR "DEBUG[collectdepends] $thing > ", join(' ', @listsofar), "\n"
|
||||
if $debug_resolvedepends;
|
||||
foreach my $item (@list) {
|
||||
my $extensionlessitem = extensionlesslib($item);
|
||||
# It's time to break off when the dependency list starts looping
|
||||
next if grep { extensionlesslib($_) eq $extensionlessitem } @listsofar;
|
||||
# Don't add anything here if the dependency is weak
|
||||
next if defined $unified_info{attributes}->{depends}->{$thing}->{$item}->{'weak'};
|
||||
my @resolved = collectdepends($item, @listsofar, $item);
|
||||
push @newlist, $item, @resolved;
|
||||
}
|
||||
print STDERR "DEBUG[collectdepends] $thing < ", join(' ', @newlist), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@newlist;
|
||||
}
|
||||
|
||||
# expanddepends goes through a list of stuff, checks if they have any
|
||||
# dependencies, and adds them at the end of the current position if
|
||||
# they aren't already present later on.
|
||||
sub expanddepends {
|
||||
my @after = ( @_ );
|
||||
print STDERR "DEBUG[expanddepends]> ", join(' ', @after), "\n"
|
||||
if $debug_resolvedepends;
|
||||
my @before = ();
|
||||
while (@after) {
|
||||
my $item = shift @after;
|
||||
print STDERR "DEBUG[expanddepends]\\ ", join(' ', @before), "\n"
|
||||
if $debug_resolvedepends;
|
||||
print STDERR "DEBUG[expanddepends] - ", $item, "\n"
|
||||
if $debug_resolvedepends;
|
||||
my @middle = (
|
||||
$item,
|
||||
map {
|
||||
my $x = $_;
|
||||
my $extlessx = extensionlesslib($x);
|
||||
if (grep { $extlessx eq extensionlesslib($_) } @before
|
||||
and
|
||||
!grep { $extlessx eq extensionlesslib($_) } @after) {
|
||||
print STDERR "DEBUG[expanddepends] + ", $x, "\n"
|
||||
if $debug_resolvedepends;
|
||||
( $x )
|
||||
} else {
|
||||
print STDERR "DEBUG[expanddepends] ! ", $x, "\n"
|
||||
if $debug_resolvedepends;
|
||||
()
|
||||
}
|
||||
} @{$unified_info{depends}->{$item} // []}
|
||||
);
|
||||
print STDERR "DEBUG[expanddepends] = ", join(' ', @middle), "\n"
|
||||
if $debug_resolvedepends;
|
||||
print STDERR "DEBUG[expanddepends]/ ", join(' ', @after), "\n"
|
||||
if $debug_resolvedepends;
|
||||
push @before, @middle;
|
||||
}
|
||||
print STDERR "DEBUG[expanddepends]< ", join(' ', @before), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@before;
|
||||
}
|
||||
|
||||
# reducedepends looks through a list, and checks if each item is
|
||||
# repeated later on. If it is, the earlier copy is dropped.
|
||||
sub reducedepends {
|
||||
my @list = @_;
|
||||
print STDERR "DEBUG[reducedepends]> ", join(' ', @list), "\n"
|
||||
if $debug_resolvedepends;
|
||||
my @newlist = ();
|
||||
my %replace = ();
|
||||
while (@list) {
|
||||
@@ -49,7 +111,25 @@
|
||||
push @newlist, $item;
|
||||
}
|
||||
}
|
||||
map { $replace{$_} // $_; } @newlist;
|
||||
@newlist = map { $replace{$_} // $_; } @newlist;
|
||||
print STDERR "DEBUG[reducedepends]< ", join(' ', @newlist), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@newlist;
|
||||
}
|
||||
|
||||
# Do it all
|
||||
# This takes multiple inputs and combine them into a single list of
|
||||
# interdependent things. The returned value will include all the input.
|
||||
# Callers are responsible for taking away the things they are building.
|
||||
sub resolvedepends {
|
||||
print STDERR "DEBUG[resolvedepends] START (", join(', ', @_), ")\n"
|
||||
if $debug_resolvedepends;
|
||||
my @all =
|
||||
reducedepends(expanddepends(map { ( $_, collectdepends($_) ) } @_));
|
||||
print STDERR "DEBUG[resolvedepends] END (", join(', ', @_), ") : ",
|
||||
join(',', map { "\n $_" } @all), "\n"
|
||||
if $debug_resolvedepends;
|
||||
@all;
|
||||
}
|
||||
|
||||
# dogenerate is responsible for producing all the recipes that build
|
||||
@@ -91,14 +171,30 @@
|
||||
my $bin = shift;
|
||||
my %opts = @_;
|
||||
if (@{$unified_info{sources}->{$obj}}) {
|
||||
$OUT .= src2obj(obj => $obj,
|
||||
product => $bin,
|
||||
srcs => $unified_info{sources}->{$obj},
|
||||
deps => $unified_info{depends}->{$obj},
|
||||
incs => [ @{$unified_info{includes}->{$obj}},
|
||||
@{$unified_info{includes}->{$bin}} ],
|
||||
defs => [ @{$unified_info{defines}->{$obj}},
|
||||
@{$unified_info{defines}->{$bin}} ],
|
||||
my @srcs = @{$unified_info{sources}->{$obj}};
|
||||
my @deps = @{$unified_info{depends}->{$obj}};
|
||||
my @incs = ( @{$unified_info{includes}->{$obj}},
|
||||
@{$unified_info{includes}->{$bin}} );
|
||||
my @defs = ( @{$unified_info{defines}->{$obj}},
|
||||
@{$unified_info{defines}->{$bin}} );
|
||||
print STDERR "DEBUG[doobj] \@srcs for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @srcs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \@deps for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \@incs for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @incs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \@defs for $obj ($bin) : ",
|
||||
join(",", map { "\n $_" } @defs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[doobj] \%opts for $obj ($bin) : ", ,
|
||||
join(",", map { "\n $_ = $opts{$_}" } sort keys %opts), "\n"
|
||||
if $debug_rules;
|
||||
$OUT .= src2obj(obj => $obj, product => $bin,
|
||||
srcs => [ @srcs ], deps => [ @deps ],
|
||||
incs => [ @incs ], defs => [ @defs ],
|
||||
%opts);
|
||||
foreach ((@{$unified_info{sources}->{$obj}},
|
||||
@{$unified_info{depends}->{$obj}})) {
|
||||
@@ -108,37 +204,152 @@
|
||||
$cache{$obj} = 1;
|
||||
}
|
||||
|
||||
# Helper functions to grab all applicable intermediary files.
|
||||
# This is particularly useful when a library is given as source
|
||||
# rather than a dependency. In that case, we consider it to be a
|
||||
# container with object file references, or possibly references
|
||||
# to further libraries to pilfer in the same way.
|
||||
sub getsrclibs {
|
||||
my $section = shift;
|
||||
|
||||
# For all input, see if it sources static libraries. If it does,
|
||||
# return them together with the result of a recursive call.
|
||||
map { ( $_, getsrclibs($section, $_) ) }
|
||||
grep { $_ =~ m|\.a$| }
|
||||
map { @{$unified_info{$section}->{$_} // []} }
|
||||
@_;
|
||||
}
|
||||
|
||||
sub getlibobjs {
|
||||
my $section = shift;
|
||||
|
||||
# For all input, see if it's an intermediary file (library or object).
|
||||
# If it is, collect the result of a recursive call, or if that returns
|
||||
# an empty list, the element itself. Return the result.
|
||||
map {
|
||||
my @x = getlibobjs($section, @{$unified_info{$section}->{$_}});
|
||||
@x ? @x : ( $_ );
|
||||
}
|
||||
grep { defined $unified_info{$section}->{$_} }
|
||||
@_;
|
||||
}
|
||||
|
||||
# dolib is responsible for building libraries. It will call
|
||||
# obj2shlib is shared libraries are produced, and obj2lib in all
|
||||
# obj2shlib if shared libraries are produced, and obj2lib in all
|
||||
# cases. It also makes sure all object files for the library are
|
||||
# built.
|
||||
sub dolib {
|
||||
my $lib = shift;
|
||||
return "" if $cache{$lib};
|
||||
|
||||
my %attrs = %{$unified_info{attributes}->{libraries}->{$lib}};
|
||||
|
||||
my @deps = ( resolvedepends(getsrclibs('sources', $lib)) );
|
||||
|
||||
# We support two types of objs, those who are specific to this library
|
||||
# (they end up in @objs) and those that we get indirectly, via other
|
||||
# libraries (they end up in @foreign_objs). We get the latter any time
|
||||
# someone has done something like this in build.info:
|
||||
# SOURCE[libfoo.a]=libbar.a
|
||||
# The indirect object files must be kept in a separate array so they
|
||||
# don't get rebuilt unnecessarily (and with incorrect auxiliary
|
||||
# information).
|
||||
#
|
||||
# Object files can't be collected commonly for shared and static
|
||||
# libraries, because we contain their respective object files in
|
||||
# {shared_sources} and {sources}, and because the implications are
|
||||
# slightly different for each library form.
|
||||
#
|
||||
# We grab all these "foreign" object files recursively with getlibobjs().
|
||||
|
||||
unless ($disabled{shared} || $lib =~ /\.a$/) {
|
||||
my $obj2shlib = defined &obj2shlib ? \&obj2shlib : \&libobj2shlib;
|
||||
# If this library sources other static libraries and those
|
||||
# libraries are marked {noinst}, there's no need to include
|
||||
# all of their object files. Instead, we treat those static
|
||||
# libraries as dependents alongside any other library this
|
||||
# one depends on, and let symbol resolution do its job.
|
||||
my @sourced_libs = ();
|
||||
my @objs = ();
|
||||
my @foreign_objs = ();
|
||||
my @deps = ();
|
||||
foreach (@{$unified_info{shared_sources}->{$lib}}) {
|
||||
if ($_ !~ m|\.a$|) {
|
||||
push @objs, $_;
|
||||
} elsif ($unified_info{attributes}->{libraries}->{$_}->{noinst}) {
|
||||
push @deps, $_;
|
||||
} else {
|
||||
push @deps, getsrclibs('sources', $_);
|
||||
push @foreign_objs, getlibobjs('sources', $_);
|
||||
}
|
||||
}
|
||||
@deps = ( grep { $_ ne $lib } resolvedepends($lib, @deps) );
|
||||
print STDERR "DEBUG[dolib:shlib] \%attrs for $lib : ", ,
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if %attrs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:shlib] \@deps for $lib : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if @deps && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:shlib] \@objs for $lib : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if @objs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:shlib] \@foreign_objs for $lib : ",
|
||||
join(",", map { "\n $_" } @foreign_objs), "\n"
|
||||
if @foreign_objs && $debug_rules;
|
||||
$OUT .= $obj2shlib->(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => $unified_info{shared_sources}->{$lib},
|
||||
deps => [ reducedepends(resolvedepends($lib)) ]);
|
||||
foreach ((@{$unified_info{shared_sources}->{$lib}},
|
||||
@{$unified_info{sources}->{$lib}})) {
|
||||
attrs => { %attrs },
|
||||
objs => [ @objs, @foreign_objs ],
|
||||
deps => [ @deps ]);
|
||||
foreach (@objs) {
|
||||
# If this is somehow a compiled object, take care of it that way
|
||||
# Otherwise, it might simply be generated
|
||||
if (defined $unified_info{sources}->{$_}) {
|
||||
doobj($_, $lib, intent => "shlib",
|
||||
attrs => $unified_info{attributes}->{$lib});
|
||||
if($_ =~ /\.a$/) {
|
||||
dolib($_);
|
||||
} else {
|
||||
doobj($_, $lib, intent => "shlib", attrs => { %attrs });
|
||||
}
|
||||
} else {
|
||||
dogenerate($_, undef, undef, intent => "lib");
|
||||
}
|
||||
}
|
||||
}
|
||||
$OUT .= obj2lib(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => [ @{$unified_info{sources}->{$lib}} ]);
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
doobj($_, $lib, intent => "lib",
|
||||
attrs => $unified_info{attributes}->{$lib});
|
||||
{
|
||||
# When putting static libraries together, we cannot rely on any
|
||||
# symbol resolution, so for all static libraries used as source for
|
||||
# this one, as well as other libraries they depend on, we simply
|
||||
# grab all their object files unconditionally,
|
||||
# Symbol resolution will happen when any program, module or shared
|
||||
# library is linked with this one.
|
||||
my @objs = ();
|
||||
my @sourcedeps = ();
|
||||
my @foreign_objs = ();
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
if ($_ !~ m|\.a$|) {
|
||||
push @objs, $_;
|
||||
} else {
|
||||
push @sourcedeps, $_;
|
||||
}
|
||||
}
|
||||
@sourcedeps = ( grep { $_ ne $lib } resolvedepends(@sourcedeps) );
|
||||
print STDERR "DEBUG[dolib:lib] : \@sourcedeps for $_ : ",
|
||||
join(",", map { "\n $_" } @sourcedeps), "\n"
|
||||
if @sourcedeps && $debug_rules;
|
||||
@foreign_objs = getlibobjs('sources', @sourcedeps);
|
||||
print STDERR "DEBUG[dolib:lib] \%attrs for $lib : ", ,
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if %attrs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:lib] \@objs for $lib : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if @objs && $debug_rules;
|
||||
print STDERR "DEBUG[dolib:lib] \@foreign_objs for $lib : ",
|
||||
join(",", map { "\n $_" } @foreign_objs), "\n"
|
||||
if @foreign_objs && $debug_rules;
|
||||
$OUT .= obj2lib(lib => $lib, attrs => { %attrs },
|
||||
objs => [ @objs, @foreign_objs ]);
|
||||
foreach (@objs) {
|
||||
doobj($_, $lib, intent => "lib", attrs => { %attrs });
|
||||
}
|
||||
}
|
||||
$cache{$lib} = 1;
|
||||
}
|
||||
@@ -147,23 +358,35 @@
|
||||
# obj2dso, and also makes sure all object files for the library
|
||||
# are built.
|
||||
sub domodule {
|
||||
my $lib = shift;
|
||||
return "" if $cache{$lib};
|
||||
$OUT .= obj2dso(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => $unified_info{sources}->{$lib},
|
||||
deps => [ resolvedepends($lib) ]);
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
my $module = shift;
|
||||
return "" if $cache{$module};
|
||||
my %attrs = %{$unified_info{attributes}->{modules}->{$module}};
|
||||
my @objs = @{$unified_info{sources}->{$module}};
|
||||
my @deps = ( grep { $_ ne $module }
|
||||
resolvedepends($module) );
|
||||
print STDERR "DEBUG[domodule] \%attrs for $module :",
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[domodule] \@objs for $module : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if $debug_rules;
|
||||
print STDERR "DEBUG[domodule] \@deps for $module : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if $debug_rules;
|
||||
$OUT .= obj2dso(module => $module,
|
||||
attrs => { %attrs },
|
||||
objs => [ @objs ],
|
||||
deps => [ @deps ]);
|
||||
foreach (@{$unified_info{sources}->{$module}}) {
|
||||
# If this is somehow a compiled object, take care of it that way
|
||||
# Otherwise, it might simply be generated
|
||||
if (defined $unified_info{sources}->{$_}) {
|
||||
doobj($_, $lib, intent => "dso",
|
||||
attrs => $unified_info{attributes}->{$lib});
|
||||
doobj($_, $module, intent => "dso", attrs => { %attrs });
|
||||
} else {
|
||||
dogenerate($_, undef, $lib, intent => "dso");
|
||||
dogenerate($_, undef, $module, intent => "dso");
|
||||
}
|
||||
}
|
||||
$cache{$lib} = 1;
|
||||
$cache{$module} = 1;
|
||||
}
|
||||
|
||||
# dobin is responsible for building programs. It will call obj2bin,
|
||||
@@ -171,14 +394,24 @@
|
||||
sub dobin {
|
||||
my $bin = shift;
|
||||
return "" if $cache{$bin};
|
||||
my $deps = [ reducedepends(resolvedepends($bin)) ];
|
||||
my %attrs = %{$unified_info{attributes}->{programs}->{$bin}};
|
||||
my @objs = @{$unified_info{sources}->{$bin}};
|
||||
my @deps = ( grep { $_ ne $bin } resolvedepends($bin) );
|
||||
print STDERR "DEBUG[dobin] \%attrs for $bin : ",
|
||||
join(",", map { "\n $_ = $attrs{$_}" } sort keys %attrs), "\n"
|
||||
if %attrs && $debug_rules;
|
||||
print STDERR "DEBUG[dobin] \@objs for $bin : ",
|
||||
join(",", map { "\n $_" } @objs), "\n"
|
||||
if @objs && $debug_rules;
|
||||
print STDERR "DEBUG[dobin] \@deps for $bin : ",
|
||||
join(",", map { "\n $_" } @deps), "\n"
|
||||
if @deps && $debug_rules;
|
||||
$OUT .= obj2bin(bin => $bin,
|
||||
attrs => $unified_info{attributes}->{$bin},
|
||||
objs => [ @{$unified_info{sources}->{$bin}} ],
|
||||
deps => $deps);
|
||||
foreach (@{$unified_info{sources}->{$bin}}) {
|
||||
doobj($_, $bin, intent => "bin",
|
||||
attrs => $unified_info{attributes}->{$bin});
|
||||
attrs => { %attrs },
|
||||
objs => [ @objs ],
|
||||
deps => [ @deps ]);
|
||||
foreach (@objs) {
|
||||
doobj($_, $bin, intent => "bin", attrs => { %attrs });
|
||||
}
|
||||
$cache{$bin} = 1;
|
||||
}
|
||||
|
||||
@@ -48,26 +48,26 @@
|
||||
@{$unified_info{libraries}};
|
||||
our @install_libs =
|
||||
map { platform->staticname($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}};
|
||||
our @install_shlibs =
|
||||
map { platform->sharedname($_) // () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}};
|
||||
our @install_engines =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}};
|
||||
our @install_programs =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}};
|
||||
our @install_bin_scripts =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}};
|
||||
our @install_misc_scripts =
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}};
|
||||
|
||||
# This is a horrible hack, but is needed because recursive inclusion of files
|
||||
@@ -704,7 +704,7 @@ reconfigure reconf :
|
||||
# On Unix platforms, we depend on {shlibname}.so
|
||||
return map {
|
||||
{ lib => platform->sharedlib($_) // platform->staticlib($_),
|
||||
attrs => $unified_info{attributes}->{$_} }
|
||||
attrs => $unified_info{attributes}->{libraries}->{$_} }
|
||||
} @_;
|
||||
}
|
||||
|
||||
@@ -775,10 +775,14 @@ EOF
|
||||
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
my @modules = ( 'configdata.pm',
|
||||
grep { $_ =~ m|\.pm$| } @{$args{deps}} );
|
||||
my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
|
||||
@modules = map { '"-M'.basename($_, '.pm').'"' } @modules;
|
||||
my $modules = join(' ', '', sort keys %moduleincs, @modules);
|
||||
return <<"EOF";
|
||||
$target : $args{generator}->[0] $deps
|
||||
\$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
|
||||
"-o$target{build_file}" $generator > \$\@
|
||||
\$(PERL)$modules $dofile "-o$target{build_file}" $generator > \$\@
|
||||
EOF
|
||||
} else {
|
||||
return <<"EOF";
|
||||
@@ -1014,8 +1018,8 @@ EOF
|
||||
}
|
||||
sub obj2dso {
|
||||
my %args = @_;
|
||||
my $dsoname = platform->dsoname($args{lib});
|
||||
my $dso = platform->dso($args{lib});
|
||||
my $dsoname = platform->dsoname($args{module});
|
||||
my $dso = platform->dso($args{module});
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { platform->isobj($_) }
|
||||
@{$args{objs}};
|
||||
|
||||
@@ -52,11 +52,13 @@ sub isdef { return $_[1] =~ m|\.ld$|; }
|
||||
sub isobj { return $_[1] =~ m|\.o$|; }
|
||||
sub isres { return $_[1] =~ m|\.res$|; }
|
||||
sub isasm { return $_[1] =~ m|\.[Ss]$|; }
|
||||
sub isstaticlib { return $_[1] =~ m|\.a$|; }
|
||||
sub convertext {
|
||||
if ($_[0]->isdef($_[1])) { return $_[0]->def($_[1]); }
|
||||
if ($_[0]->isobj($_[1])) { return $_[0]->obj($_[1]); }
|
||||
if ($_[0]->isres($_[1])) { return $_[0]->res($_[1]); }
|
||||
if ($_[0]->isasm($_[1])) { return $_[0]->asm($_[1]); }
|
||||
if ($_[0]->isdef($_[1])) { return $_[0]->def($_[1]); }
|
||||
if ($_[0]->isobj($_[1])) { return $_[0]->obj($_[1]); }
|
||||
if ($_[0]->isres($_[1])) { return $_[0]->res($_[1]); }
|
||||
if ($_[0]->isasm($_[1])) { return $_[0]->asm($_[1]); }
|
||||
if ($_[0]->isstaticlib($_[1])) { return $_[0]->staticlib($_[1]); }
|
||||
return $_[1];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ sub objext { '.obj' }
|
||||
sub libext { '.a' }
|
||||
sub dsoext { '.dll' }
|
||||
sub defext { '.def' }
|
||||
|
||||
# Other extra that aren't defined in platform::BASE
|
||||
sub resext { '.res.obj' }
|
||||
sub shlibext { '.dll' }
|
||||
sub shlibextimport { $target{shared_import_extension} || '.dll.a' }
|
||||
sub shlibextsimple { undef }
|
||||
|
||||
@@ -20,6 +20,40 @@
|
||||
|
||||
return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
|
||||
}
|
||||
|
||||
our $COLUMNS = $ENV{COLUMNS};
|
||||
if ($COLUMNS =~ /^\d+$/) {
|
||||
$COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
|
||||
} else {
|
||||
$COLUMNS = 76;
|
||||
}
|
||||
|
||||
sub fill_lines {
|
||||
my $item_sep = shift; # string
|
||||
my $line_length = shift; # number of chars
|
||||
|
||||
my @result = ();
|
||||
my $resultpos = 0;
|
||||
|
||||
foreach (@_) {
|
||||
my $fill_line = $result[$resultpos] // '';
|
||||
my $newline =
|
||||
($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
|
||||
|
||||
if (length($newline) > $line_length) {
|
||||
# If this is a single item and the intended result line
|
||||
# is empty, we put it there anyway
|
||||
if ($fill_line eq '') {
|
||||
$result[$resultpos++] = $newline;
|
||||
} else {
|
||||
$result[++$resultpos] = $_;
|
||||
}
|
||||
} else {
|
||||
$result[$resultpos] = $newline;
|
||||
}
|
||||
}
|
||||
return @result;
|
||||
}
|
||||
'';
|
||||
-}
|
||||
PLATFORM={- $config{target} -}
|
||||
@@ -34,65 +68,99 @@ MINOR={- $config{minor} -}
|
||||
SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
|
||||
SHLIB_TARGET={- $target{shared_target} -}
|
||||
|
||||
LIBS={- join(" ", map { platform->staticlib($_) // () } @{$unified_info{libraries}}) -}
|
||||
SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
|
||||
SHLIB_INFO={- join(" ", map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
@{$unified_info{libraries}}) -}
|
||||
MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -}
|
||||
PROGRAMS={- join(" ", map { platform->bin($_) } @{$unified_info{programs}}) -}
|
||||
SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
|
||||
LIBS={- join(" \\\n" . ' ' x 5,
|
||||
fill_lines(" ", $COLUMNS - 5,
|
||||
map { platform->staticlib($_) // () }
|
||||
@{$unified_info{libraries}})) -}
|
||||
SHLIBS={- join(" \\\n" . ' ' x 7,
|
||||
fill_lines(" ", $COLUMNS - 7,
|
||||
map { platform->sharedlib($_) // () }
|
||||
@{$unified_info{libraries}})) -}
|
||||
SHLIB_INFO={- join(" \\\n" . ' ' x 11,
|
||||
fill_lines(" ", $COLUMNS - 11,
|
||||
map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
@{$unified_info{libraries}})) -}
|
||||
MODULES={- join(" \\\n" . ' ' x 8,
|
||||
fill_lines(" ", $COLUMNS - 8,
|
||||
map { platform->dso($_) }
|
||||
@{$unified_info{modules}})) -}
|
||||
PROGRAMS={- join(" \\\n" . ' ' x 9,
|
||||
fill_lines(" ", $COLUMNS - 9,
|
||||
map { platform->bin($_) }
|
||||
@{$unified_info{programs}})) -}
|
||||
SCRIPTS={- join(" \\\n" . ' ' x 8,
|
||||
fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
|
||||
{- output_off() if $disabled{makedepend}; "" -}
|
||||
DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
|
||||
grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
|
||||
keys %{$unified_info{sources}}); -}
|
||||
DEPS={- join(" \\\n" . ' ' x 5,
|
||||
fill_lines(" ", $COLUMNS - 5,
|
||||
map { platform->isobj($_) ? platform->dep($_) : () }
|
||||
grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
|
||||
keys %{$unified_info{sources}})); -}
|
||||
{- output_on() if $disabled{makedepend}; "" -}
|
||||
GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -}
|
||||
GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
|
||||
fill_lines(" ", $COLUMNS - 20,
|
||||
@{$unified_info{depends}->{""}})) -}
|
||||
GENERATED={- # common0.tmpl provides @generated
|
||||
join(" ", map { platform->convertext($_) } @generated ) -}
|
||||
join(" \\\n" . ' ' x 5,
|
||||
fill_lines(" ", $COLUMNS - 5,
|
||||
map { platform->convertext($_) } @generated )) -}
|
||||
|
||||
INSTALL_LIBS={-
|
||||
join(" ", map { platform->staticlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
join(" \\\n" . ' ' x 13,
|
||||
fill_lines(" ", $COLUMNS - 13,
|
||||
map { platform->staticlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}}))
|
||||
-}
|
||||
INSTALL_SHLIBS={-
|
||||
join(" ", map { platform->sharedlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
join(" \\\n" . ' ' x 15,
|
||||
fill_lines(" ", $COLUMNS - 15,
|
||||
map { platform->sharedlib($_) // () }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}}))
|
||||
-}
|
||||
INSTALL_SHLIB_INFO={-
|
||||
join(" ", map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
join(" \\\n" . ' ' x 19,
|
||||
fill_lines(" ", $COLUMNS - 19,
|
||||
map { my $x = platform->sharedlib($_);
|
||||
my $y = platform->sharedlib_simple($_);
|
||||
$x ? "\"$x;$y\"" : () }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}}))
|
||||
-}
|
||||
INSTALL_ENGINES={-
|
||||
join(" ", map { platform->dso($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
join(" \\\n" . ' ' x 16,
|
||||
fill_lines(" ", $COLUMNS - 16,
|
||||
map { platform->dso($_) }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}}))
|
||||
-}
|
||||
INSTALL_PROGRAMS={-
|
||||
join(" ", map { platform->bin($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}})
|
||||
join(" \\\n" . ' ' x 16,
|
||||
fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}}))
|
||||
-}
|
||||
BIN_SCRIPTS={-
|
||||
join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
join(" \\\n" . ' ' x 12,
|
||||
fill_lines(" ", $COLUMNS - 12,
|
||||
map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}}))
|
||||
-}
|
||||
MISC_SCRIPTS={-
|
||||
join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
join(" \\\n" . ' ' x 13,
|
||||
fill_lines(" ", $COLUMNS - 13,
|
||||
map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
|
||||
$x ? "$_:$x" : $_ }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}}))
|
||||
-}
|
||||
|
||||
APPS_OPENSSL={- use File::Spec::Functions;
|
||||
@@ -729,7 +797,7 @@ generate: generate_apps generate_crypto_bn generate_crypto_objects \
|
||||
|
||||
.PHONY: doc-nits
|
||||
doc-nits: build_generated
|
||||
(cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p -s )
|
||||
(cd $(SRCDIR); $(PERL) util/find-doc-nits -n -e )
|
||||
|
||||
# Test coverage is a good idea for the future
|
||||
#coverage: $(PROGRAMS) $(TESTPROGRAMS)
|
||||
@@ -823,8 +891,10 @@ errors:
|
||||
}
|
||||
"";
|
||||
-}
|
||||
CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
|
||||
SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
|
||||
CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
|
||||
fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
|
||||
SSLHEADERS={- join(" \\\n" . ' ' x 11,
|
||||
fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
|
||||
ordinals:
|
||||
( cd $(SRCDIR); \
|
||||
$(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
|
||||
@@ -918,7 +988,12 @@ openssl.pc:
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: libssl libcrypto' ) > openssl.pc
|
||||
|
||||
configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
|
||||
configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
|
||||
{- join(" \\\n" . ' ' x 15,
|
||||
fill_lines(" ", $COLUMNS - 15,
|
||||
@{$config{build_file_templates}},
|
||||
@{$config{build_infos}},
|
||||
@{$config{conf_files}})) -}
|
||||
@echo "Detected changed: $?"
|
||||
$(PERL) configdata.pm -r
|
||||
@echo "**************************************************"
|
||||
@@ -966,10 +1041,14 @@ EOF
|
||||
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
my @modules = ( 'configdata.pm',
|
||||
grep { $_ =~ m|\.pm$| } @{$args{deps}} );
|
||||
my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
|
||||
@modules = map { "-M".basename($_, '.pm') } @modules;
|
||||
my $modules = join(' ', '', sort keys %moduleincs, @modules);
|
||||
return <<"EOF";
|
||||
$args{src}: $args{generator}->[0] $deps
|
||||
\$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
|
||||
"-o$target{build_file}" $generator > \$@
|
||||
$args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm
|
||||
\$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@
|
||||
EOF
|
||||
} else {
|
||||
return <<"EOF";
|
||||
@@ -1015,7 +1094,7 @@ EOF
|
||||
# last in the line. We may therefore need to put back a line ending.
|
||||
sub src2obj {
|
||||
my %args = @_;
|
||||
my $obj = platform->obj($args{obj});
|
||||
my $obj = platform->convertext($args{obj});
|
||||
my $dep = platform->dep($args{obj});
|
||||
my @srcs = @{$args{srcs}};
|
||||
my $srcs = join(" ", @srcs);
|
||||
@@ -1095,15 +1174,22 @@ EOF
|
||||
sub obj2shlib {
|
||||
my %args = @_;
|
||||
my @linkdirs = ();
|
||||
foreach (@{args{deps}}) {
|
||||
my $d = dirname($_);
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
my @linklibs = ();
|
||||
foreach (@{$args{deps}}) {
|
||||
if (platform->isstaticlib($_)) {
|
||||
push @linklibs, platform->convertext($_);
|
||||
} else {
|
||||
my $d = "-L" . dirname($_);
|
||||
my $l = basename($_);
|
||||
$l =~ s/^lib//;
|
||||
$l = "-l" . $l;
|
||||
push @linklibs, $l;
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
}
|
||||
}
|
||||
my $linkflags = join("", map { "-L$_ " } @linkdirs);
|
||||
my $linklibs = join("", map { my $f = basename($_);
|
||||
(my $l = $f) =~ s/^lib//;
|
||||
" -l$l" } @{$args{deps}});
|
||||
my @objs = map { platform->obj($_) }
|
||||
my $linkflags = join("", map { $_." " } @linkdirs);
|
||||
my $linklibs = join("", map { $_." " } @linklibs);
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { !platform->isdef($_) }
|
||||
@{$args{objs}};
|
||||
my @defs = map { platform->def($_) }
|
||||
@@ -1111,8 +1197,7 @@ EOF
|
||||
@{$args{objs}};
|
||||
my @deps = compute_lib_depends(@{$args{deps}});
|
||||
die "More than one exported symbol map" if scalar @defs > 1;
|
||||
my $objs = join(" ", @objs);
|
||||
my $deps = join(" ", @objs, @defs, @deps);
|
||||
|
||||
my $simple = platform->sharedlib_simple($args{lib});
|
||||
my $full = platform->sharedlib($args{lib});
|
||||
my $shared_soname = "";
|
||||
@@ -1122,6 +1207,12 @@ EOF
|
||||
$shared_imp .= ' '.$target{shared_impflag}.basename($simple)
|
||||
if defined $target{shared_impflag};
|
||||
my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
|
||||
|
||||
my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
|
||||
my $deps = join(" \\\n" . ' ' x (length($full) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($full) - 2,
|
||||
@objs, @defs, @deps));
|
||||
|
||||
my $recipe = <<"EOF";
|
||||
$simple: $full
|
||||
EOF
|
||||
@@ -1139,8 +1230,9 @@ EOF
|
||||
$recipe .= <<"EOF";
|
||||
$full: $deps
|
||||
\$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
|
||||
-o $full$shared_def $objs \\
|
||||
$linklibs \$(LIB_EX_LIBS)
|
||||
-o $full$shared_def \\
|
||||
$objs \\
|
||||
$linklibs \$(LIB_EX_LIBS)
|
||||
EOF
|
||||
if (windowsdll()) {
|
||||
$recipe .= <<"EOF";
|
||||
@@ -1156,38 +1248,52 @@ EOF
|
||||
}
|
||||
sub obj2dso {
|
||||
my %args = @_;
|
||||
my $dso = platform->dso($args{lib});
|
||||
my $dso = platform->dso($args{module});
|
||||
my @linkdirs = ();
|
||||
foreach (@{args{deps}}) {
|
||||
my $d = dirname($_);
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
my @linklibs = ();
|
||||
foreach (@{$args{deps}}) {
|
||||
next unless defined $_;
|
||||
if (platform->isstaticlib($_)) {
|
||||
push @linklibs, platform->convertext($_);
|
||||
} else {
|
||||
my $d = "-L" . dirname($_);
|
||||
my $l = basename($_);
|
||||
$l =~ s/^lib//;
|
||||
$l = "-l" . $l;
|
||||
push @linklibs, $l;
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
}
|
||||
}
|
||||
my $linkflags = join("", map { "-L$_ " } @linkdirs);
|
||||
my $linklibs = join("", map { my $f = basename($_);
|
||||
(my $l = $f) =~ s/^lib//;
|
||||
" -l$l" } @{$args{deps}});
|
||||
my @objs = map { platform->obj($_) }
|
||||
my $linkflags = join("", map { $_." " } @linkdirs);
|
||||
my $linklibs = join("", map { $_." " } @linklibs);
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { !platform->isdef($_) }
|
||||
@{$args{objs}};
|
||||
my @defs = map { platform->def($_) }
|
||||
grep { platform->isdef($_) }
|
||||
@{$args{objs}};
|
||||
my @deps = compute_lib_depends(@{$args{deps}});
|
||||
my $objs = join(" ", @objs);
|
||||
my $deps = join(" ", @objs, @defs, @deps);
|
||||
my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
|
||||
|
||||
my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
|
||||
my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($dso) - 2,
|
||||
@objs, @defs, @deps));
|
||||
|
||||
return <<"EOF";
|
||||
$dso: $deps
|
||||
\$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
|
||||
-o $dso$shared_def $objs \\
|
||||
$linklibs \$(DSO_EX_LIBS)
|
||||
-o $dso$shared_def \\
|
||||
$objs \\
|
||||
$linklibs\$(DSO_EX_LIBS)
|
||||
EOF
|
||||
}
|
||||
sub obj2lib {
|
||||
my %args = @_;
|
||||
my $lib = platform->staticlib($args{lib});
|
||||
my @objs = map { platform->obj($_) } @{$args{objs}};
|
||||
my $objs = join(" ", @objs);
|
||||
my $objs = join(" \\\n" . ' ' x (length($lib) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
|
||||
return <<"EOF";
|
||||
$lib: $objs
|
||||
\$(AR) \$(ARFLAGS) \$\@ \$\?
|
||||
@@ -1197,35 +1303,46 @@ EOF
|
||||
sub obj2bin {
|
||||
my %args = @_;
|
||||
my $bin = platform->bin($args{bin});
|
||||
my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
|
||||
my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
|
||||
my @objs = map { platform->obj($_) } @{$args{objs}};
|
||||
my @deps = compute_lib_depends(@{$args{deps}});
|
||||
my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
|
||||
my @linkdirs = ();
|
||||
foreach (@{args{deps}}) {
|
||||
next if $_ =~ /\.a$/;
|
||||
my $d = dirname($_);
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
my @linklibs = ();
|
||||
foreach (@{$args{deps}}) {
|
||||
next unless defined $_;
|
||||
if (platform->isstaticlib($_)) {
|
||||
push @linklibs, platform->convertext($_);
|
||||
} else {
|
||||
my $d = "-L" . dirname($_);
|
||||
my $l = basename($_);
|
||||
$l =~ s/^lib//;
|
||||
$l = "-l" . $l;
|
||||
push @linklibs, $l;
|
||||
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
|
||||
}
|
||||
}
|
||||
my $linkflags = join("", map { "-L$_ " } @linkdirs);
|
||||
my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
|
||||
" ".platform->staticlib($_);
|
||||
} else {
|
||||
my $f = basename($_);
|
||||
(my $l = $f) =~ s/^lib//;
|
||||
" -l$l"
|
||||
}
|
||||
} @{$args{deps}});
|
||||
my $linkflags = join("", map { $_." " } @linkdirs);
|
||||
my $linklibs = join("", map { $_." " } @linklibs);
|
||||
my $cmd = '$(CC)';
|
||||
my $cmdflags = '$(BIN_CFLAGS)';
|
||||
if (grep /_cc\.o$/, @{$args{objs}}) {
|
||||
$cmd = '$(CXX)';
|
||||
$cmdflags = '$(BIN_CXXFLAGS)';
|
||||
}
|
||||
|
||||
my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
|
||||
my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
|
||||
fill_lines(' ', $COLUMNS - length($bin) - 2,
|
||||
@objs, @deps));
|
||||
|
||||
return <<"EOF";
|
||||
$bin: $objs $deps
|
||||
$bin: $deps
|
||||
rm -f $bin
|
||||
\$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
|
||||
-o $bin $objs \\
|
||||
$linklibs \$(BIN_EX_LIBS)
|
||||
-o $bin \\
|
||||
$objs \\
|
||||
$linklibs\$(BIN_EX_LIBS)
|
||||
EOF
|
||||
}
|
||||
sub in2script {
|
||||
@@ -1246,7 +1363,7 @@ EOF
|
||||
my %args = @_;
|
||||
my $dir = $args{dir};
|
||||
my @deps = map { platform->convertext($_) } @{$args{deps}};
|
||||
my @actions = ();
|
||||
my @comments = ();
|
||||
my %extinfo = ( dso => platform->dsoext(),
|
||||
lib => platform->libext(),
|
||||
bin => platform->binext() );
|
||||
@@ -1266,16 +1383,19 @@ EOF
|
||||
if (dirname($prod) eq $dir) {
|
||||
push @deps, $prod.$extinfo{$type};
|
||||
} else {
|
||||
push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
|
||||
push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $deps = join(" ", @deps);
|
||||
my $actions = join("\n", "", @actions);
|
||||
my $target = "$dir $dir/";
|
||||
my $deps = join(" \\\n\t",
|
||||
fill_lines(' ', $COLUMNS - 8, @deps));
|
||||
my $comments = join("\n", "", @comments);
|
||||
return <<"EOF";
|
||||
$dir $dir/: $deps$actions
|
||||
$target: \\
|
||||
$deps$comments
|
||||
EOF
|
||||
}
|
||||
"" # Important! This becomes part of the template result.
|
||||
|
||||
@@ -62,53 +62,53 @@ GENERATED={- # common0.tmpl provides @generated
|
||||
INSTALL_LIBS={-
|
||||
join(" ", map { quotify1(platform->sharedlib_import($_)
|
||||
// platform->staticlib($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
-}
|
||||
INSTALL_SHLIBS={-
|
||||
join(" ", map { my $x = platform->sharedlib($_);
|
||||
$x ? quotify_l($x) : () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
-}
|
||||
INSTALL_SHLIBPDBS={-
|
||||
join(" ", map { my $x = platform->sharedlibpdb($_);
|
||||
$x ? quotify_l($x) : () }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
|
||||
@{$unified_info{libraries}})
|
||||
-}
|
||||
INSTALL_ENGINES={-
|
||||
join(" ", map { quotify1(platform->dso($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_ENGINEPDBS={-
|
||||
join(" ", map { quotify1(platform->dsopdb($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{engine} }
|
||||
grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{modules}->{$_}->{engine} }
|
||||
@{$unified_info{modules}})
|
||||
-}
|
||||
INSTALL_PROGRAMS={-
|
||||
join(" ", map { quotify1(platform->bin($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}})
|
||||
-}
|
||||
INSTALL_PROGRAMPDBS={-
|
||||
join(" ", map { quotify1(platform->binpdb($_)) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst} }
|
||||
grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
|
||||
@{$unified_info{programs}})
|
||||
-}
|
||||
BIN_SCRIPTS={-
|
||||
join(" ", map { quotify1($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& !$unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
-}
|
||||
MISC_SCRIPTS={-
|
||||
join(" ", map { quotify1($_) }
|
||||
grep { !$unified_info{attributes}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{$_}->{misc} }
|
||||
grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
|
||||
&& $unified_info{attributes}->{scripts}->{$_}->{misc} }
|
||||
@{$unified_info{scripts}})
|
||||
-}
|
||||
|
||||
@@ -558,10 +558,14 @@ EOF
|
||||
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
|
||||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
my @modules = ( 'configdata.pm',
|
||||
grep { $_ =~ m|\.pm$| } @{$args{deps}} );
|
||||
my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
|
||||
@modules = map { "-M".basename($_, '.pm') } @modules;
|
||||
my $modules = join(' ', '', sort keys %moduleincs, @modules);
|
||||
return <<"EOF";
|
||||
$target: "$args{generator}->[0]" $deps
|
||||
"\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
|
||||
"-o$target{build_file}" $generator > \$@
|
||||
"\$(PERL)"$modules "$dofile" "-o$target{build_file}" $generator > \$@
|
||||
EOF
|
||||
} else {
|
||||
return <<"EOF";
|
||||
@@ -714,8 +718,8 @@ EOF
|
||||
}
|
||||
sub obj2dso {
|
||||
my %args = @_;
|
||||
my $dso = platform->dso($args{lib});
|
||||
my $dso_n = platform->dsoname($args{lib});
|
||||
my $dso = platform->dso($args{module});
|
||||
my $dso_n = platform->dsoname($args{module});
|
||||
my @objs = map { platform->convertext($_) }
|
||||
grep { platform->isobj($_) || platform->isres($_) }
|
||||
@{$args{objs}};
|
||||
|
||||
Reference in New Issue
Block a user