#!/bin/csh -f
#
# THIS SCRIPT IS OLD. DON'T USE IT! 
#
# It's been updated to reflect the new version of NCL (6.6.0/1),
# but it hasn't been used in years. See create_dist instead.
#
# This script is a very basic one for creating the two 
# NCL binary distributions for each system: OPeNDAP and 
# non-OPenDAP. There are certain assumptions about this
# script:
#
#  1. The non-OPeDNAP version of the NetCDF C library
#     is in $NCARG_EXTERNAL/nodap, and the OPeNDAP
#     version is in $NCARG_EXTERNAL.
#
#  2. The OPenDAP-enabled ESMF_RegridWeightGen is installed to
#     $NCARG_EXTERNAL/bin/ESMF_RegridWeightGen.dap and the 
#     non-OPenDAP-enabled one to 
#     $NCARG_EXTERNAL/bin/ESMF_RegridWeightGen.nodap
#
#  3. The $NCARG/config/Site.local,Site.local.dap,Site.local.nodap
#     $NCARG/config/Project,Project.dap,Project.nodap
#     files all exist. The Site.local.nodap should just have an
#     extra -L$NCARG_EXTERNAL/nodap/lib path so that the non
#     OPenDAP NetCDF gets loaded first. The Project.nodap file
#     has the "-lcurl" stuff removed from the netcdf libs line.
#
#  4. You are able to display an NCL X11 window, because various
#     X11 tests are executed.
#
# set echo verbose timestamp

echo "Don't use this script! It's old."
echo "See test_and_make_tarfile.py instead."
exit

set un=`uname -n`
set um=`uname -m`
set os=`uname -s`
set TAR_FILES       # Whether to tar up files
set SCP_FILES       # Whether to scp files to another machine. 
                    # NOTE: you can't scp files to yellowstone unattended. Grrr.

#set ASK            # Whether to ask to continue at various locations. This can be annoying.
set RUN_X11_TESTS   # Whether to run the X11 tests or PDF tests.

if ("$os" == "Darwin") then
  set ldd = "otool -L"
  set macosv = `sw_vers -productVersion`
  if($macosv == "10.8.4") then
    set un="cisl-denton"
  else if($macosv == "10.9.5") then
    set un="riley"
  else if($macosv == "10.10.2") then
    set un="cordy"
  endif
else
  set ldd = "ldd"
endif

if ("$un" == "logan.cgd.ucar.edu") then
  set un="logan"
endif

if ($?COMPILER_VERSION) then
  if ( "$COMPILER_VERSION" == "4.7.2" ) then
    set un="yellowstone_gnu472"
  else if ( "$COMPILER_VERSION" == "4.4.7" ) then
    set un="yellowstone_gnu447"
  else if ( "$COMPILER_VERSION" == "12.1.5" ) then
    set un="yellowstone_intel1215"
  else
    echo "I don't recognize this yellowstone system"
    exit
  endif
endif

if ($?RUN_X11_TESTS) then
  set wtype="x11"
else
  set wtype="pdf"
endif

if ("$un" == "logan") then
  setenv NCARGTEST /project/yampa02/haley/ncargtest
  setenv NCARG_EXTERNAL /contrib/ncl-6.6.1/external
  setenv NCARG_ROOT /contrib/ncl-6.6.1
  setenv NCARG /contrib/ncl-6.6.1/src/ncarg
  set dap_string   = "Linux_CentOS7.0_x86_64_gcc482"
  set nodap_string = "Linux_CentOS7.0_x86_64_nodap_gcc482"
else if ("$un" == "k5") then
  setenv NCARGTEST /d2/haley/ncargtest
  setenv NCARG_EXTERNAL /d2/haley/external
  setenv NCARG_ROOT /d2/haley/ncl-6.6.1
  setenv NCARG /d2/haley/src/ncarg
  set dap_string   = "Linux_RHEL5.11_i686_gcc412"
  set nodap_string = "Linux_RHEL5.11_i686_nodap_gcc412"
