diff options
author | John Hodge <tpg@mutabah.net> | 2018-06-02 13:18:41 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-06-02 13:36:45 +0800 |
commit | 020c4401cdf429cdc50a0cadfa0fc56c5dcf7d93 (patch) | |
tree | d1fb8dc958eee7869a64f27eabb77e4dc0babeb6 /src | |
parent | 49cbfd3f9d42207ebd7bd6613dec075c20e61a52 (diff) | |
download | mrust-020c4401cdf429cdc50a0cadfa0fc56c5dcf7d93.tar.gz |
Targets - Add a rough OSX target
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 22 | ||||
-rw-r--r-- | src/trans/target.cpp | 7 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index f3b5a2cc..3ce041c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,13 +28,15 @@ #include "expand/cfg.hpp" -// Hacky default target +// Hacky default target detection +// - Windows (MSVC) #ifdef _MSC_VER # if defined(_WIN64) # define DEFAULT_TARGET_NAME "x86_64-windows-msvc" # else # define DEFAULT_TARGET_NAME "x86-windows-msvc" # endif +// - Linux #elif defined(__linux__) # if defined(__amd64__) # define DEFAULT_TARGET_NAME "x86_64-linux-gnu" @@ -45,18 +47,23 @@ # elif defined(__i386__) # define DEFAULT_TARGET_NAME "i586-linux-gnu" # else -# error "Unable to detect a suitable default target (linux-gnu)" +# warning "Unable to detect a suitable default target (linux-gnu)" # endif +// - MinGW #elif defined(__MINGW32__) # if defined(_WIN64) # define DEFAULT_TARGET_NAME "x86_64-windows-gnu" # else # define DEFAULT_TARGET_NAME "i586-windows-gnu" # endif +// - NetBSD #elif defined(__NetBSD__) # if defined(__amd64__) # define DEFAULT_TARGET_NAME "x86_64-unknown-netbsd" +# else +# warning "Unable to detect a suitable default target (NetBSD)" # endif +// - OpenBSD #elif defined(__OpenBSD__) # if defined(__amd64__) # define DEFAULT_TARGET_NAME "x86_64-unknown-openbsd" @@ -67,10 +74,17 @@ # elif defined(__i386__) # define DEFAULT_TARGET_NAME "i686-unknown-openbsd" # else -# error "Unable to detect a suitable default target (OpenBSD)" +# warning "Unable to detect a suitable default target (OpenBSD)" # endif +// - Apple devices +#elif defined(__APPLE__) +# define DEFAULT_TARGET_NAME "x86_64-apple-macosx" +// - Unknown #else -# error "Unable to detect a suitable default target" +# warning "Unable to detect a suitable default target" +#endif +#ifndef DEFAULT_TARGET_NAME +# define DEFAULT_TARGET_NAME "" #endif int g_debug_indent_level = 0; diff --git a/src/trans/target.cpp b/src/trans/target.cpp index e37de2aa..423665a5 100644 --- a/src/trans/target.cpp +++ b/src/trans/target.cpp @@ -331,6 +331,13 @@ namespace ARCH_ARM64 }; } + else if(target_name == "x86_64-apple-macosx") + { + return TargetSpec { + "unix", "macosx", "gnu", CodegenMode::Gnu11, "x86_64-apple-darwin", + ARCH_X86_64 + }; + } else { ::std::cerr << "Unknown target name '" << target_name << "'" << ::std::endl; |