#!/bin/sh
# this archives the ELM source code in its entirety to two locations:
# one is an archive that is updated in the SMDhome dir,
# and a copy is placed on the HA-FS2 file system with a unique (usually date) name

if test $# = 0
  then
    echo Error, give the Name of the Project code. 
    exit
fi
if test $# = 1
  then
    echo Error, give the Name to designate the second backup source archive. 
    exit
fi

ProjName=$1
export ProjName
ArchName=$2
export ArchName

cd $SMD_HOME
tar -cvf ./$ProjName.src.tar  ./SMDriver/Sources/UnitMod/UnitMod.c ./SMDriver/Sources/UnitMod/BudgStats.c ./SMDriver/Sources/UnitMod/UnitMod.h ./SMDriver/Sources/SpatMod/WatMgmt.c ./SMDriver/Sources/SpatMod/WatMgmt.h ./SMDriver/Sources/rain/rain_inp.c ./SMDriver/Sources/rain/link_elm_wmm.c ./SMDriver/Sources/rain/grid_io.c ./SMDriver/Sources/rain/grid_io.h ./SMDriver/Sources/rain/link_elm_wmm.h ./SMDriver/Sources/SpatMod/Success.c ./SMDriver/Sources/SpatMod/Success.h ./SMDriver/Sources/SpatMod/Fire.c ./SMDriver/Sources/SpatMod/Fluxes.c ./SMDriver/Sources/SpatMod/Fluxes.h ./SMDriver/Sources/Driver_Sources/Generic_Driver.c ./SMDriver/Sources/Driver_Sources/Driver_Utilities.c ./SMDriver/Sources/Driver_Sources/globals.h ./SMDriver/Sources/Driver_Sources/tools.h ./SMDriver/Sources/Driver_Sources/custom.h ./SMDriver/Sources/Tools/Serial.c ./SMDriver/Sources/Driver_Sources/Driver.make.Serial.Sun ./scripts/AnimDirMake ./scripts/ArchiveRun  ./scripts/ArchiveSrc ./scripts/Check ./scripts/OutStep  ./scripts/Run  ./scripts/RunTime ./scripts/build ./scripts/go ./scripts/rmAnim ../lib/libjpeg.a ../lib/libdf.a ../lib/libz.a ../lib/libmfhdf.a ../include/hdf

cp -p ./$ProjName.src.tar /b_erd/bb_elmmod/src/arc_src/$ProjName.src.$ArchName.tar
gzip /b_erd/bb_elmmod/src/arc_src/$ProjName.src.$ArchName.tar 
