Geant4 Cross Reference |
1 #!/usr/bin/perl 2 3 use Getopt::Std; 4 5 our $PreinitMacroDef = "preinit.mac"; 6 our $InitMacroDef = "init.mac"; 7 our $OverrideOpt = ""; 8 9 sub PrintUsage 10 { 11 print "Usage: [-p preinit_macro] [-m init_ 12 print "\tThis program will create a job sc 13 print "project\n\t\t<job_id>; the job scri 14 print "'cexmc_'\n\t\tand appended by '_<su 15 print "\tDefault preinit_macro is '$Preini 16 print "is '$InitMacroDef'\n"; 17 print "\tIf '-r' is specified then a proje 18 print "new\n\t\tproject <job_id>_<suffix> 19 print "\t\tin this case will be ignored\n" 20 print "\tUse '-y' to override existing pro 21 } 22 23 sub VERSION_MESSAGE 24 { 25 PrintUsage; 26 exit 0; 27 } 28 29 getopts( "m:p:r:y" ); 30 31 unless ( $ARGV[ 0 ] ) 32 { 33 PrintUsage; 34 exit 1; 35 } 36 37 $opt_p ||= $PreinitMacroDef; 38 $opt_m ||= $InitMacroDef; 39 $opt_r &&= "_$opt_r"; 40 $OverrideOpt = "-y" if $opt_y; 41 42 open ( JOBFILE, "> cexmc_$ARGV[ 0 ]$opt_r.job" 43 print JOBFILE "#!/bin/sh\n"; 44 print JOBFILE "CEXMC_PROJECTS_DIR=" . $ENV{ 'C 45 print JOBFILE "PATH=" . $ENV{ 'PATH' } . "\n"; 46 print JOBFILE "LD_LIBRARY_PATH=" . $ENV{ 'LD_L 47 if ( $opt_r ) 48 { 49 print JOBFILE "cexmc -m$opt_m $OverrideOpt 50 print JOBFILE "-w$ARGV[ 0 ]$opt_r\n"; 51 } 52 else 53 { 54 print JOBFILE "cexmc -p$opt_p -m$opt_m $Ov 55 } 56 57 close ( JOBFILE ) or die $!;