else if ("$un" == "k6") then
  setenv NCARGTEST /d2/haley/ncargtest
  setenv NCARG_EXTERNAL /d2/haley/external
  setenv NCARG_ROOT /d2/haley/ncl-6.6.1
  setenv NCARG /d2/haley/src/ncarg
  set dap_string   = "Linux_Debian6.0_i686_gcc445"
  set nodap_string = "Linux_Debian6.0_i686_nodap_gcc445"
else if ("$un" == "k7") then
  setenv NCARGTEST /d2/haley/ncargtest
  setenv NCARG_EXTERNAL /d2/haley/external
  setenv NCARG_ROOT /d2/haley/ncl-6.6.1
  setenv NCARG /d2/haley/src/ncarg
  set dap_string   = "Linux_Debian6.0_x86_64_gcc445"
  set nodap_string = "Linux_Debian6.0_x86_64_nodap_gcc445"
else if ("$un" == "k8") then
  setenv NCARGTEST /d2/haley/ncargtest
  setenv NCARG_EXTERNAL /d2/haley/external
  setenv NCARG_ROOT /d2/haley/ncl-6.6.1
  setenv NCARG /d2/haley/src/ncarg
  set dap_string   = "Linux_RHEL5.11_x86_64_gcc412"
  set nodap_string = "Linux_RHEL5.11_x86_64_nodap_gcc412"
else if ("$un" == "k9") then
  setenv NCARGTEST /d2/haley/ncargtest
  setenv NCARG_EXTERNAL /d2/haley/external
  setenv NCARG_ROOT /d2/haley/ncl-6.6.1
  setenv NCARG /d2/haley/src/ncarg
  set dap_string   = "Linux_Debian7.8_x86_64_gcc472"
  set nodap_string = "Linux_Debian7.8_x86_64_nodap_gcc472"
  set gccv = `gcc --version`
else if ("$un" == "yellowstone_gnu447") then
  setenv NCARGTEST /glade/u/ncldev/test/ncargtest
  setenv NCARG_EXTERNAL /glade/p/work/haley/dev/external/gnu/4.4.7
  setenv NCARG_ROOT /glade/p/work/haley/dev/ncl-trunk-gnu447-opt
  setenv NCARG /glade/p/work/haley/src/ncl-trunk-gnu447

  unsetenv LIB_NCAR
  unsetenv INC_NCAR
  unsetenv NETCDF

  set path=($NCARG_ROOT/bin /ncar/opt/lsf/9.1/linux2.6-glibc2.3-x86_64/etc /ncar/opt/lsf/9.1/linux2.6-glibc2.3-x86_64/bin /usr/lib64/qt-3.3/bin /glade/apps/opt/usr/bin /usr/bin /bin /usr/sbin /sbin /usr/local/openssh/5.7p1krb/bin /usr/lpp/mmfs/bin /opt/ibutils/bin /ncar/opt/hpss)
  rehash

  set dap_string   = "Linux_RHEL6.4_x86_64_gcc447"
  set nodap_string = "Linux_RHEL6.4_x86_64_nodap_gcc447"
else if ("$un" == "yellowstone_gnu472") then
  setenv NCARGTEST /glade/u/ncldev/test/ncargtest
  setenv NCARG_EXTERNAL /glade/p/work/haley/dev/external/gnu/4.7.2
  setenv NCARG_ROOT /glade/p/work/haley/dev/ncl-trunk-gnu472-opt
  setenv NCARG /glade/p/work/haley/src/ncl-trunk-gnu472

  unsetenv LIB_NCAR
  unsetenv INC_NCAR
  unsetenv NETCDF

  set path=($NCARG_ROOT/bin /glade/apps/opt/gnu/4.7.2/bin /usr/lib64/qt-3.3/bin /glade/apps/opt/usr/bin /ncar/opt/lsf/9.1/linux2.6-glibc2.3-x86_64/etc /ncar/opt/lsf/9.1/linux2.6-glibc2.3-x86_64/bin /usr/bin /bin /usr/sbin /sbin /usr/local/openssh/5.7p1krb/bin /usr/lpp/mmfs/bin /opt/ibutils/bin /ncar/opt/hpss)
  rehash

  set dap_string   = "Linux_RHEL6.4_x86_64_gcc472"
  set nodap_string = "Linux_RHEL6.4_x86_64_nodap_gcc472"
