1 {
2 Copyright (c) 2007-2008, 2013, 2019-2020 by Jonas Maebe
3
4 This unit handles constructing target triples
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 ****************************************************************************
21 }
22 unit triplet;
23
24 {$i fpcdefs.inc}
25
26 interface
27
28 uses
29 globtype;
30
targettripletnull31 function targettriplet(tripletstyle: ttripletstyle): ansistring;
32
33 implementation
34
35 uses
36 globals,systems,
37 cpuinfo,tripletcpu;
38
targettripletnull39 function targettriplet(tripletstyle: ttripletstyle): ansistring;
40 begin
41 { architecture }
42 result:=tripletcpustr(tripletstyle);
43 { vendor and/or OS }
44 if target_info.system in systems_darwin then
45 begin
46 result:=result+'-apple';
47 if target_info.system in systems_macosx then
48 result:=result+'-macosx'+MacOSXVersionMin
49 else
50 result:=result+'-ios'+iPhoneOSVersionMin;
51 end
52 else if target_info.system in (systems_linux+systems_android) then
53 result:=result+'-unknown-linux'
54 else if target_info.system in systems_all_windows then
55 begin
56 { WinCE isn't supported (yet) by llvm, but if/when added this is
57 presumably how they will differentiate it }
58 if target_info.system in systems_windows then
59 result:=result+'-pc';
60 result:=result+'-windows-msvc19'
61 end
62 else if target_info.system in systems_freebsd then
63 result:=result+'-unknown-freebsd'
64 else if target_info.system in systems_openbsd then
65 result:=result+'-unknown-openbsd'
66 else if target_info.system in systems_netbsd then
67 result:=result+'-unknown-netbsd'
68 else if target_info.system in systems_solaris then
69 result:=result+'-sun-solaris2'
70 else if target_info.system in systems_aix then
71 result:=result+'-ibm-aix53'
72 else if target_info.system in [system_i386_haiku] then
73 result:=result+'-unknown-haiku'
74 else if target_info.system in systems_embedded then
75 result:=result+'-none'
76 else
77 result:=result+'-unknown';
78
79 { environment/ABI }
80 if target_info.system in systems_android then
81 result:=result+'-android'
82 else
83 {$ifdef arm}
84 if target_info.abi=abi_eabihf then
85 result:=result+'-gnueabihf'
86 else if target_info.system in systems_embedded then
87 result:=result+'-eabi'
88 else if target_info.abi=abi_eabi then
89 result:=result+'-gnueabi'
90 else
91 {$endif}
92 if target_info.system in systems_embedded then
93 result:=result+'-elf'
94 else if target_info.system in systems_linux then
95 result:=result+'-gnu';
96 end;
97
98
99
100 end.
101
102