#!/usr/bin/env perl use strict; use Getopt::Long; use File::Path; my $CASE = `./xmlquery CASE -value `; my $GMAKE = `./xmlquery GMAKE -value `; my $CASETOOLS = `./xmlquery CASETOOLS -value `; # these are needed by the makefile and need to be in the environment $ENV{CASEROOT} = `./xmlquery CASEROOT -value `; $ENV{DEBUG} = `./xmlquery DEBUG -value `; $ENV{USE_ESMF_LIB} = `./xmlquery USE_ESMF_LIB -value `; $ENV{COMP_INTERFACE} = `./xmlquery COMP_INTERFACE -value `; $ENV{BUILD_THREADED} = `./xmlquery BUILD_THREADED -value`; $ENV{PIO_VERSION} = `./xmlquery PIO_VERSION -value`; $ENV{CLM_CONFIG_OPTS} = `./xmlquery CLM_CONFIG_OPTS -value`; my $testcase = `./xmlquery TESTCASE -value`; sub usage { die < \$opts{help}, "a" => \$opts{atm}, "c" => \$opts{cpl}, "o" => \$opts{ocn}, "w" => \$opts{wav}, "g" => \$opts{glc}, "i" => \$opts{ice}, "r" => \$opts{rof}, "l" => \$opts{lnd}, "e" => \$opts{esp}, "m" => \$opts{mct}, "s" => \$opts{csmshare}, "t" => \$opts{gptl}, "p" => \$opts{pio}, ) or usage(); usage() if($opts{help}); my @opts = keys %opts; my $cnt=0; foreach(@opts){ $cnt += $opts{$_}; } # Set defaults - look for 'all' if no arguments provided, this preserves legacy functionality if( $cnt==0){ my $all = shift; print "$all\n"; if($all eq 'all'){ $opts{mct}=1; $opts{pio}=1; $opts{gptl}=1; $opts{csmshare}=1; } $opts{atm} = 1; $opts{cpl} = 1; $opts{ocn} = 1; $opts{wav} = 1; $opts{glc} = 1; $opts{ice} = 1; $opts{rof} = 1; $opts{esp} = 1; # Do not clean shared land library in a test case unless explicitly # requested. This is for the sake of test suites: We don't want tests that # do a clean_build to clean the shared land libraries, because that would # result in unnecessary rebuilds. (Another way to think about this is: the # shared library, which is in a path specific to the build options, removes # the need for the clean_build that is done as part of some tests' builds.) if(not defined $testcase or ($ENV{CLM_CONFIG_OPTS} =~ /clm4_0/)){ $opts{lnd} = 1; } } if($opts{mct}+$opts{pio}+$opts{gptl}+$opts{csmshare} >= 1){ } if($opts{csmshare}==1){ } my $sysmod = "$GMAKE -f $CASETOOLS/Makefile "; foreach my $lib (@opts){ if($opts{$lib}==1){ $sysmod .= "clean$lib "; } } system($sysmod) == 0 or die "$sysmod failed: $?\n"; my @lockedfiles = glob("LockedFiles/env_build*"); foreach my $lf (@lockedfiles) { unlink($lf); } system("./xmlchange -noecho SMP_BUILD=0,NINST_BUILD=0,BUILD_COMPLETE=FALSE,BUILD_STATUS=0"); my $sdate = `date +"%Y-%m-%d %H:%M:%S"`; open my $CS, ">>", "./CaseStatus"; print $CS "clean_build complete $sdate\n"; close $CS;