else if ("$un" == "yellowstone_intel1215") then
  setenv NCARG /glade/p/work/haley/src/ncl-trunk-intel
  setenv NCARGTEST /glade/u/ncldev/test/ncargtest
  setenv NCARG_EXTERNAL /glade/p/work/haley/dev/external/intel/12.1.5
  setenv NCARG_ROOT /glade/p/work/haley/dev/ncl-trunk-intel-opt
  setenv YMAKE_DEV_FILE $NCARG/ymakedevfile

  unsetenv LIB_NCAR
  unsetenv INC_NCAR
  unsetenv NETCDF

  set path=($NCARG_ROOT/bin /usr/lib64/qt-3.3/bin /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/bin/intel64 /glade/apps/opt/usr/bin /ncar/opt/lsf/9.1/linux2.6-glibc2.3-x86_64/etc /ncar/opt/lsf/9.1/linux2.6-glibc2.3-x86_64/bin /usr/bin /bin /usr/sbin /sbin /usr/local/openssh/5.7p1krb/bin /usr/lpp/mmfs/bin /opt/ibutils/bin /ncar/opt/hpss /glade/apps/opt/netcdf/4.3.0/intel/12.1.5/bin)
  rehash

  set dap_string   = "Linux_RHEL6.4_x86_64_intel1215"
  set nodap_string = "Linux_RHEL6.4_x86_64_nodap_intel1215"
else if ("$un" == "riley") then
  setenv NCARGTEST /Users/haley/ncargtest
  setenv NCARG_EXTERNAL /Users/haley/dev/external
  setenv NCARG_ROOT /Users/haley/dev
  setenv NCARG /Users/haley/src/ncarg
  set dap_string   = "MacOS_10.9_64bit_gcc492"
  set nodap_string = "MacOS_10.9_64bit_nodap_gcc492"
else if ("$un" == "cordy") then
  setenv NCARGTEST /Users/haley/ncargtest
  setenv NCARG_EXTERNAL /Users/haley/dev/external
  setenv NCARG_ROOT /Users/haley/dev/ncl-6.6.1
  setenv NCARG /Users/haley/src/ncarg
  set dap_string   = "MacOS_10.10_64bit_gcc481"
  set nodap_string = "MacOS_10.10_64bit_nodap_gcc481"
else if ("$un" == "cisl-denton") then
  setenv NCARGTEST /Users/haley/ncargtest
  setenv NCARG_EXTERNAL /Users/haley/dev/external
  setenv NCARG_ROOT /Users/haley/dev
  setenv NCARG /Users/haley/src/ncarg
  set dap_string   = "MacOS_10.8_64bit_gcc471"
  set nodap_string = "MacOS_10.8_64bit_nodap_gcc471"
else
  echo "I DON'T RECOGNIZE THIS SYSTEM. EXITING..."
  exit
endif

# logan doesn't have enough disk space in /contrib for tar files.
if ("$un" == "logan") then
  set tar_dir="/project/yampa02/haley"
else
  set tar_dir="$NCARG_ROOT"
endif

setenv PATH $NCARG_ROOT/bin:$PATH
rehash

set datestr     = `date +%m%d%y_%H%M`
set output_file = "$NCARG_ROOT/make-tarfile-output.$datestr"
if (-f $output_file) /bin/rm $output_file
set ncl_version=`ncl -V`
set which_ncl=`which ncl`

