security/nss/coreconf/arch.mk

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:047d9ab8ee87
1 #
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6 #######################################################################
7 # Master "Core Components" macros for getting the OS architecture #
8 # defines these symbols:
9 # 64BIT_TAG
10 # OS_ARCH (from uname -r)
11 # OS_TEST (from uname -m)
12 # OS_RELEASE (from uname -v and/or -r)
13 # OS_TARGET User defined, or set to OS_ARCH
14 # CPU_ARCH (from unmame -m or -p, ONLY on WINNT)
15 # OS_CONFIG OS_TARGET + OS_RELEASE
16 # OBJDIR_TAG
17 # OBJDIR_NAME
18 #######################################################################
19
20 #
21 # Macros for getting the OS architecture
22 #
23
24 ifeq ($(USE_64), 1)
25 64BIT_TAG=_64
26 else
27 64BIT_TAG=
28 endif
29
30 OS_ARCH := $(subst /,_,$(shell uname -s))
31
32 #
33 # Attempt to differentiate between sparc and x86 Solaris
34 #
35
36 OS_TEST := $(shell uname -m)
37 ifeq ($(OS_TEST),i86pc)
38 OS_RELEASE := $(shell uname -r)_$(OS_TEST)
39 else
40 OS_RELEASE := $(shell uname -r)
41 endif
42
43 #
44 # Force the IRIX64 machines to use IRIX.
45 #
46
47 ifeq ($(OS_ARCH),IRIX64)
48 OS_ARCH = IRIX
49 endif
50
51 #
52 # Force the older BSD/OS versions to use the new arch name.
53 #
54
55 ifeq ($(OS_ARCH),BSD_386)
56 OS_ARCH = BSD_OS
57 endif
58
59 #
60 # Catch Deterim if SVR4 is NCR or UNIXWARE
61 #
62
63 ifeq ($(OS_ARCH),UNIX_SV)
64 ifneq ($(findstring NCR, $(shell grep NCR /etc/bcheckrc | head -1 )),)
65 OS_ARCH = NCR
66 else
67 # Make UnixWare something human readable
68 OS_ARCH = UNIXWARE
69 endif
70
71 # Get the OS release number, not 4.2
72 OS_RELEASE := $(shell uname -v)
73 endif
74
75 ifeq ($(OS_ARCH),UNIX_System_V)
76 OS_ARCH = NEC
77 endif
78
79 ifeq ($(OS_ARCH),AIX)
80 OS_RELEASE := $(shell uname -v).$(shell uname -r)
81 endif
82
83 #
84 # Distinguish between OSF1 V4.0B and V4.0D
85 #
86
87 ifeq ($(OS_ARCH)$(OS_RELEASE),OSF1V4.0)
88 OS_VERSION := $(shell uname -v)
89 ifeq ($(OS_VERSION),564)
90 OS_RELEASE := V4.0B
91 endif
92 ifeq ($(OS_VERSION),878)
93 OS_RELEASE := V4.0D
94 endif
95 endif
96
97 #
98 # SINIX changes name to ReliantUNIX with 5.43
99 #
100
101 ifeq ($(OS_ARCH),ReliantUNIX-N)
102 OS_ARCH = ReliantUNIX
103 OS_RELEASE = 5.4
104 endif
105
106 ifeq ($(OS_ARCH),SINIX-N)
107 OS_ARCH = ReliantUNIX
108 OS_RELEASE = 5.4
109 endif
110
111 #
112 # Handle FreeBSD 2.2-STABLE, Linux 2.0.30-osfmach3, and
113 # IRIX 6.5-ALPHA-1289139620.
114 #
115
116 ifeq (,$(filter-out Linux FreeBSD IRIX,$(OS_ARCH)))
117 OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//')
118 endif
119
120 ifeq ($(OS_ARCH),Linux)
121 OS_RELEASE := $(subst ., ,$(OS_RELEASE))
122 ifneq ($(words $(OS_RELEASE)),1)
123 OS_RELEASE := $(word 1,$(OS_RELEASE)).$(word 2,$(OS_RELEASE))
124 endif
125 endif
126
127 #
128 # For OS/2
129 #
130 ifeq ($(OS_ARCH),OS_2)
131 OS_ARCH = OS2
132 OS_RELEASE := $(shell uname -v)
133 endif
134
135 #######################################################################
136 # Master "Core Components" macros for getting the OS target #
137 #######################################################################
138
139 #
140 # Note: OS_TARGET should be specified on the command line for gmake.
141 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
142 # The difference between the Win95 target and the WinNT target is that
143 # the WinNT target uses Windows NT specific features not available
144 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
145 # at lesser performance (the Win95 target uses threads; the WinNT target
146 # uses fibers).
147 #
148 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
149 # cross-compilation, except on Windows, where it defaults to WIN95.
150 #
151
152 #
153 # On WIN32, we also define the variable CPU_ARCH, if it isn't already.
154 #
155 ifndef CPU_ARCH
156 ifeq ($(OS_ARCH), WINNT)
157 CPU_ARCH := $(shell uname -p)
158 ifeq ($(CPU_ARCH),I386)
159 CPU_ARCH = x386
160 endif
161 endif
162 endif
163
164 # If uname -s returns "Windows_NT", we assume that we are using
165 # the uname.exe in MKS toolkit.
166 #
167 # The -r option of MKS uname only returns the major version number.
168 # So we need to use its -v option to get the minor version number.
169 # Moreover, it doesn't have the -p option, so we need to use uname -m.
170 #
171 ifeq ($(OS_ARCH), Windows_NT)
172 OS_ARCH = WINNT
173 OS_MINOR_RELEASE := $(shell uname -v)
174 # strip leading 0
175 OS_MINOR_RELEASE := $(patsubst 0%,%,$(OS_MINOR_RELEASE))
176 OS_RELEASE := $(OS_RELEASE).$(OS_MINOR_RELEASE)
177 ifndef CPU_ARCH
178 CPU_ARCH := $(shell uname -m)
179 #
180 # MKS's uname -m returns "586" on a Pentium machine.
181 #
182 ifneq (,$(findstring 86,$(CPU_ARCH)))
183 CPU_ARCH = x386
184 endif
185 endif
186 endif
187 #
188 # If uname -s returns "CYGWIN_NT-*", we assume that we are using
189 # the uname.exe in the Cygwin tools.
190 #
191 ifeq (CYGWIN_NT,$(findstring CYGWIN_NT,$(OS_ARCH)))
192 OS_RELEASE := $(patsubst CYGWIN_NT-%,%,$(OS_ARCH))
193 OS_ARCH = WINNT
194 ifndef CPU_ARCH
195 ifeq (WOW64,$(findstring WOW64,$(OS_RELEASE)))
196 OS_RELEASE := $(patsubst %-WOW64,%,$(OS_RELEASE))
197 endif
198 CPU_ARCH := $(shell uname -m)
199 #
200 # Cygwin's uname -m returns "i686" on a Pentium Pro machine.
201 #
202 ifneq (,$(findstring 86,$(CPU_ARCH)))
203 CPU_ARCH = x386
204 endif
205 endif
206 endif
207 #
208 # If uname -s returns "MINGW32_NT-*", we assume that we are using
209 # the uname.exe in the MSYS toolkit.
210 #
211 ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH)))
212 OS_RELEASE := $(patsubst MINGW32_NT-%,%,$(OS_ARCH))
213 OS_ARCH = WINNT
214 USE_MSYS = 1
215 ifndef CPU_ARCH
216 CPU_ARCH := $(shell uname -m)
217 #
218 # MSYS's uname -m returns "i686" on a Pentium Pro machine.
219 #
220 ifneq (,$(findstring 86,$(CPU_ARCH)))
221 CPU_ARCH = x386
222 endif
223 endif
224 endif
225
226 ifeq ($(OS_TARGET),Android)
227 #
228 # this should be configurable from the user
229 #
230 OS_TEST := arm
231 OS_ARCH = Android
232 ifndef OS_TARGET_RELEASE
233 OS_TARGET_RELEASE := 8
234 endif
235 endif
236
237 ifndef OS_TARGET
238 ifeq ($(OS_ARCH), WINNT)
239 OS_TARGET = WIN95
240 else
241 OS_TARGET = $(OS_ARCH)
242 endif
243 endif
244
245 ifeq ($(OS_TARGET), WIN95)
246 OS_RELEASE = 4.0
247 endif
248
249 ifdef OS_TARGET_RELEASE
250 OS_RELEASE = $(OS_TARGET_RELEASE)
251 endif
252
253 #
254 # This variable is used to get OS_CONFIG.mk.
255 #
256
257 OS_CONFIG = $(OS_TARGET)$(OS_RELEASE)
258
259 #
260 # OBJDIR_TAG depends on the predefined variable BUILD_OPT,
261 # to distinguish between debug and release builds.
262 #
263
264 ifdef BUILD_OPT
265 OBJDIR_TAG = $(64BIT_TAG)_OPT
266 else
267 ifdef BUILD_IDG
268 OBJDIR_TAG = $(64BIT_TAG)_IDG
269 else
270 OBJDIR_TAG = $(64BIT_TAG)_DBG
271 endif
272 endif
273
274 #
275 # The following flags are defined in the individual $(OS_CONFIG).mk
276 # files.
277 #
278 # CPU_TAG is defined if the CPU is not the most common CPU.
279 # COMPILER_TAG is defined if the compiler is not the default compiler.
280 # IMPL_STRATEGY may be defined too.
281 #
282
283 OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(LIBC_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
284
285 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
286 ifndef BUILD_OPT
287 #
288 # Define USE_DEBUG_RTL if you want to use the debug runtime library
289 # (RTL) in the debug build
290 #
291 ifdef USE_DEBUG_RTL
292 OBJDIR_NAME = $(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJD
293 endif
294 endif
295 endif
296
297 MK_ARCH = included

mercurial