xref: /haiku/headers/os/BeBuild.h (revision 9f3bdf3d039430b5172c424def20ce5d9f7367d4)
1 /*
2  * Copyright 2007-2020, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _BE_BUILD_H
6 #define _BE_BUILD_H
7 
8 
9 #include <config/HaikuConfig.h>
10 
11 
12 #define B_BEOS_VERSION_4				0x0400
13 #define B_BEOS_VERSION_4_5				0x0450
14 #define B_BEOS_VERSION_5				0x0500
15 
16 #define B_BEOS_VERSION					B_BEOS_VERSION_5
17 #define B_BEOS_VERSION_MAUI				B_BEOS_VERSION_5
18 
19 /* Haiku (API) version */
20 #define B_HAIKU_VERSION_BEOS			0x00000001
21 #define B_HAIKU_VERSION_BONE			0x00000002
22 #define B_HAIKU_VERSION_DANO			0x00000003
23 #define B_HAIKU_VERSION_1_ALPHA_1		0x00000100
24 #define B_HAIKU_VERSION_1_PRE_ALPHA_2	0x00000101
25 #define B_HAIKU_VERSION_1_ALPHA_2		0x00000200
26 #define B_HAIKU_VERSION_1_PRE_ALPHA_3	0x00000201
27 #define B_HAIKU_VERSION_1_ALPHA_3		0x00000300
28 #define B_HAIKU_VERSION_1_PRE_ALPHA_4	0x00000301
29 #define B_HAIKU_VERSION_1_ALPHA_4		0x00000400
30 #define B_HAIKU_VERSION_1_PRE_BETA_1	0x00000401
31 #define B_HAIKU_VERSION_1_BETA_1		0x00000500
32 #define B_HAIKU_VERSION_1_PRE_BETA_2	0x00000501
33 #define B_HAIKU_VERSION_1_BETA_2		0x00000600
34 #define B_HAIKU_VERSION_1_PRE_BETA_3	0x00000601
35 #define B_HAIKU_VERSION_1_BETA_3		0x00000700
36 #define B_HAIKU_VERSION_1_PRE_BETA_4	0x00000701
37 #define B_HAIKU_VERSION_1_BETA_4		0x00000800
38 #define B_HAIKU_VERSION_1_PRE_BETA_5	0x00000801
39 #define B_HAIKU_VERSION_1				0x00010000
40 
41 #define B_HAIKU_VERSION					B_HAIKU_VERSION_1_PRE_BETA_5
42 
43 /* Haiku ABI */
44 #define B_HAIKU_ABI_MAJOR				0xffff0000
45 #define B_HAIKU_ABI_GCC_2				0x00020000
46 #define B_HAIKU_ABI_GCC_4				0x00040000
47 
48 #define B_HAIKU_ABI_GCC_2_ANCIENT		0x00020000
49 #define B_HAIKU_ABI_GCC_2_BEOS			0x00020001
50 #define B_HAIKU_ABI_GCC_2_HAIKU			0x00020002
51 
52 #define B_HAIKU_ABI_NAME				__HAIKU_ARCH_ABI
53 
54 #if __GNUC__ == 2
55 #	define B_HAIKU_ABI					B_HAIKU_ABI_GCC_2_HAIKU
56 #elif (__GNUC__ >= 4 && __GNUC__ <= 14) || defined(__TINYC__)
57 #	define B_HAIKU_ABI					B_HAIKU_ABI_GCC_4
58 #else
59 #	error Unsupported compiler!
60 #endif
61 
62 
63 #define B_HAIKU_BITS					__HAIKU_ARCH_BITS
64 #define B_HAIKU_PHYSICAL_BITS			__HAIKU_ARCH_PHYSICAL_BITS
65 
66 #ifdef __HAIKU_ARCH_64_BIT
67 #	define B_HAIKU_64_BIT				1
68 #else
69 #	define B_HAIKU_32_BIT				1
70 #endif
71 
72 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
73 #	define B_HAIKU_PHYSICAL_64_BIT		1
74 #else
75 #	define B_HAIKU_PHYSICAL_32_BIT		1
76 #endif
77 
78 #ifdef __HAIKU_BEOS_COMPATIBLE
79 #	define B_HAIKU_BEOS_COMPATIBLE		1
80 #endif
81 
82 
83 #define _UNUSED(argument) argument
84 #define _PACKED __attribute__((packed))
85 #define _PRINTFLIKE(_format_, _args_) \
86 	__attribute__((format(__printf__, _format_, _args_)))
87 
88 #if __GNUC__ >= 4
89 # define _ALIGNED_BY_ARG(_no_) __attribute__((alloc_align(_no_)))
90 # define _EXPORT __attribute__((visibility("default")))
91 #else
92 # define _ALIGNED_BY_ARG(_no_)
93 # define _EXPORT
94 #endif
95 #define _IMPORT
96 
97 #define B_DEFINE_SYMBOL_VERSION(function, versionedSymbol)	\
98 	__asm__(".symver " function "," versionedSymbol)
99 
100 
101 #ifdef __cplusplus
102 #	define B_DEFINE_WEAK_ALIAS(name, alias_name)	\
103 		extern "C" __typeof(name) alias_name __attribute__((weak, alias(#name)))
104 #else
105 #	define B_DEFINE_WEAK_ALIAS(name, alias_name)	\
106 		__typeof(name) alias_name __attribute__((weak, alias(#name)))
107 #endif
108 
109 
110 #endif	/* _BE_BUILD_H */
111