#!/bin/bash cd "$(dirname "$(readlink -f "$0")")" script_name=$(basename "$0") #if [ "$0" = "$script_name" ]; then echo "脚本被自身调用,请检查无效路径"; exit 1 ;fi # 显示脚本执行时间 start_time=$(date +%s); trap 'echo "$(print_execution_time $?)"' EXIT # 计算并打印脚本执行时间函数 function print_execution_time { end_time=$(date +%s); execution_time=$((end_time - start_time)); execution_time_formatted=$(date -u -d @$execution_time +"%T") if [ $1 -eq 0 ];then SET_COLOR="\e[32m "; else SET_COLOR="\e[31m error at $(pwd) \n\e[1m"; fi mydir_name="$(d=$(pwd); echo ${d##*/})" echo -e "${SET_COLOR} [$1] 执行时间:$execution_time_formatted ( $mydir_name )\e[0m " } current_project_path=$(pwd) export current_project_name=`echo ${current_project_path##*/}` echo "current_project_path = ${current_project_path}" echo "====================================================build shell start [ ${current_project_name} ]====================================================" pd_complier_type=`../../../complier.sh temp $@` unset LD_LIBRARY_PATH echo "config env ..." if [ -f /home/poweroad/Qt5.14.2/5.14.2/gcc_64/bin/qmake ];then export PATH=/home/poweroad/Qt5.14.2/5.14.2/gcc_64/bin:${PATH} elif [ -f /opt/qt5.14.2/5.14.2/gcc_64/bin/qmake ];then export PATH=/opt/qt5.14.2/5.14.2/gcc_64/bin:${PATH} else echo "please config your qmake tool path!!" exit -1 fi echo $PATH echo "qmake ..." qmake #if [ $# -eq 0 ];then echo "make" # DO NOT ADD -j # make -j4 && find -name "ems_hmi" | xargs ls -t | head -n1 | xargs cp -vt .../../../board_dir/bin/x86_bin pwd if [[ "$1" == "all" ]] || [[ "$1" == "clean" ]];then make clean fi if [[ "$1" != "clean" ]];then make -j4 && date "+%Y-%m-%d %H:%M:%S" && du -sh ../../../board_dir/bin/x86_bin fi #else # echo "not make" #fi echo "====================================================build shell end [ ${current_project_name} ] [${pd_complier_type}]===================================================="