trick/libexec/trick/trick_make_checksums
Alex Lin 19025d77ad Standardize directory names
Reorganized.  Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory.  Created a libexec directory that holds all of the executables that users don't need to execute directly.  Changed all of the executables remaining in bin to start with "trick-".  In the sim_services directories changed all source files to find the Trick headers in their new location.  Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level.  Moved the makefiles, docs, man, and other architecture independent files into a top level share directory.  Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on.

refs #63
2015-06-09 08:44:42 -05:00

53 lines
1.4 KiB
Perl
Executable File

#!/usr/bin/perl -w
# set TRICK_SOURCE_CM_DIR and TRICK_SOURCE_WORK dir
# to the CM and work dir respectively.
# This script will run under 5.00x but the results
# are not reliable. Under perl 5.6.0 it works well.
use strict;
use File::Find;
use Cwd;
my $cwd = cwd() ;
# bm_build and bm_or taken from www.perl.com
sub _bm_build {
my $condition = shift;
my @regexp = @_; # this MUST not be local(); need my()
my $expr = join $condition => map { "m/\$regexp[$_]/o" } (0..$#regexp);
my $match_func = eval "sub { $expr }";
die if $@; # propagate $@; this shouldn't happen!
return $match_func;
}
sub bm_or { _bm_build('||', @_) }
my $ignore = bm_or qw{ io_src xml(/|$) SCCS catalog \.\.\. \/object \.bak$
bin_ lib_ \.[oa]$ \.clex$ [Mm]akefile \.checksums } ;
unlink "$cwd/.checksums" if ( -e "$cwd/.checksums" ) ;
find(\&all_files, '.');
sub all_files {
my $curr_name = $_ ;
my $name = $File::Find::name ;
if ( $name ne "." ) {
$_ = $name ;
return if ( &$ignore ) ;
if ( -f $curr_name ) {
if ( $^O eq "linux" ) {
system "cd $cwd ; /usr/bin/sum -s $name >> $cwd/.checksums" ;
}
elsif ( $^O eq "darwin" ) {
system "cd $cwd ; /usr/bin/cksum -o 2 $name >> $cwd/.checksums" ;
}
else {
system "cd $cwd ; /usr/bin/sum $name >> $cwd/.checksums" ;
}
}
}
}