Chinaunix首页 | 论坛 | 博客
  • 博客访问: 959030
  • 博文数量: 116
  • 博客积分: 3923
  • 博客等级: 中校
  • 技术积分: 1337
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-23 01:22
文章分类

全部博文(116)

文章存档

2013年(1)

2012年(17)

2011年(69)

2009年(29)

分类: LINUX

2009-04-30 21:44:31

#! /usr/bin/bash -
#################################################################################################################
# file_name: mul_project.sh
# Author   : Vincent.chen
# Date     : 2009-01-24
# Platform : Cygwin Platform
# Usage    : in order to complie multiple project which just have diff version siwtch
#            (1) put this file under the floder of project
#            (2) use "chmod a+x mul_project.sh" command to change it to executable and execute it
#                by "./mul_project.sh" under the project's directory.
#            (3) the result is under the "./comp_result" directory.
#################################################################################################################

# ver_switch and the ver_name must be consistency within them
ver_switch="DIGICEL_EI_SALVADOR DIGICEL_PANAMA DIGICEL_HONDURAS CALRO_PERU CSZ_MOVILNET CSZ_NORMAL_UT"
ver_name=( C2010_1.10.EU_EI_SAL C2010_1.10.US_PANAMA C2010_1.10.US_HONDURAS  C2010_1.10.US_PERU C2010_1.10.US_MOVILNET C2010_1.10.US_NORMAL_UT )

# compile command
mak_prj="make CELLONSZ23C_07B gprs new"


# for Cygwin Path Variable protected
CYGWIN_PATH_DEL_1="/usr/local/bin"
CYGWIN_PATH_DEL_2="/usr/bin"
CYGWIN_PATH_DEL_3="/bin"
CYGWIN_PATH_DEL_4="/usr/X11R6/bin"

OLDPATH="$PATH"

#export PATH

((index = 0))

for vw in $ver_switch
do
    # delete the build directory
    if [ -d ./build ] ; then
    /usr/bin/rm -rf build
    fi
    # modify the config
    if [ -e ./make/CELLONSZ23*.mak ] ; then
    pushd .
    cd ./make
    mak_file_name=`ls -l CELLONSZ23*.mak | awk '{print $9;}'`
#    echo $mak_file_name
    sed -i -e "s/^CSZ_SUB_PROJECT *= *[a-zA-Z_]*/CSZ_SUB_PROJECT = $vw/" "$mak_file_name"
    popd
    fi
    # modify the version
    if [ -e ./make/Verno_CELLONSZ23*.bld ] ; then
    pushd .
    cd ./make
    ver_file_name=`ls -l Verno_CELLONSZ23*.bld | awk '{print $9;}'`
#    echo $ver_file_name
    ver_name_item=${ver_name[${index}]}
#    echo $ver_name_item
    sed -i -e "s/^VERNO *= *[^ ]*/VERNO = ${ver_name[${index}]}/" "$ver_file_name"
    popd
    fi
    # complie
    PATH=$(echo $PATH | sed -e "s;:\?$CYGWIN_PATH_DEL_4;;" -e 's;$CYGWIN_PATH_DEL_4:\?;;')
    PATH=$(echo $PATH | sed -e "s;:\?$CYGWIN_PATH_DEL_1;;" -e 's;$CYGWIN_PATH_DEL_1:\?;;')
    PATH=$(echo $PATH | sed -e "s;:\?$CYGWIN_PATH_DEL_2;;" -e 's;$CYGWIN_PATH_DEL_2:\?;;')
    PATH=$(echo $PATH | sed -e "s;:\?$CYGWIN_PATH_DEL_3;;" -e 's;$CYGWIN_PATH_DEL_3:\?;;')
    cmd /C $mak_prj
    PATH=$CYGWIN_PATH_DEL_1:$CYGWIN_PATH_DEL_2:$CYGWIN_PATH_DEL_3:$CYGWIN_PATH_DEL_4:$PATH
    # backup the result
    mkdir -p "./comp_result/${ver_name[${index}]}"
    output="./comp_result/${ver_name[${index}]}"
    mv ./build/CELLON*/CELLONSZ23*.bin $output
    mv ./build/CELLON*/scatCELLON*.txt $output
    cp ./tst/database_classb/BPLGUInfo* $output
    # iterate the array of ver_name
    ((index = index+1))
#    echo $index
done

阅读(909) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~