1targetPassed=false 2targetValue="" 3 4declare -i n=0 5nParams=${#params[@]} 6while (("$n" < "$nParams")); do 7 p=${params[n]} 8 v=${params[n + 1]:-} # handle `p` being last one 9 n+=1 10 11 case "$p" in 12 -target) 13 if [ -z "$v" ]; then 14 echo "Error: -target requires an argument" >&2 15 exit 1 16 fi 17 targetPassed=true 18 targetValue=$v 19 # skip parsing the value of -target 20 n+=1 21 ;; 22 --target=*) 23 targetPassed=true 24 targetValue="${p#*=}" 25 ;; 26 esac 27done 28 29if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]] && (( "${NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING:-0}" < 1 )); then 30 echo "Warning: supplying the --target $targetValue != @defaultTarget@ argument to a nix-wrapped compiler may not work correctly - cc-wrapper is currently not designed with multi-target compilers in mind. You may want to use an un-wrapped compiler instead." >&2 31elif [[ $0 != *cpp ]]; then 32 extraBefore+=(-target @defaultTarget@ @machineFlags@) 33 34 if [[ "@explicitAbiValue@" != "" ]]; then 35 extraBefore+=(-mabi=@explicitAbiValue@) 36 fi 37fi