1#!/usr/bin/env perl 2# 3# copy a header into the temporary CLHEP header tree if 4# a) the header is not already there 5# b) the source is newer 6# 7 8if ($#ARGV != 1) { 9 print "mungeit requires two arguments - exit\n"; 10 exit; 11} else { 12 $source_header=$ARGV[0]; 13 $dest_header=$ARGV[1]; 14 &check_header; 15} 16 17exit; 18 19sub check_header { 20 # make sure source exists 21 if ( ! -e $source_header ) { 22 print "$source_header does not exist - exit\n"; 23 exit; 24 } 25 # copy if not already there - otherwise, check the time stamp 26 if ( ! -e $dest_header ) { 27 $cmd = "cp -p ".$source_header." ".$dest_header; 28 print "$cmd\n"; 29 system($cmd); 30 } else { 31 $source_header_time = -M $source_header; 32 $dest_header_time = -M $dest_header; 33 # copy only if source is newer 34 if( $source_header_time < $dest_header_time ) { 35 $cmd = "cp -p ".$source_header." ".$dest_header; 36 print "$cmd\n"; 37 system($cmd); 38 } 39 } 40} 41 42