blob: f06ac34c5d4d394bab395738a391f7c6a089954a [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{
38 ROOTFS_DIR=$ROOT_DIR/../asr_code/target/linux/mmp/base-files
39
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{
62 if [ ! -d out/bin ];then
63 mkdir -p out/bin
64 fi
65
66 if [ ! -d out/lib ];then
67 mkdir -p out/lib
68 fi
69
70 build
71
72 file_copy
73}
74
75main