liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Config item. |
| 4 | # static / shared |
| 5 | LIB_TYPE=static |
| 6 | # gcc-4.9 / gcc-8.4 |
| 7 | PLATFORM=gcc-4.9 |
| 8 | |
| 9 | ROOT_DIR=`pwd` |
| 10 | TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM |
| 11 | echo "toolchain : $ROOT_DIR" |
| 12 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 13 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 14 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame^] | 15 | function build() |
| 16 | { |
| 17 | cd mbtk |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 18 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame^] | 19 | 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 |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 30 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame^] | 31 | cd $ROOT_DIR |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 32 | |
liubin | 207854f | 2023-07-19 17:25:29 +0800 | [diff] [blame^] | 33 | echo "Build MBTK success." |
| 34 | } |
| 35 | |
| 36 | function 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 | |
| 60 | function 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 | |
| 75 | main |