1 #!/usr/bin/env bash 2 3 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here 4 dir=$(dirname "$full_cmd") 5 cmd=${full_cmd##*/} 6 7 if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] 8 then 9 exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" 10 elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] 11 then 12 if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] 13 then 14 echo "BaseTools C Tool binary was not found ($cmd)" 15 echo "You may need to run:" 16 echo " make -C $EDK_TOOLS_PATH/Source/C" 17 else 18 exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" 19 fi 20 elif [ -e "$dir/../../Source/C/bin/$cmd" ] 21 then 22 exec "$dir/../../Source/C/bin/$cmd" "$@" 23 else 24 echo "Unable to find the real '$cmd' to run" 25 echo "This message was printed by" 26 echo " $0" 27 exit 127 28 fi 29 30