Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "dumpmachine"/"dumpmachinefull" arguments to get the target machine triplet ("dumpmachinefull" for the full MSVC version). #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions cccl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,48 @@ muffle=
verbose=
shared_index=-1

# "dumpmachine" is a CC command-line argument to show the compiler's host triplet
# "cccl" will follow "clang"'s MSVC "dumpmachine" output
# "dumpmachinefull" is added as well to show the full MSVC version
# Process the "dumpmachine"/"dumpmachinefull" arguments first, if they exist, and exit gracefully
for arg in $@; do
if [[ $arg =~ ^-dumpmachine(full)?$ ]]; then
cl_output_parts=($($prog 2>&1))

msvc="msvc"
if [ "$arg" == "-dumpmachinefull" ]; then
msvc="$msvc${cl_output_parts[6]}"
fi

arch="$(echo ${cl_output_parts[8]} | awk '{print tolower($0)}')"
output="pc-windows-$msvc"
case $arch in

x64)
output="x86_64-$output"
;;

# "file" command, with "libmagic", shows "Intel 80386" for "X86" architecture
x86)
output="i386-$output"
;;

arm64)
output="aarch64-$output"
;;

# "file" command, with "libmagic", shows "ARMv7" for "ARM" architecture
arm)
output="armv7-$output"
;;

esac

echo $output
exit 0
fi
done

processargs()
{
### Run through every option and convert it to the proper MS one
Expand Down