echo "======================================================================"
echo "Date:        $datestr"
echo "Machine:     $un" 
echo "NCARGTEST:   $NCARGTEST"
echo "NCARG_ROOT:  $NCARG_ROOT"
echo "which ncl:   $which_ncl" 
echo "NCL version: $ncl_version" 
echo "This file:   $output_file"
echo "======================================================================"
echo "======================================================================" >&! $output_file
echo "Date:        $datestr" >>& $output_file
echo "Machine:     $un"  >>& $output_file
echo "NCARGTEST:   $NCARGTEST" >>& $output_file
echo "NCARG_ROOT:  $NCARG_ROOT" >>& $output_file
echo "which ncl:   $which_ncl"  >>& $output_file
echo "NCL version: $ncl_version" >>& $output_file
echo "======================================================================" >>& $output_file
if ("$un" == "yellowstone_gnu447" || "$un" == "yellowstone_gnu472" || "$un" == "yellowstone_intel1215") then
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "ON YELLOWSTONE: building a binary for $un" >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  if ("$un" == "yellowstone_gnu447" || "$un" == "yellowstone_gnu472") then
    gcc --version >>& $output_file
    gfortran --version >>& $output_file
    echo "----------------------------------------------------------------------" >>& $output_file
  else
    icc --version >>& $output_file
    ifort --version >>& $output_file
    echo "----------------------------------------------------------------------" >>& $output_file
  endif
  echo "----------------------------------------------------------------------" >>& $output_file
  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif
endif


# Error checking
set copy_files   = ("Site.local" "Project")
cd $NCARG/config
foreach f($copy_files)
  if(! -f  $f) then
    echo "$f doesn't exist...can't continue" >>& $output_file
    exit
  endif
  if(! -f  $f.dap) then
    echo "$f.dap doesn't exist...can't continue" >>& $output_file
    exit
  endif
  if(! -f  $f.nodap) then
    echo "$f.nodap doesn't exist...can't continue" >>& $output_file
    exit
  endif
end

# Test to see if ESMF_RegridWeightGen is to be tarred up.
set ESMF
set esmf_files = ("$NCARG_EXTERNAL/bin/ESMF_RegridWeightGen.nodap $NCARG_EXTERNAL/bin/ESMF_RegridWeightGen.dap")
foreach f($esmf_files)
  if(! -f  $f) then
    echo "$f doesn't exist...unsetting ESMF..." >>& $output_file
    unset ESMF
  endif
endif

set path=($NCARG_ROOT/bin $path)
rehash
set version=`ncl -V`
set dap_tarfile   = "ncl_ncarg-$version.$dap_string.tar"
set nodap_tarfile = "ncl_ncarg-$version.$nodap_string.tar"
set dap_gzfile    = "$dap_tarfile.gz"
set nodap_gzfile  = "$nodap_tarfile.gz"

#set sys_name = "yellowstone.ucar.edu"
set sys_name = "cisl-denton.scd.ucar.edu"
set sys_dir  = "/Users/haley/tmp/6.6.1"

echo "----------------------------------------------------------------------"
echo "Tar files: $tar_dir/$dap_gzfile"
echo "           $tar_dir/$nodap_gzfile"
set df_cmd = `df -h $tar_dir`
echo " df -h $tar_dir $df_cmd" 
echo "----------------------------------------------------------------------"
# Clean up
cd $tar_dir
/bin/rm $dap_gzfile $nodap_gzfile $dap_tarfile $nodap_tarfile

set opendap_test  = "$NCARGTEST/nclscripts/opendap.ncl"
set esmf_test     = "$NCARGTEST/nclscripts/plotting/ESMF_JIRA_1984.ncl"
set ncargex_tests = ("cpex08" "c_shex03")
set ng4ex_tests   = ("cn02c" "xy04f" "nm04c") 

#----------------------------------------------------------------------
# Get ready to create non-opendap ncl
#----------------------------------------------------------------------
cd $NCARG/config
foreach f($copy_files)
  /bin/cp $f.nodap $f
