]> gitweb.factorcode.org Git - factor.git/blob - vm/platform.hpp
vm: rework platform.hpp so that it is no longer necessary to pass -DFACTOR_64 and...
[factor.git] / vm / platform.hpp
1 #if defined(__arm__)
2         #define FACTOR_ARM
3 #elif defined(__amd64__) || defined(__x86_64__)
4         #define FACTOR_AMD64
5         #define FACTOR_64
6 #elif defined(i386) || defined(__i386) || defined(__i386__) || defined(WIN32)
7         #define FACTOR_X86
8 #elif defined(__POWERPC__) || defined(__ppc__) || defined(_ARCH_PPC)
9         #define FACTOR_PPC
10 #else
11         #error "Unsupported architecture"
12 #endif
13
14 #ifdef WIN32
15         #define WINDOWS
16 #endif
17
18 #if defined(WINDOWS)
19         #if defined(WINCE)
20                 #include "os-windows-ce.hpp"
21         #else
22                 #include "os-windows-nt.hpp"
23         #endif
24
25         #include "os-windows.hpp"
26
27         #if defined(FACTOR_AMD64)
28                 #include "os-windows-nt.64.hpp"
29         #elif defined(FACTOR_X86)
30                 #include "os-windows-nt.32.hpp"
31         #endif
32 #else
33         #include "os-unix.hpp"
34
35         #ifdef __APPLE__
36                 #include "os-macosx.hpp"
37                 #include "mach_signal.hpp"
38                 
39                 #ifdef FACTOR_X86
40                         #include "os-macosx-x86.32.hpp"
41                 #elif defined(FACTOR_PPC)
42                         #include "os-macosx-ppc.hpp"
43                 #elif defined(FACTOR_AMD64)
44                         #include "os-macosx-x86.64.hpp"
45                 #else
46                         #error "Unsupported Mac OS X flavor"
47                 #endif
48         #else
49                 #include "os-genunix.hpp"
50
51                 #ifdef __FreeBSD__
52                         #define FACTOR_OS_STRING "freebsd"
53                         #include "os-freebsd.hpp"
54                         
55                         #if defined(FACTOR_X86)
56                                 #include "os-freebsd-x86.32.hpp"
57                         #elif defined(FACTOR_AMD64)
58                                 #include "os-freebsd-x86.64.hpp"
59                         #else
60                                 #error "Unsupported FreeBSD flavor"
61                         #endif
62                 #elif defined(__OpenBSD__)
63                         #define FACTOR_OS_STRING "openbsd"
64
65                         #if defined(FACTOR_X86)
66                                 #include "os-openbsd-x86.32.hpp"
67                         #elif defined(FACTOR_AMD64)
68                                 #include "os-openbsd-x86.64.hpp"
69                         #else
70                                 #error "Unsupported OpenBSD flavor"
71                         #endif
72                 #elif defined(__NetBSD__)
73                         #define FACTOR_OS_STRING "netbsd"
74
75                         #if defined(FACTOR_X86)
76                                 #include "os-netbsd-x86.32.hpp"
77                         #elif defined(FACTOR_AMD64)
78                                 #include "os-netbsd-x86.64.hpp"
79                         #else
80                                 #error "Unsupported NetBSD flavor"
81                         #endif
82
83                         #include "os-netbsd.hpp"
84                 #elif defined(linux)
85                         #define FACTOR_OS_STRING "linux"
86                         #include "os-linux.hpp"
87
88                         #if defined(FACTOR_X86)
89                                 #include "os-linux-x86.32.hpp"
90                         #elif defined(FACTOR_PPC)
91                                 #include "os-linux-ppc.hpp"
92                         #elif defined(FACTOR_ARM)
93                                 #include "os-linux-arm.hpp"
94                         #elif defined(FACTOR_AMD64)
95                                 #include "os-linux-x86.64.hpp"
96                         #else
97                                 #error "Unsupported Linux flavor"
98                         #endif
99                 #elif defined(__SVR4) && defined(sun)
100                         #define FACTOR_OS_STRING "solaris"
101
102                         #if defined(FACTOR_X86)
103                                 #include "os-solaris-x86.32.hpp"
104                         #elif defined(FACTOR_AMD64)
105                                 #include "os-solaris-x86.64.hpp"
106                         #else
107                                 #error "Unsupported Solaris flavor"
108                         #endif
109
110                 #else
111                         #error "Unsupported OS"
112                 #endif
113         #endif
114 #endif
115
116 #if defined(FACTOR_X86)
117         #include "cpu-x86.32.hpp"
118         #include "cpu-x86.hpp"
119 #elif defined(FACTOR_AMD64)
120         #include "cpu-x86.64.hpp"
121         #include "cpu-x86.hpp"
122 #elif defined(FACTOR_PPC)
123         #include "cpu-ppc.hpp"
124 #elif defined(FACTOR_ARM)
125         #include "cpu-arm.hpp"
126 #else
127         #error "Unsupported CPU"
128 #endif