#!/bin/csh
# +-======-+ 
#  Copyright (c) 2003-2018 United States Government as represented by 
#  the Admistrator of the National Aeronautics and Space Administration.  
#  All Rights Reserved.
#  
#  THIS OPEN  SOURCE  AGREEMENT  ("AGREEMENT") DEFINES  THE  RIGHTS  OF USE,
#  REPRODUCTION,  DISTRIBUTION,  MODIFICATION AND REDISTRIBUTION OF CERTAIN 
#  COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS 
#  REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY").  
#  THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN 
#  INTENDED  THIRD-PARTY  BENEFICIARY  OF  ALL  SUBSEQUENT DISTRIBUTIONS OR 
#  REDISTRIBUTIONS  OF THE  SUBJECT  SOFTWARE.  ANYONE WHO USES, REPRODUCES, 
#  DISTRIBUTES, MODIFIES  OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED 
#  HEREIN, OR ANY PART THEREOF,  IS,  BY THAT ACTION, ACCEPTING IN FULL THE 
#  RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT.
#  
#  Government Agency: National Aeronautics and Space Administration
#  Government Agency Original Software Designation: GSC-15354-1
#  Government Agency Original Software Title:  GEOS-5 GCM Modeling Software
#  User Registration Requested.  Please Visit http://opensource.gsfc.nasa.gov
#  Government Agency Point of Contact for Original Software:  
#  			Dale Hithon, SRA Assistant, (301) 286-2691
#  
# +-======-+ 
#
#  Makes
#

   if ( $#argv < 1 ) then
	echo "Usage:       make.dist.csh  gfio_version"
	echo "Example:     make.dist.csh  v1.0.8"
	exit 1
   else
	set version = $1
   endif

#   Fresh start
#   -----------
    make distclean
   ./configure

   set arch = `uname`

   if ( $arch == "IRIX64" ) then

      make lib \
           FFLAGS='-extend_source -64 -r4 -I/ford1/local/IRIX64/hdf/include'
      if ( $status ) exit 1
      mv libgfio.a libgfio${version}_r4.a

      make clean
      make lib \
           FFLAGS='-extend_source -64 -r8 -I/ford1/local/IRIX64/hdf/include'

      if ( $status ) exit 1
      mv libgfio.a libgfio${version}_r8.a

      echo " "
      echo 'Created libraries: ' `ls libgfio*.a`
      echo " "

    else
	echo "$arch not supported"
        exit 1
    endif

    exit 0