blob: be9f10a2dc92a0e5863388522d060c2613418668 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001#!/bin/bash
2
3# Config item.
4# static / shared
5LIB_TYPE=static
6# gcc-4.9 / gcc-8.4
7PLATFORM=gcc-4.9
8
9ROOT_DIR=`pwd`
10TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM
11echo "toolchain : $ROOT_DIR"
12
liubin281ac462023-07-19 14:22:54 +080013
liubin281ac462023-07-19 14:22:54 +080014
liubin207854f2023-07-19 17:25:29 +080015function build()
16{
17 cd mbtk
liubin281ac462023-07-19 14:22:54 +080018
liubin207854f2023-07-19 17:25:29 +080019 if [ -n "$1" ] ;then
20 case "$1" in
21 clean)
22 make clean
23 ;;
24 *)
25 exit 1;;
26 esac
27 else # 无参数
28 make || exit 1
29 fi
liubin281ac462023-07-19 14:22:54 +080030
liubin207854f2023-07-19 17:25:29 +080031 cd $ROOT_DIR
liubin281ac462023-07-19 14:22:54 +080032
liubin207854f2023-07-19 17:25:29 +080033 echo "Build MBTK success."
34}
35
36function file_copy()
37{
liubin1673a9c2023-07-19 20:59:43 +080038 ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk
liubin207854f2023-07-19 17:25:29 +080039
40 if [ -d $ROOTFS_DIR ];then
41 echo "Copy MBTK out files..."
42 if [ ! -d $ROOTFS_DIR/bin ];then
43 mkdir $ROOTFS_DIR/bin
44 fi
45 if [ ! -d $ROOTFS_DIR/lib ];then
46 mkdir $ROOTFS_DIR/lib
47 fi
48
49 # Copy All SO Files.
50 cp -f out/lib/* $ROOTFS_DIR/lib
51
52 # Copy All Bin Files.
53 cp -f out/bin/* $ROOTFS_DIR/bin
54
55 else
56 echo "No found rootfs : $ROOTFS_DIR"
57 fi
58}
59
60function main()
61{
liubin1673a9c2023-07-19 20:59:43 +080062 if [ -d out/bin -a -d out/lib ];then
63 file_copy
64 else
65 if [ ! -d out/bin ];then
66 mkdir -p out/bin
67 fi
68
69 if [ ! -d out/lib ];then
70 mkdir -p out/lib
71 fi
72
73 build
74
75 file_copy
liubin207854f2023-07-19 17:25:29 +080076 fi
liubin207854f2023-07-19 17:25:29 +080077}
78
79main