eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # $Id$ # # Provides size breakdown of libACE.a or libTAO. # # Assumes (or builds) the lib with debug=0. Allows other make args, # such as -j 4, to be passed on the command line. $usage="$0 [-h, for html output] [-v] [make arguments]\n"; #### #### Configuration parameters. #### $build_args = 'debug=0 optimize=1 static_libs_only=1 DEFFLAGS=-DACE_USE_RCSID=0'; $ACE_COMPONENTS = 'OS Utils Logging Threads Demux Connection Sockets IPC Svcconf ' . 'Streams Memory Token Other'; $TAO_COMPONENTS = 'POA Pluggable_Protocols Default_Resources Interpretive_Marshaling ' . 'IDL_Compiler ORB_Core Dynamic_Any'; #### The following are only used for VxWorks libraries, and #### only if the corresponding environment variable isn't set. $default_toolenv = '386'; $default_wind_base = '/project/doc/pkg/wind'; $default_host_type = 'sun4-solaris2'; #### Use gmake if it's on the user's PATH, otherwise use make. Use #### sh -c to avoid warning if gmake isn't found. $make = system ("sh -c \"gmake --version\" > /dev/null 2>&1") ? 'make' : 'gmake'; $ACE_ROOT = $ENV{'ACE_ROOT'} || die "$0: ACE_ROOT was not set!\n"; chop ($pwd = `pwd`); if ($pwd =~ m%/ace$%) { #### Default: libACE $tao = 0; } elsif ($pwd =~ m%/tao$%) { $tao = 1; } else { die "$0: unsupported directory; $pwd\n"; } $html = $verbose = 0; #### #### Process command line args. #### foreach my $arg (@ARGV) { if ($arg eq '-h') { $html = 1; chop ($sysname = `uname -s`); chop ($sysrev = `uname -r`); shift; } elsif ($arg eq '-v') { $verbose = 1; shift; } elsif ($arg eq '-?') { print "$usage"; exit; } else { #### Pass remaining args to make. } } $make_args = join (' ', @ARGV) . $build_args; if ($tao) { $COMPONENTS = "$TAO_COMPONENTS"; $LIB_COMPONENTS = 'TAO_COMPONENTS'; $libname = TAO; } else { $COMPONENTS = "$ACE_COMPONENTS"; $LIB_COMPONENTS = 'ACE_COMPONENTS'; $libname = ACE; } $lib = "lib${libname}.a"; #### #### Select the size command based on ACE_ROOT setting. #### if ($ACE_ROOT =~ /vxworks/) { $TOOLENV = $ENV{'TOOLENV'} || $default_toolenv; $WIND_BASE = $ENV{'WIND_BASE'} || $default_wind_base; $WIND_HOST_TYPE = $ENV{'WIND_HOST_TYPE'} || $default_host_type; $size = "$WIND_BASE/host/$WIND_HOST_TYPE/bin/size$TOOLENV"; } elsif ($ACE_ROOT =~ /lynx-ppc/) { $size = '/usr/lynx/3.0.0/ppc/cdk/sunos-xcoff-ppc/bin/size'; } elsif ($ACE_ROOT =~ /lynx/) { $size = '/usr/lynx/3.0.0/x86/cdk/sunos-coff-x86/bin/size'; } elsif ($ACE_ROOT =~ /chorus/) { $size = '/project/doc/mvme/green68k/gnu/bin/size'; } else { $size = 'size'; } #### #### Measure the size of the entire library. #### $sizeTotal = build_lib ("${libname}_COMPONENTS=\"$COMPONENTS\""); $components = "
$sysname $sysrev $ACE_ROOT\n"; print "$echoArgs $componentSize\n"; print ' |
---|
' . "\n";
}
####
#### Build library with componnents specified in argument.
####
sub build_lib ()
{
my ($lib_components) = @_;
unlink "$lib";
print "$make $make_args $lib_components\n" if $verbose;
system ("$make $make_args $lib_components >> make.log 2>&1") &&
die "$0: command failed; $make $make_args $lib_components\n";
my $libSize = 0;
open (SIZE, "$size $lib |") ||
die "$0: unable to open $size\n";
while (