blob: 66d63bb4a192e4efb58319a91d56190e41723296 [file] [log] [blame]
Jianxiong Pan61de2722020-07-14 10:57:22 +08001#!/usr/bin/env bash
2source scripts/amlogic/util.sh
3#export PATH=/opt/gcc-linaro-aarch64-none-elf-4.9-2014.09_linux/bin/:$PATH
4#export RTOS_CROSS_PREFIX=aarch64-none-elf-
5#export PATH=/opt/gcc-linaro-7.3.1-2018.05-i686_aarch64-elf/bin:$PATH
6
7# auto stop when any command return error
8set -o errexit
9
10if [ "$1" == "" ]; then
11echo "usage: $0 [board]"
12echo "valid boards are:"
13list_boards
14exit -1
15elif [ "$1" == "--config" ]; then
16echo "valid board are:"
17list_boards
18exit -1
19fi
20
21board=$1
22shift
23other_args=$*
24if [ "${other_args}" == "" ]; then
25 other_args=all
26fi
27arch_dir=`get_arch "${board}"`
28
29echo "arch_dir: ${arch_dir}"
30
31if [ "${arch_dir}" == "" ]; then
32echo "invalid board ${board}"
33echo "valid boards are:"
34list_boards
35exit -1
36fi
37
38if [ "$clean" == "" ]; then
39clean=yes #yes no
40fi
41cpu=1
42
43function build_subpath() {
44 sub="$1/${arch_dir}/${board}"
45 pushd "$sub"
46
47 [[ "$clean" == "yes" ]] && make clean
48 make -j8 ${other_args}
49#[[ "$clean" == "yes" ]] && make ARCH_DIR="${arch_dir}" BOARD_DIR="${board}" clean
50# make ARCH_DIR="${arch_dir}" BOARD_DIR="${board}" -j"$cpu" ${other_args}
51
52 popd
53}
54
55function build_modules() {
56 build_subpath lib/third_party/amlogic/
57 build_subpath lib/third_party/amlogic/audio/util
58 build_subpath lib/third_party/amlogic/audio/samples
59 build_subpath lib/third_party/cadence/xaf-hostless
60}
61
62function build_app() {
63 build_subpath demos/amlogic/
64}
65
66function add_pre_commit_hook() {
67 if [ ! -d .git/hooks ]
68 then
69 return
70 fi
71 if [ -f .git/hooks/pre-commit ]
72 then
73 flag=`awk '{if($0 ~ "AMLOGIC_PRE_COMMIT_HOOK"){print $0}}' .git/hooks/pre-commit`
74 if [ -z "$flag" ]
75 then
76 cp .git/hooks/pre-commit .git/hooks/pre-commit-old
77 cp scripts/amlogic/pre-commit-hook.sh .git/hooks/pre-commit
78 fi
79 else
80 cp scripts/amlogic/pre-commit-hook.sh .git/hooks/pre-commit
81 fi
82}
83
84#add_pre_commit_hook
85#build_modules
86build_app