Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions pkgs/build-support/cc-wrapper/add-clang-cc-cflags-before.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
needsTarget=true
targetPassed=false
targetValue=""

declare -i n=0
Expand All @@ -14,22 +14,20 @@ while (("$n" < "$nParams")); do
echo "Error: -target requires an argument" >&2
exit 1
fi
needsTarget=false
targetPassed=true
targetValue=$v
# skip parsing the value of -target
n+=1
;;
--target=*)
needsTarget=false
targetPassed=true
targetValue="${p#*=}"
;;
esac
done

if ! $needsTarget && [[ "$targetValue" != "@defaultTarget@" ]]; then
if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]]; then
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
fi

if $needsTarget && [[ $0 != *cpp ]]; then
elif [[ $0 != *cpp ]]; then
extraBefore+=(-target @defaultTarget@ @machineFlags@)
fi