summaryrefslogtreecommitdiff
path: root/tools/common/target_detect.h
blob: ed5f9c00dadea9b5834a6a1a7b9a04c94fe5dfaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * MRustC - Rust Compiler
 * - By John Hodge (Mutabah/thePowersGang)
 *
 * common/target_detect.h
 * - Auto-magical host target detection
 */
#pragma once

// - Windows (MSVC)
#ifdef _MSC_VER
# if defined(_WIN64)
#  define DEFAULT_TARGET_NAME "x86_64-pc-windows-msvc"
# else
#  define DEFAULT_TARGET_NAME "x86-pc-windows-msvc"
# endif
// Solaris/illumos
#elif defined(__sun__)
# if defined(__amd64__)
#  define DEFAULT_TARGET_NAME "x86_64-pc-solaris2.11"
# else
#  warning "Unable to detect a suitable default target (solaris)"
# endif
// - Linux
#elif defined(__linux__)
# if defined(__amd64__)
#  define DEFAULT_TARGET_NAME "x86_64-linux-gnu"
# elif defined(__aarch64__)
#  define DEFAULT_TARGET_NAME "aarch64-linux-gnu"
# elif defined(__arm__)
#  define DEFAULT_TARGET_NAME "arm-linux-gnu"
# elif defined(__i386__)
#  define DEFAULT_TARGET_NAME "i586-linux-gnu"
# elif defined(__m68k__)
#  define DEFAULT_TARGET_NAME "m68k-linux-gnu"
# else
#  warning "Unable to detect a suitable default target (linux-gnu)"
# endif
// - MinGW
#elif defined(__MINGW32__)
# if defined(_WIN64)
#  define DEFAULT_TARGET_NAME "x86_64-pc-windows-gnu"
# else
#  define DEFAULT_TARGET_NAME "i586-pc-windows-gnu"
# endif
// - FreeBSD
#elif defined(__FreeBSD__)
# if defined(__amd64__)
#  define DEFAULT_TARGET_NAME "x86_64-unknown-freebsd"
# elif defined(__aarch64__)
#  define DEFAULT_TARGET_NAME "aarch64-unknown-freebsd"
# elif defined(__arm__)
#  define DEFAULT_TARGET_NAME "arm-unknown-freebsd"
# elif defined(__i386__)
#  define DEFAULT_TARGET_NAME "i686-unknown-freebsd"
# else
#  warning "Unable to detect a suitable default target (FreeBSD)"
# 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"
# elif defined(__aarch64__)
#  define DEFAULT_TARGET_NAME "aarch64-unknown-openbsd"
# elif defined(__arm__)
#  define DEFAULT_TARGET_NAME "arm-unknown-openbsd"
# elif defined(__i386__)
#  define DEFAULT_TARGET_NAME "i686-unknown-openbsd"
# else
#  warning "Unable to detect a suitable default target (OpenBSD)"
# endif
// - DragonFly
#elif defined(__DragonFly__)
# define DEFAULT_TARGET_NAME "x86_64-unknown-dragonfly"
// - Apple devices
#elif defined(__APPLE__)
# define DEFAULT_TARGET_NAME "x86_64-apple-macosx"
// - Haiku
#elif defined(__HAIKU__)
# if defined(__x86_64__)
# define DEFAULT_TARGET_NAME "x86_64-unknown-haiku"
# elif defined(__arm__)
# define DEFAULT_TARGET_NAME "arm-unknown-haiku"
# else
#  warning "Unable to detect a suitable default target (Haiku)"
# endif
// - Unknown
#else
# warning "Unable to detect a suitable default target"
#endif
#ifndef DEFAULT_TARGET_NAME
# define DEFAULT_TARGET_NAME	""
#endif