| #!/bin/bash |
| |
| # Config item. |
| # static / shared |
| LIB_TYPE=static |
| # gcc-4.9 / gcc-8.4 |
| PLATFORM=gcc-4.9 |
| |
| ROOT_DIR=`pwd` |
| TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM |
| echo "toolchain : $ROOT_DIR" |
| |
| |
| |
| function build() |
| { |
| cd mbtk |
| |
| if [ -n "$1" ] ;then |
| case "$1" in |
| clean) |
| make clean |
| ;; |
| *) |
| exit 1;; |
| esac |
| else # 无参数 |
| make || exit 1 |
| fi |
| |
| cd $ROOT_DIR |
| |
| echo "Build MBTK success." |
| } |
| |
| function file_copy() |
| { |
| ROOTFS_DIR=$ROOT_DIR/../asr_code/target/linux/mmp/base-files |
| |
| if [ -d $ROOTFS_DIR ];then |
| echo "Copy MBTK out files..." |
| if [ ! -d $ROOTFS_DIR/bin ];then |
| mkdir $ROOTFS_DIR/bin |
| fi |
| if [ ! -d $ROOTFS_DIR/lib ];then |
| mkdir $ROOTFS_DIR/lib |
| fi |
| |
| # Copy All SO Files. |
| cp -f out/lib/* $ROOTFS_DIR/lib |
| |
| # Copy All Bin Files. |
| cp -f out/bin/* $ROOTFS_DIR/bin |
| |
| else |
| echo "No found rootfs : $ROOTFS_DIR" |
| fi |
| } |
| |
| function main() |
| { |
| if [ ! -d out/bin ];then |
| mkdir -p out/bin |
| fi |
| |
| if [ ! -d out/lib ];then |
| mkdir -p out/lib |
| fi |
| |
| build |
| |
| file_copy |
| } |
| |
| main |