3 # RISC-V multilib list generator.
4 # Copyright (C) 2011-2018 Free Software Foundation, Inc.
5 # Contributed by Andrew Waterman (andrew@sifive.com).
7 # This file is part of GCC.
9 # GCC is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3, or (at your option)
14 # GCC is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GCC; see the file COPYING3. If not see
21 # <http://www.gnu.org/licenses/>.
23 # Each argument to this script is of the form
24 # <primary arch>-<abi>-<additional arches>-<extensions>
26 # rv32imafd-ilp32d-rv32g-c,v
27 # means that, in addition to rv32imafd, these configurations can also use the
28 # rv32imafd-ilp32d libraries: rv32imafdc, rv32imafdv, rv32g, rv32gc, rv32gv
30 from __future__
import print_function
34 arches
= collections
.OrderedDict()
35 abis
= collections
.OrderedDict()
39 for cfg
in sys
.argv
[1:]:
40 (arch
, abi
, extra
, ext
) = cfg
.split('-')
43 extra
= list(filter(None, extra
.split(',')))
44 ext
= list(filter(None, ext
.split(',')))
45 alts
= sum([[x
] + [x
+ y
for y
in ext
] for x
in [arch
] + extra
], [])
46 alts
= alts
+ [x
.replace('imafd', 'g') for x
in alts
if 'imafd' in x
]
49 reuse
.append('march.%s/mabi.%s=march.%s/mabi.%s' % (arch
, abi
, alt
, abi
))
50 required
.append('march=%s/mabi=%s' % (arch
, abi
))
52 arch_options
= '/'.join(['march=%s' % x
for x
in arches
.keys()])
53 arch_dirnames
= ' \\\n'.join(arches
.keys())
55 abi_options
= '/'.join(['mabi=%s' % x
for x
in abis
.keys()])
56 abi_dirnames
= ' \\\n'.join(abis
.keys())
58 prog
= sys
.argv
[0].split('/')[-1]
59 print('# This file was generated by %s with the command:' % prog
)
60 print('# %s' % ' '.join(sys
.argv
))
62 print('MULTILIB_OPTIONS = %s %s' % (arch_options
, abi_options
))
63 print('MULTILIB_DIRNAMES = %s %s' % (arch_dirnames
, abi_dirnames
))
64 print('MULTILIB_REQUIRED = %s' % ' \\\n'.join(required
))
65 print('MULTILIB_REUSE = %s' % ' \\\n'.join(reuse
))