#! /bin/bash

#source ${HOME}/mlfscripts/setup.sh
source ../mlf_build_env.sh

# Get Latest updated date
echo manyo
cd ${MLFSRC}/manyo
last1=`git log -n 1 --date=format:"%Y%m%d" |grep "Date:" |sed -e 's/Date:   20//'`
echo "Manyo :"$last1

cd ${MLFSRC}/Utsusemi
last2=`git log -n 1 --date=format:"%Y%m%d" |grep "Date:" |sed -e 's/Date:   20//'`
echo "Utsusemi :"$last2

cd ${MLFSRC}/Utsusemi-ENG
last3=`git log -n 1 --date=format:"%Y%m%d" |grep "Date:" |sed -e 's/Date:   20//'`
echo "Utsusemi-ENG :"$last3

cd ${MLFSRC}/Utsusemi-SAS
#git log -n 1 --date=format:"%Y%m%d" |grep "Date:" |sed -e 's/Date:   20//' > ${BUILDUTSUSEMI}/LASTDATE_SAS
last4=`git log -n 1 --date=format:"%Y%m%d" |grep "Date:" |sed -e 's/Date:   20//'`
echo "Utsusemi-SAS :"$last4

l1=`expr $last1`
l2=`expr $last2`
l3=`expr $last3`
l4=`expr $last4`

if [ $l2 -gt $l1 ]; then
    l1=$l2
fi

if [ $l3 -gt $l1 ]; then
    l1=$l3
fi

if [ $l4 -gt $l1 ]; then
    l1=$l4
fi

echo $l1>${MLFSRC}/LASTUPDATED
