1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7if CONFIG['OS_ARCH'] == 'Darwin':
8    SOURCES += [
9        'xptcinvoke_darwin.cpp',
10        'xptcstubs_darwin.cpp',
11    ]
12    if CONFIG['OS_TEST'] == 'powerpc':
13        SOURCES += [
14            '!xptcstubs_asm_ppc_darwin.s',
15            'xptcinvoke_asm_ppc_rhapsody.s',
16        ]
17    if '86' in CONFIG['OS_TEST'] and CONFIG['OS_TEST'] != 'x86_64':
18        DEFINES['MOZ_NEED_LEADING_UNDERSCORE'] = True
19
20if CONFIG['OS_ARCH'] == 'GNU':
21    if CONFIG['CPU_ARCH'] == 'x86':
22        SOURCES += [
23            'xptcinvoke_gcc_x86_unix.cpp',
24            'xptcstubs_gcc_x86_unix.cpp'
25        ]
26
27if CONFIG['OS_ARCH'] in ('Linux', 'Bitrig', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD') or \
28   CONFIG['OS_ARCH'].startswith('GNU_'):
29    if CONFIG['OS_TEST'] == 'x86_64':
30        SOURCES += [
31            'xptcinvoke_x86_64_unix.cpp',
32            'xptcstubs_x86_64_linux.cpp',
33        ]
34    elif '86' in CONFIG['OS_TEST']:
35        SOURCES += [
36            'xptcinvoke_gcc_x86_unix.cpp',
37            'xptcstubs_gcc_x86_unix.cpp'
38        ]
39
40if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):
41    if 'ia64' in CONFIG['OS_TEST']:
42        SOURCES += [
43            'xptcinvoke_asm_ipf64.s',
44            'xptcinvoke_ipf64.cpp',
45            'xptcstubs_asm_ipf64.s',
46            'xptcstubs_ipf64.cpp'
47        ]
48
49if CONFIG['OS_ARCH'] == 'SunOS' and '86' in CONFIG['OS_TEST']:
50    GENERATED_FILES = [
51        'xptcstubsdef_asm.solx86',
52    ]
53    if CONFIG['OS_TEST'] == 'x86_64':
54        if CONFIG['GNU_CC']:
55            SOURCES += [
56                'xptcinvoke_x86_64_unix.cpp',
57                'xptcstubs_x86_64_linux.cpp'
58            ]
59        else:
60            ASFLAGS += ['-xarch=amd64']
61            SOURCES += [
62                'xptcinvoke_x86_64_solaris.cpp',
63                'xptcstubs_asm_x86_64_solaris_SUNW.s',
64                'xptcstubs_x86_64_solaris.cpp',
65            ]
66    else:
67        if CONFIG['GNU_CC']:
68            SOURCES += [
69                'xptcinvoke_gcc_x86_unix.cpp',
70                'xptcstubs_gcc_x86_unix.cpp'
71            ]
72        else:
73            SOURCES += [
74                'xptcinvoke_asm_x86_solaris_SUNW.s',
75                'xptcinvoke_x86_solaris.cpp',
76                'xptcstubs_asm_x86_solaris_SUNW.s',
77                'xptcstubs_x86_solaris.cpp'
78            ]
79
80if CONFIG['OS_TEST'] == 'alpha':
81    if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD'):
82        SOURCES += [
83            'xptcinvoke_linux_alpha.cpp',
84            'xptcstubs_linux_alpha.cpp',
85        ]
86    elif CONFIG['OS_ARCH'] == 'OpenBSD':
87        SOURCES += [
88            'xptcinvoke_alpha_openbsd.cpp',
89            'xptcstubs_alpha_openbsd.cpp',
90        ]
91
92if CONFIG['CPU_ARCH'] == 'arm' or CONFIG['OS_TEST'] == 'sa110':
93    if CONFIG['OS_ARCH'] == 'Linux':
94        SOURCES += [
95            'xptcinvoke_arm.cpp',
96            'xptcstubs_arm.cpp'
97        ]
98        CXXFLAGS += ['-O2']
99    elif CONFIG['OS_ARCH'] == 'NetBSD':
100        SOURCES += [
101            'xptcinvoke_arm_netbsd.cpp',
102            'xptcstubs_arm_netbsd.cpp',
103        ]
104
105if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['OS_ARCH'] in ('Bitrig', 'OpenBSD'):
106    SOURCES += [
107        'xptcinvoke_arm_openbsd.cpp',
108        'xptcstubs_arm_openbsd.cpp',
109    ]
110
111if CONFIG['OS_ARCH'] == 'HP-UX':
112    if CONFIG['CC'] != 'gcc':
113        if CONFIG['OS_TEST'] == 'ia64':
114            SOURCES += [
115                'xptcinvoke_asm_ipf32.s',
116                'xptcinvoke_ipf32.cpp',
117                'xptcstubs_asm_ipf32.s',
118                'xptcstubs_ipf32.cpp',
119            ]
120        else:
121            SOURCES += [
122                'xptcinvoke_asm_pa32.s',
123                'xptcinvoke_pa32.cpp',
124                'xptcstubs_asm_pa32.s',
125                'xptcstubs_pa32.cpp'
126            ]
127
128if CONFIG['OS_ARCH'] == 'Linux':
129    if CONFIG['OS_TEST'] in ('hppa', 'hppa2.0', 'hppa1.1'):
130        if CONFIG['GNU_CXX']:
131            SOURCES += [
132                'xptcinvoke_asm_parisc_linux.s',
133                'xptcinvoke_pa32.cpp',
134                'xptcstubs_asm_parisc_linux.s',
135                'xptcstubs_pa32.cpp',
136            ]
137        elif CONFIG['COMPILE_ENVIRONMENT']:
138            error('Unknown C++ compiler, xptcall assembly will probably be incorrect.')
139
140if CONFIG['OS_ARCH'] == 'NetBSD':
141    if CONFIG['OS_TEST'] in ('amiga', 'atari', 'hp300', 'mac68k', 'mvme68k',
142                             'next68k', 'sun3', 'sun3x', 'x68k'):
143        SOURCES += [
144            'xptcinvoke_netbsd_m68k.cpp',
145            'xptcstubs_netbsd_m68k.cpp'
146        ]
147
148if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD', 'OpenBSD'):
149    if CONFIG['OS_TEST'] == 'aarch64':
150        SOURCES += [
151            'xptcinvoke_aarch64.cpp',
152            'xptcinvoke_asm_aarch64.s',
153            'xptcstubs_aarch64.cpp',
154            'xptcstubs_asm_aarch64.s',
155        ]
156    if CONFIG['OS_TEST'] == 'm68k':
157        SOURCES += [
158            'xptcinvoke_linux_m68k.cpp',
159            'xptcstubs_linux_m68k.cpp',
160        ]
161    if 'mips' in CONFIG['OS_TEST']:
162        if 'mips64' in CONFIG['OS_TEST']:
163            SOURCES += [
164                'xptcinvoke_asm_mips64.S',
165                'xptcinvoke_mips64.cpp',
166                'xptcstubs_asm_mips64.S',
167                'xptcstubs_mips64.cpp',
168            ]
169        else:
170            SOURCES += [
171                'xptcinvoke_asm_mips.S',
172                'xptcinvoke_mips.cpp',
173                'xptcstubs_asm_mips.S',
174                'xptcstubs_mips.cpp',
175            ]
176
177if CONFIG['OS_ARCH'] == 'AIX':
178    if CONFIG['HAVE_64BIT_BUILD']:
179        SOURCES += [
180            '!xptcstubs_asm_ppc_aix64.s',
181            'xptcinvoke_asm_ppc_aix64.s',
182            'xptcinvoke_ppc_aix64.cpp',
183            'xptcstubs_ppc_aix64.cpp',
184        ]
185    else:
186        SOURCES += [
187            '!xptcstubs_asm_ppc_aix.s',
188            'xptcinvoke_ppc_aix.cpp',
189            'xptcstubs_ppc_aix.cpp',
190        ]
191        if CONFIG['AIX_OBJMODEL'] == 'ibm':
192            SOURCES += [
193                'xptcinvoke_asm_ppc_ibmobj_aix.s',
194            ]
195        else:
196            SOURCES += [
197                'xptcinvoke_asm_ppc_aix.s',
198            ]
199
200if CONFIG['OS_TEST'] == 'powerpc':
201    if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):
202        SOURCES += [
203            'xptcinvoke_asm_ppc_linux.S',
204            'xptcinvoke_ppc_linux.cpp',
205            'xptcstubs_asm_ppc_linux.S',
206            'xptcstubs_ppc_linux.cpp',
207        ]
208
209if CONFIG['OS_TEST'] in ('powerpc64', 'powerpc64le'):
210    if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):
211          SOURCES += [
212              'xptcinvoke_asm_ppc64_linux.S',
213              'xptcinvoke_ppc64_linux.cpp',
214              'xptcstubs_asm_ppc64_linux.S',
215              'xptcstubs_ppc64_linux.cpp',
216          ]
217
218if CONFIG['OS_TEST'] in ('macppc', 'bebox', 'ofppc', 'prep', 'amigappc'):
219    if CONFIG['OS_ARCH'] == 'NetBSD':
220        SOURCES += [
221            'xptcinvoke_asm_ppc_netbsd.s',
222            'xptcinvoke_ppc_netbsd.cpp',
223            'xptcstubs_asm_ppc_netbsd.s',
224            'xptcstubs_ppc_netbsd.cpp',
225        ]
226
227if CONFIG['OS_ARCH'] == 'OpenBSD' and CONFIG['OS_TEST'] == 'powerpc':
228    SOURCES += [
229        'xptcinvoke_asm_ppc_openbsd.S',
230        'xptcinvoke_ppc_openbsd.cpp',
231        'xptcstubs_asm_ppc_openbsd.S',
232        'xptcstubs_ppc_openbsd.cpp',
233    ]
234
235if CONFIG['OS_ARCH'] == 'Linux' and 'sparc' in CONFIG['OS_TEST']:
236    SOURCES += [
237        'xptcinvoke_asm_sparc_linux_GCC3.s',
238        'xptcinvoke_sparc_solaris.cpp',
239        'xptcstubs_asm_sparc_solaris.s',
240        'xptcstubs_sparc_solaris.cpp',
241    ]
242
243if CONFIG['OS_ARCH'] == 'NetBSD' and CONFIG['OS_TEST'] == 'sparc':
244    SOURCES += [
245        'xptcinvoke_asm_sparc_netbsd.s',
246        'xptcinvoke_sparc_netbsd.cpp',
247        'xptcstubs_asm_sparc_netbsd.s',
248        'xptcstubs_sparc_netbsd.cpp',
249    ]
250
251if CONFIG['OS_ARCH'] == 'OpenBSD' and CONFIG['OS_TEST'] == 'sparc':
252    SOURCES += [
253        'xptcinvoke_asm_sparc_openbsd.s',
254        'xptcinvoke_sparc_openbsd.cpp',
255        'xptcstubs_asm_sparc_openbsd.s',
256        'xptcstubs_sparc_openbsd.cpp',
257    ]
258
259if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD') and CONFIG['OS_TEST'] == 'sparc64':
260    SOURCES += [
261        'xptcinvoke_asm_sparc64_openbsd.s',
262        'xptcinvoke_sparc64_openbsd.cpp',
263        'xptcstubs_asm_sparc64_openbsd.s',
264        'xptcstubs_sparc64_openbsd.cpp',
265    ]
266
267if CONFIG['OS_ARCH'] == 'SunOS' and '86' not in CONFIG['OS_TEST']:
268    if CONFIG['HAVE_64BIT_BUILD']:
269        ASFLAGS += ['-xarch=v9']
270        SOURCES += [
271            'xptcinvoke_sparcv9_solaris.cpp',
272            'xptcstubs_sparcv9_solaris.cpp',
273        ]
274    else:
275        SOURCES += [
276            'xptcinvoke_sparc_solaris.cpp',
277            'xptcstubs_sparc_solaris.cpp',
278        ]
279    if CONFIG['GNU_CC']:
280        SOURCES += [
281            'xptcinvoke_asm_sparc_solaris_GCC3.s',
282            'xptcstubs_asm_sparc_solaris.s',
283        ]
284    else:
285        if CONFIG['HAVE_64BIT_BUILD']:
286            SOURCES += [
287                'xptcinvoke_asm_sparcv9_solaris_SUNW.s',
288                'xptcstubs_asm_sparcv9_solaris.s',
289            ]
290        else:
291            SOURCES += [
292                'xptcinvoke_asm_sparc_solaris_SUNW.s',
293                'xptcstubs_asm_sparc_solaris.s',
294            ]
295
296if CONFIG['OS_ARCH'] == 'Linux':
297    if CONFIG['OS_TEST'] == 's390':
298        SOURCES += [
299            'xptcinvoke_linux_s390.cpp',
300            'xptcstubs_linux_s390.cpp',
301        ]
302        CXXFLAGS += [
303            '-fno-strict-aliasing',
304            '-fno-inline',
305            '-fomit-frame-pointer',
306            '-mbackchain',
307        ]
308    elif CONFIG['OS_TEST'] == 's390x':
309        SOURCES += [
310            'xptcinvoke_linux_s390x.cpp',
311            'xptcstubs_linux_s390x.cpp',
312        ]
313        CXXFLAGS += [
314            '-fno-strict-aliasing',
315            '-fno-inline',
316            '-fomit-frame-pointer',
317            '-mbackchain',
318        ]
319
320FINAL_LIBRARY = 'xul'
321
322LOCAL_INCLUDES += [
323    '../..',
324    '/xpcom/reflect/xptinfo',
325]
326
327NO_PGO = True
328