xref: /rockchip-linux_mpp/build/linux/aarch64/make-Makefiles.bash (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1#!/bin/bash
2# Run this from within a bash shell
3
4set +e
5
6MPP_PWD=`pwd`
7MPP_TOP=${MPP_PWD}/../../..
8DEFAULT_TOOLCHAIN=aarch64-linux-gnu-
9
10# toolchain detection
11check_cmd(){
12    "$@" >> /dev/null 2>&1
13}
14check_gcc(){
15    check_cmd ${TOOLCHAIN}gcc -v
16}
17
18source ../opt_proc.sh
19
20if [ -z "${TOOLCHAIN}" ]; then
21    echo "Using system ${DEFAULT_TOOLCHAIN} as toolchain."
22    TOOLCHAIN=$DEFAULT_TOOLCHAIN
23fi
24
25check_gcc
26
27if [ $? -eq 127 ];then
28    echo -e "\e[31m${TOOLCHAIN}gcc is not found!\e[0m"
29    echo -e "Please specify valid toolchain path and it's prefix to variable 'TOOLCHAIN' with argument --toolchain."
30    echo -e "For example:\n \t./make-Makefiles.bin --toolchain /path-to-toolchain/arm-linux-gnueabi-"
31    exit 1
32fi
33
34# generate Makefile
35cmake -DCMAKE_BUILD_TYPE=Release \
36      -DTOOLCHAIN=${TOOLCHAIN} \
37      -DCMAKE_TOOLCHAIN_FILE=./arm.linux.cross.cmake \
38      -G "Unix Makefiles" \
39      ${MPP_TOP}
40
41if [ "${CMAKE_PARALLEL_ENABLE}" = "0" ]; then
42    cmake --build .
43else
44    cmake --build . -j
45fi
46