#!/bin/bash
#strVendor='hiview'
#strProject='ht7315_evb'
#strChip='ht7315'
strDate=`date "+%Y-%m-%d %H:%M:%S"`

funWriteLog()
{
	strLog="$strDate  $*"
	echo $strLog
}

funGenerateConfigFile()
{
	: > $1

	if [ -f $2/$strChip/common.config ]
	then
		while read strLine
		do
			if [ "$strLine" != "" -a "$strLine" != " " -a "$strLine" != "  " -a "$strLine" != "   " ]
			then
				echo "export $strLine">>$1
			fi
		done < $2/$strChip/common.config
	else
		funWriteLog "$2/$strChip/common.config not exist"
	fi


	if [ -f  $projectPath/../user/$strVendor/$strProject/property.config ]
	then
		grep "?=" $projectPath/../user/$strVendor/$strProject/property.config > $1.tmp
	else
		funWriteLog "$projectPath/../user/$strVendor/$strProject/property.config not exist"
	fi

	if [ -f  $1.tmp ]
	then
		while read strLine
		do
			if [ "$strLine" != "" -a "$strLine" != " " -a "$strLine" != "  " -a "$strLine" != "   " ]
			then
				echo "export $strLine">>$1
			fi
		done < $1.tmp
	else
		funWriteLog "$1.tmp not exist"
	fi

	echo "export CONFIG_VENDOR ?= $strVendor" >>$1
	echo "export CONFIG_PROJECT ?= $strProject" >>$1
	echo "export CONFIG_CODE_PATH ?= $srcRootPath" >>$1
}

funListChoice()
{
	echo "******************************************************************************"
    echo -e "seq \t vendor \t project \t chip"
	echo -e " 2 \t hiview \t ht7315_evb \t ht7315"
	echo -e " 8 \t hiview \t ht7315_product  ht7315"
	echo -e " 9 \t hisense \t G5F \t \t ht7315"
	echo "******************************************************************************"
	read strValue
	case $strValue in
	   2)
			strVendor='hiview'
			strProject='ht7315_evb'
			strChip='ht7315'
		;;
	   8)
			strVendor='hiview'
			strProject='ht7315_product'
			strChip='ht7315'
		;;
	   9)
			strVendor='hisense'
			strProject='G5F'
			strChip='ht7315'
		;;
	esac
}

funSelectPara()
{
	echo "Please Choose Parameter Config"
	funListChoice
}