end

set dirs = ($NCARG/ni/src/ncl)
foreach dir($dirs)
  cd $dir
  /bin/rm ncl
  make me >>& $output_file
  make all install >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Executing ldd on this non-OPenDAP binary..." >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  $ldd ncl >>& $output_file
  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif
end

echo "----------------------------------------------------------------------" >>& $output_file
echo "Running opendap test...should fail" >>& $output_file
echo "----------------------------------------------------------------------" >>& $output_file
ncl $opendap_test >>& $output_file

if( $?ASK ) then
  echo -n "Continue? <enter> for y, n for no "
  set answer="$<"
  if ("$answer" == "n") then
    exit
  endif
endif

#----------------------------------------------------------------------
# Copy over non-OPeNDAP ESMF_RegridWeightGen
#----------------------------------------------------------------------
if( $?ESMF ) then
  /bin/rm $NCARG_ROOT/bin/ESMF_RegridWeightGen
  /bin/cp $NCARG_EXTERNAL/bin/ESMF_RegridWeightGen.nodap $NCARG_ROOT/bin/ESMF_RegridWeightGen
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Executing ldd on this non-OPenDAP binary..." >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  $ldd $NCARG_ROOT/bin/ESMF_RegridWeightGen >>& $output_file

  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Running ESMF_RegridWeightGen test...should succeed" >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  eval ncl wtype=\\\"$wtype\\\" $esmf_test >>& $output_file

  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif
endif

if ("$un" == "yellowstone_gnu447" || "$un" == "yellowstone_gnu472" || "$un" == "yellowstone_intel1215") then
  ncargex cpex08 c_shex03 -W $wtype -n >>& $output_file
  ncargf77 -L$e/lib cpexcc.f cpex08.f -o cpex08 >>& $output_file
  ./cpex08 >>& $output_file
  ncargcc -ngmath -L$e/lib c_shex03.c -o c_shex03 >>& $output_file
  ./c_shex03 >>& $output_file
  /bin/rm cpex08* cpexcc* c_shex* >>& $output_file
else
  foreach f($ncargex_tests)
    ncargex $f -clean -W $wtype >>& $output_file
  end
endif

if( $?ASK ) then
  echo -n "Continue? <enter> for y, n for no "
  set answer="$<"
  if ("$answer" == "n") then
    exit
  endif
endif

if ("$un" == "yellowstone_gnu447" || "$un" == "yellowstone_gnu472" || "$un" == "yellowstone_intel1215") then
  ng4ex xy04f cn02c nm04c -W $wtype -n  >>& $output_file
  nhlf77 -L$e/lib xy04f.f -o xy04f >>& $output_file
  ./xy04f >>& $output_file
  nhlcc -L$e/lib cn02c.c -o cn02c >>& $output_file
  ./cn02c >>& $output_file
  nhlcc -L$e/lib -ngmath nm04c.c -o nm04c >>& $output_file
  ./nm04c >>& $output_file
  /bin/rm xy04* cn02* nm04*
else
  foreach f($ng4ex_tests)
    ng4ex $f -clean -W $wtype >>& $output_file
  end
endif

if( $?ASK ) then
  echo -n "Continue? <enter> for y, n for no "
  set answer="$<"
  if ("$answer" == "n") then
    exit
  endif
endif
  
echo "----------------------------------------------------------------------" >>& $output_file
echo "Running check_files for non-opendap version..." >>& $output_file
echo "----------------------------------------------------------------------" >>& $output_file
$NCARG/install/make-tarfile/check_files >>& $output_file

if( $?ASK ) then
  echo -n "Continue? <enter> for y, n for no "
  set answer="$<"
  if ("$answer" == "n") then
    exit
  endif
endif

# Create the tarfile
if ($?TAR_FILES) then
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Creating non-OPeNDAP tarfile from files in $NCARG_ROOT..." >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  cd $NCARG_ROOT
  $NCARG/install/make-tarfile/create_dist -p -d $tar_dir -f $nodap_string >>& $output_file
  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif
endif

#----------------------------------------------------------------------
# Get ready to create opendap ncl                                           
#----------------------------------------------------------------------
cd $NCARG/config
foreach f($copy_files)
  /bin/cp $f.dap $f
end

set dirs = ($NCARG/ni/src/ncl)
foreach dir($dirs)
  cd $dir
  /bin/rm ncl
  make me >>& $output_file
  make all install >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Executing ldd on this OPenDAP binary..." >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  $ldd ncl >>& $output_file
  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif
end

echo "----------------------------------------------------------------------" >>& $output_file
echo "Running opendap test...should succeed" >>& $output_file
echo "----------------------------------------------------------------------" >>& $output_file
ncl $opendap_test >>& $output_file

if( $?ASK ) then
  echo -n "Continue? <enter> for y, n for no "
  set answer="$<"
  if ("$answer" == "n") then
    exit
  endif
endif

#----------------------------------------------------------------------
# Copy over DAP ESMF_RegridWeightGen
#----------------------------------------------------------------------
if( $?ESMF ) then
  /bin/rm $NCARG_ROOT/bin/ESMF_RegridWeightGen
  /bin/cp $NCARG_EXTERNAL/bin/ESMF_RegridWeightGen.dap $NCARG_ROOT/bin/ESMF_RegridWeightGen

  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Executing ldd on this OPenDAP binary..." >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  $ldd $NCARG_ROOT/bin/ESMF_RegridWeightGen >>& $output_file
 
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Running ESMF_RegridWeightGen test...should succeed" >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  eval ncl wtype=\\\"$wtype\\\" $esmf_test >>& $output_file

  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif
endif

echo "----------------------------------------------------------------------" >>& $output_file
echo "Running check_files for opendap version..." >>& $output_file
echo "----------------------------------------------------------------------" >>& $output_file
$NCARG/install/make-tarfile/check_files >>& $output_file

if( $?ASK ) then
  echo -n "Continue? <enter> for y, n for no "
  set answer="$<"
  if ("$answer" == "n") then
    exit
  endif
endif

# Create the tarfile
if ($?TAR_FILES) then
  echo "----------------------------------------------------------------------" >>& $output_file
  echo "Creating OPeNDAP tarfile from files in $NCARG_ROOT..." >>& $output_file
  echo "----------------------------------------------------------------------" >>& $output_file
  cd $NCARG_ROOT
  $NCARG/install/make-tarfile/create_dist -p -d $tar_dir -f $dap_string >>& $output_file
  if( $?ASK ) then
    echo -n "Continue? <enter> for y, n for no "
    set answer="$<"
    if ("$answer" == "n") then
      exit
    endif
  endif

echo "----------------------------------------------------------------------"
ls -lh $tar_dir/$dap_gzfile
ls -lh $tar_dir/$nodap_gzfile
echo "----------------------------------------------------------------------"
echo "----------------------------------------------------------------------" >>& $output_file
ls -lh $tar_dir/$dap_gzfile >>& $output_file
ls -lh $tar_dir/$nodap_gzfile >>& $output_file
echo "----------------------------------------------------------------------" >>& $output_file

# Copy files over to yellowstone                                                
  if ($?SCP_FILES) then
    echo "----------------------------------------------------------------------" >>& $output_file
    echo "Copying files to $sys_name..." >>& $output_file
    echo "----------------------------------------------------------------------" >>& $output_file
    echo "----------------------------------------------------------------------"
    echo "Copying files to $sys_name..."
    echo "----------------------------------------------------------------------"
    cd $tar_dir
    if ("$un" == "cisl-denton") then
      /bin/mv $nodap_gzfile $dap_gzfile ${sys_dir}/. >>& $output_file
    else
      scp $nodap_gzfile $dap_gzfile ${sys_name}:${sys_dir}/.
    endif
  endif
endif

echo "See $output_file for more details"
