]>
Commit | Line | Data |
---|---|---|
8182df0f | 1 | #!/bin/sh |
2 | # Generates multilib.h. | |
711789cc | 3 | # Copyright (C) 1994-2013 Free Software Foundation, Inc. |
8182df0f | 4 | |
f12b58b3 | 5 | #This file is part of GCC. |
8182df0f | 6 | |
f12b58b3 | 7 | #GCC is free software; you can redistribute it and/or modify it under |
8 | #the terms of the GNU General Public License as published by the Free | |
8c4c00c1 | 9 | #Software Foundation; either version 3, or (at your option) any later |
f12b58b3 | 10 | #version. |
8182df0f | 11 | |
f12b58b3 | 12 | #GCC is distributed in the hope that it will be useful, but WITHOUT |
13 | #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | #for more details. | |
8182df0f | 16 | |
17 | #You should have received a copy of the GNU General Public License | |
8c4c00c1 | 18 | #along with GCC; see the file COPYING3. If not see |
19 | #<http://www.gnu.org/licenses/>. | |
8182df0f | 20 | |
21 | # This shell script produces a header file which the gcc driver | |
22 | # program uses to pick which library to use based on the machine | |
23 | # specific options that it is given. | |
24 | ||
25 | # The first argument is a list of sets of options. The elements in | |
26 | # the list are separated by spaces. Within an element, the options | |
d512eff2 | 27 | # are separated by slashes or pipes. No leading dash is used on the |
28 | # options. | |
29 | # Each option in a set separated by slashes is mutually incompatible | |
30 | # with all other options | |
8182df0f | 31 | # in the set. |
d512eff2 | 32 | # Each option in a set separated by pipes will be used for the library |
33 | # compilation and any of the options in the set will be sufficient | |
34 | # for it to be triggered. | |
8182df0f | 35 | |
36 | # The optional second argument is a list of subdirectory names. If | |
37 | # the second argument is non-empty, there must be as many elements in | |
38 | # the second argument as there are options in the first argument. The | |
39 | # elements in the second list are separated by spaces. If the second | |
40 | # argument is empty, the option names will be used as the directory | |
41 | # names. | |
42 | ||
43 | # The optional third argument is a list of options which are | |
44 | # identical. The elements in the list are separated by spaces. Each | |
45 | # element must be of the form OPTION=OPTION. The first OPTION should | |
46 | # appear in the first argument, and the second should be a synonym for | |
3e603e78 | 47 | # it. Question marks are replaced with equal signs in both options. |
8182df0f | 48 | |
31d3a2a1 | 49 | # The optional fourth argument is a list of multilib directory |
50 | # combinations that should not be built. | |
51 | ||
3d97d965 | 52 | # The optional fifth argument is a list of options that should be |
53 | # used whenever building multilib libraries. | |
54 | ||
54518c3b | 55 | # The optional sixth argument is a list of exclusions used internally by |
56 | # the compiler similar to exceptions. The difference being that exclusions | |
57 | # allow matching default options that genmultilib does not know about and | |
58 | # is done at runtime as opposed to being sorted out at compile time. | |
9bccb7a3 | 59 | # Each element in the list is a separate exclusion rule. Each rule is |
60 | # a list of options (sans preceding '-') separated by a '/'. The options | |
54518c3b | 61 | # on the rule are grouped as an AND operation, and all options much match |
62 | # for the rule to exclude a set. Options can be preceded with a '!' to | |
63 | # match a logical NOT. | |
64 | ||
d9799238 | 65 | # The optional seventh argument is a list of OS subdirectory names. |
66 | # The format is either the same as of the second argument, or a set of | |
67 | # mappings. When it is the same as the second argument, it describes | |
68 | # the multilib directories using OS conventions, rather than GCC | |
69 | # conventions. When it is a set of mappings of the form gccdir=osdir, | |
70 | # the left side gives the GCC convention and the right gives the | |
71 | # equivalent OS defined location. If the osdir part begins with a !, | |
72 | # the os directory names are used exclusively. Use the mapping when | |
73 | # there is no one-to-one equivalence between GCC levels and the OS. | |
c954ff02 | 74 | |
cec45616 | 75 | # The optional eighth argument which intends to reduce the effort to write |
76 | # so many MULTILIB_EXCEPTIONS rules. This option defines a series of option | |
77 | # combinations that we actually required. | |
78 | # For some cases, the generated option combinations are far more than what | |
79 | # we need, we have to write a lot of rules to screen out combinations we | |
80 | # don't need. If we missed some rules, the unexpected libraries will be built. | |
81 | # Now with this argument, one can simply give what combinations are needed. | |
82 | # It is pretty straigtforward. | |
83 | # This argument can be used together with MULTILIB_EXCEPTIONS and will take | |
84 | # effect after the MULTILIB_EXCEPTIONS. | |
85 | ||
77adc39e | 86 | # The optional ninth argument is the multiarch name. |
87 | ||
7137cdac | 88 | # The optional tenth argument specifies how to reuse multilib for different |
89 | # option sets. | |
90 | ||
a2770a85 | 91 | # The last option should be "yes" if multilibs are enabled. If it is not |
92 | # "yes", all GCC multilib dir names will be ".". | |
93 | ||
8182df0f | 94 | # The output looks like |
95 | # #define MULTILIB_MATCHES "\ | |
96 | # SUBDIRECTORY OPTIONS;\ | |
97 | # ... | |
98 | # " | |
99 | # The SUBDIRECTORY is the subdirectory to use. The OPTIONS are | |
100 | # multiple options separated by spaces. Each option may start with an | |
101 | # exclamation point. gcc will consider each line in turn. If none of | |
102 | # the options beginning with an exclamation point are present, and all | |
103 | # of the other options are present, that subdirectory will be used. | |
104 | # The order of the subdirectories is such that they can be created in | |
105 | # order; that is, a subdirectory is preceded by all its parents. | |
106 | ||
54518c3b | 107 | # Here is an example (this is from the actual sparc64 case): |
108 | # genmultilib 'm64/m32 mno-app-regs|mcmodel=medany' '64 32 alt' | |
109 | # 'mcmodel?medany=mcmodel?medmid' 'm32/mno-app-regs* m32/mcmodel=*' | |
c954ff02 | 110 | # '' 'm32/!m64/mno-app-regs m32/!m64/mcmodel=medany' |
7137cdac | 111 | # '../lib64 ../lib32 alt' '' '' '' yes |
8182df0f | 112 | # This produces: |
54518c3b | 113 | # ". !m64 !m32 !mno-app-regs !mcmodel=medany;", |
c954ff02 | 114 | # "64:../lib64 m64 !m32 !mno-app-regs !mcmodel=medany;", |
115 | # "32:../lib32 !m64 m32 !mno-app-regs !mcmodel=medany;", | |
54518c3b | 116 | # "alt !m64 !m32 mno-app-regs mcmodel=medany;", |
117 | # "alt !m64 !m32 mno-app-regs !mcmodel=medany;", | |
118 | # "alt !m64 !m32 !mno-app-regs mcmodel=medany;", | |
c954ff02 | 119 | # "64/alt:../lib64/alt m64 !m32 mno-app-regs mcmodel=medany;", |
120 | # "64/alt:../lib64/alt m64 !m32 mno-app-regs !mcmodel=medany;", | |
121 | # "64/alt:../lib64/alt m64 !m32 !mno-app-regs mcmodel=medany;", | |
a23ce4f3 | 122 | # |
54518c3b | 123 | # The effect is that `gcc -mno-app-regs' (for example) will append "alt" |
124 | # to the directory name when searching for libraries or startup files and | |
125 | # `gcc -m32 -mcmodel=medany' (for example) will append "32/alt". Also note | |
126 | # that exclusion above is moot, unless the compiler had a default of -m32, | |
127 | # which would mean that all of the "alt" directories (not the 64/alt ones) | |
128 | # would be ignored (not generated, nor used) since the exclusion also | |
129 | # matches the multilib_default args. | |
8182df0f | 130 | |
131 | # Copy the positional parameters into variables. | |
132 | options=$1 | |
133 | dirnames=$2 | |
134 | matches=$3 | |
31d3a2a1 | 135 | exceptions=$4 |
3d97d965 | 136 | extra=$5 |
54518c3b | 137 | exclusions=$6 |
c954ff02 | 138 | osdirnames=$7 |
cec45616 | 139 | multilib_required=$8 |
77adc39e | 140 | multiarch=$9 |
7137cdac | 141 | multilib_reuse=${10} |
142 | enable_multilib=${11} | |
3d97d965 | 143 | |
e772a198 | 144 | echo "static const char *const multilib_raw[] = {" |
8182df0f | 145 | |
23874c36 | 146 | mkdir tmpmultilib.$$ || exit 1 |
8d3f2406 | 147 | # Use cd ./foo to avoid CDPATH output. |
148 | cd ./tmpmultilib.$$ || exit 1 | |
23874c36 | 149 | |
8182df0f | 150 | # What we want to do is select all combinations of the sets in |
151 | # options. Each combination which includes a set of mutually | |
152 | # exclusive options must then be output multiple times, once for each | |
153 | # item in the set. Selecting combinations is a recursive process. | |
154 | # Since not all versions of sh support functions, we achieve recursion | |
155 | # by creating a temporary shell script which invokes itself. | |
156 | rm -f tmpmultilib | |
157 | cat >tmpmultilib <<\EOF | |
158 | #!/bin/sh | |
159 | # This recursive script basically outputs all combinations of its | |
160 | # input arguments, handling mutually exclusive sets of options by | |
161 | # repetition. When the script is called, ${initial} is the list of | |
162 | # options which should appear before all combinations this will | |
163 | # output. The output looks like a list of subdirectory names with | |
164 | # leading and trailing slashes. | |
165 | if [ "$#" != "0" ]; then | |
166 | first=$1 | |
167 | shift | |
d512eff2 | 168 | case "$first" in |
169 | *\|*) | |
170 | all=${initial}`echo $first | sed -e 's_|_/_'g` | |
171 | first=`echo $first | sed -e 's_|_ _'g` | |
172 | echo ${all}/ | |
173 | initial="${initial}${all}/" ./tmpmultilib $@ | |
174 | ./tmpmultilib $first $@ | grep -v "^${all}" | |
175 | ;; | |
176 | *) | |
177 | for opt in `echo $first | sed -e 's|/| |'g`; do | |
178 | echo ${initial}${opt}/ | |
179 | done | |
180 | ./tmpmultilib $@ | |
181 | for opt in `echo $first | sed -e 's|/| |'g`; do | |
182 | initial="${initial}${opt}/" ./tmpmultilib $@ | |
183 | done | |
184 | esac | |
8182df0f | 185 | fi |
186 | EOF | |
187 | chmod +x tmpmultilib | |
188 | ||
189 | combinations=`initial=/ ./tmpmultilib ${options}` | |
190 | ||
31d3a2a1 | 191 | # If there exceptions, weed them out now |
192 | if [ -n "${exceptions}" ]; then | |
31d3a2a1 | 193 | cat >tmpmultilib2 <<\EOF |
194 | #!/bin/sh | |
195 | # This recursive script weeds out any combination of multilib | |
196 | # switches that should not be generated. The output looks like | |
197 | # a list of subdirectory names with leading and trailing slashes. | |
198 | ||
199 | for opt in $@; do | |
200 | case "$opt" in | |
201 | EOF | |
202 | ||
203 | for except in ${exceptions}; do | |
204 | echo " /${except}/) : ;;" >> tmpmultilib2 | |
205 | done | |
206 | ||
207 | cat >>tmpmultilib2 <<\EOF | |
208 | *) echo ${opt};; | |
209 | esac | |
210 | done | |
211 | EOF | |
212 | chmod +x tmpmultilib2 | |
213 | combinations=`./tmpmultilib2 ${combinations}` | |
31d3a2a1 | 214 | fi |
215 | ||
cec45616 | 216 | # If the MULTILIB_REQUIRED list are provided, |
217 | # filter out combinations not in this list. | |
218 | if [ -n "${multilib_required}" ]; then | |
219 | cat >tmpmultilib2 <<\EOF | |
220 | #!/bin/sh | |
221 | # This recursive script weeds out any combination of multilib | |
222 | # switches that not in the expected list. | |
223 | ||
224 | for opt in $@; do | |
225 | case "$opt" in | |
226 | EOF | |
227 | ||
228 | for expect in ${multilib_required}; do | |
229 | echo " /${expect}/) echo \${opt};;" >> tmpmultilib2 | |
230 | done | |
231 | ||
232 | cat >>tmpmultilib2 <<\EOF | |
233 | *) ;; | |
234 | esac | |
235 | done | |
236 | EOF | |
237 | ||
238 | chmod +x tmpmultilib2 | |
239 | combinations=`./tmpmultilib2 ${combinations}` | |
240 | ||
241 | fi | |
242 | ||
8182df0f | 243 | # Construct a sed pattern which will convert option names to directory |
244 | # names. | |
245 | todirnames= | |
246 | if [ -n "${dirnames}" ]; then | |
247 | set x ${dirnames} | |
248 | shift | |
249 | for set in ${options}; do | |
d512eff2 | 250 | for opts in `echo ${set} | sed -e 's|/| |'g`; do |
251 | patt="/" | |
252 | for opt in `echo ${opts} | sed -e 's_|_ _'g`; do | |
253 | if [ "$1" != "${opt}" ]; then | |
254 | todirnames="${todirnames} -e s|/${opt}/|/${1}/|g" | |
255 | patt="${patt}${1}/" | |
256 | if [ "${patt}" != "/${1}/" ]; then | |
257 | todirnames="${todirnames} -e s|${patt}|/${1}/|g" | |
258 | fi | |
259 | fi | |
260 | done | |
8182df0f | 261 | shift |
262 | done | |
263 | done | |
264 | fi | |
265 | ||
c954ff02 | 266 | # Construct a sed pattern which will convert option names to OS directory |
267 | # names. | |
268 | toosdirnames= | |
d9799238 | 269 | defaultosdirname= |
fc162120 | 270 | defaultosdirname2= |
77adc39e | 271 | if [ -n "${multiarch}" ]; then |
272 | defaultosdirname=::${multiarch} | |
273 | fi | |
c954ff02 | 274 | if [ -n "${osdirnames}" ]; then |
275 | set x ${osdirnames} | |
276 | shift | |
d9799238 | 277 | while [ $# != 0 ] ; do |
278 | case "$1" in | |
279 | .=*) | |
280 | defaultosdirname=`echo $1 | sed 's|^.=|:|'` | |
77adc39e | 281 | if [ -n "${multiarch}" ]; then |
282 | defaultosdirname=${defaultosdirname}:${multiarch} | |
283 | fi | |
fc162120 | 284 | case "$defaultosdirname" in |
285 | ::*) ;; | |
286 | *) | |
287 | defaultosdirname2=${defaultosdirname} | |
288 | defaultosdirname= | |
289 | ;; | |
290 | esac | |
d9799238 | 291 | shift |
292 | ;; | |
293 | *=*) | |
294 | patt=`echo $1 | sed -e 's|=|/$=/|'` | |
295 | toosdirnames="${toosdirnames} -e s=^/${patt}/=" | |
296 | shift | |
297 | ;; | |
298 | *) | |
299 | break | |
300 | ;; | |
301 | esac | |
302 | done | |
303 | ||
304 | if [ $# != 0 ]; then | |
305 | for set in ${options}; do | |
306 | for opts in `echo ${set} | sed -e 's|/| |'g`; do | |
307 | patt="/" | |
308 | for opt in `echo ${opts} | sed -e 's_|_ _'g`; do | |
309 | if [ "$1" != "${opt}" ]; then | |
310 | toosdirnames="${toosdirnames} -e s|/${opt}/|/${1}/|g" | |
311 | patt="${patt}${1}/" | |
312 | if [ "${patt}" != "/${1}/" ]; then | |
313 | toosdirnames="${toosdirnames} -e s|${patt}|/${1}/|g" | |
314 | fi | |
c954ff02 | 315 | fi |
d9799238 | 316 | done |
317 | shift | |
c954ff02 | 318 | done |
c954ff02 | 319 | done |
d9799238 | 320 | fi |
c954ff02 | 321 | fi |
322 | ||
8182df0f | 323 | # We need another recursive shell script to correctly handle positive |
324 | # matches. If we are invoked as | |
325 | # genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2" | |
326 | # we must output | |
327 | # opt1/opt2 opt1 opt2 | |
328 | # opt1/opt2 nopt1 opt2 | |
329 | # opt1/opt2 opt1 nopt2 | |
330 | # opt1/opt2 nopt1 nopt2 | |
331 | # In other words, we must output all combinations of matches. | |
332 | rm -f tmpmultilib2 | |
333 | cat >tmpmultilib2 <<\EOF | |
334 | #!/bin/sh | |
335 | # The positional parameters are a list of matches to consider. | |
336 | # ${dirout} is the directory name and ${optout} is the current list of | |
337 | # options. | |
338 | if [ "$#" = "0" ]; then | |
a23ce4f3 | 339 | echo "\"${dirout} ${optout};\"," |
8182df0f | 340 | else |
341 | first=$1 | |
342 | shift | |
343 | dirout="${dirout}" optout="${optout}" ./tmpmultilib2 $@ | |
3e603e78 | 344 | l=`echo ${first} | sed -e 's/=.*$//' -e 's/?/=/g'` |
345 | r=`echo ${first} | sed -e 's/^.*=//' -e 's/?/=/g'` | |
c779418a | 346 | if expr " ${optout} " : ".* ${l} .*" > /dev/null; then |
8182df0f | 347 | newopt=`echo " ${optout} " | sed -e "s/ ${l} / ${r} /" -e 's/^ //' -e 's/ $//'` |
348 | dirout="${dirout}" optout="${newopt}" ./tmpmultilib2 $@ | |
c779418a | 349 | fi |
8182df0f | 350 | fi |
351 | EOF | |
352 | chmod +x tmpmultilib2 | |
353 | ||
8182df0f | 354 | # Start with the current directory, which includes only negations. |
355 | optout= | |
356 | for set in ${options}; do | |
d512eff2 | 357 | for opt in `echo ${set} | sed -e 's_[/|]_ _g'`; do |
8182df0f | 358 | optout="${optout} !${opt}" |
359 | done | |
360 | done | |
361 | optout=`echo ${optout} | sed -e 's/^ //'` | |
d9799238 | 362 | echo "\".${defaultosdirname} ${optout};\"," |
fc162120 | 363 | [ -n "${defaultosdirname2}" ] && echo "\".${defaultosdirname2} ${optout};\"," |
8182df0f | 364 | |
7137cdac | 365 | # This part of code convert an option combination to |
366 | # its corresponding directory names. | |
367 | # The directory names will be deduced from MULTILIB_DIRNAMES, | |
368 | # MULTILIB_OSDIRNAMES or the option combination itself. | |
369 | rm -rf tmpmultilib3 | |
370 | cat >tmpmultilib3 <<\EOF | |
371 | #!/bin/sh | |
372 | ||
373 | dirout= | |
374 | combo=$1 | |
375 | todirnames=$2 | |
376 | toosdirnames=$3 | |
377 | enable_multilib=$4 | |
378 | ||
379 | if [ -n "${todirnames}" ]; then | |
380 | dirout=`echo ${combo} | sed ${todirnames}` | |
381 | else | |
382 | dirout=`echo ${combo} | sed -e 's/=/-/g'` | |
383 | fi | |
384 | # Remove the leading and trailing slashes. | |
385 | dirout=`echo ${dirout} | sed -e 's|^/||' -e 's|/*:/*|:|' -e 's|/$||g'` | |
386 | ||
387 | # Use the OS directory names rather than the option names. | |
388 | if [ -n "${toosdirnames}" ]; then | |
389 | osdirout=`echo ${combo} | sed ${toosdirnames}` | |
390 | # Remove the leading and trailing slashes. | |
391 | osdirout=`echo ${osdirout} | sed -e 's|^/||' -e 's|/*:/*|:|' -e 's|/$||g'` | |
392 | if [ "x${enable_multilib}" != xyes ]; then | |
393 | dirout=".:${osdirout}" | |
394 | disable_multilib=yes | |
395 | else | |
396 | case "${osdirout}" in | |
397 | !*) | |
398 | dirout=`echo ${osdirout} | sed 's/^!//'` | |
399 | ;; | |
400 | *) | |
401 | dirout="${dirout}:${osdirout}" | |
402 | ;; | |
403 | esac | |
404 | fi | |
405 | else | |
406 | if [ "x${enable_multilib}" != xyes ]; then | |
407 | # genmultilib with --disable-multilib should be | |
408 | # called with '' '' '' '' '' '' '' no | |
409 | # if MULTILIB_OSDIRNAMES is empty. | |
410 | exit 1 | |
411 | fi | |
412 | fi | |
413 | echo "${dirout}" | |
414 | EOF | |
415 | chmod +x tmpmultilib3 | |
416 | ||
417 | # Script to look through the options and output each option that is present, | |
418 | # and negate each option that is not present. | |
419 | rm -rf tmpmultilib4 | |
420 | cat > tmpmultilib4 <<\EOF | |
421 | #!/bin/sh | |
422 | ||
423 | optout= | |
424 | combo=$1 | |
425 | options=$2 | |
426 | ||
427 | for set in ${options}; do | |
428 | setopts=`echo ${set} | sed -e 's_[/|]_ _g'` | |
429 | for opt in ${setopts}; do | |
430 | if expr "${combo} " : ".*/${opt}/.*" > /dev/null; then | |
431 | optout="${optout} ${opt}" | |
432 | else | |
433 | optout="${optout} !${opt}" | |
434 | fi | |
435 | done | |
436 | done | |
437 | optout=`echo ${optout} | sed -e 's/^ //'` | |
438 | echo "${optout}" | |
439 | EOF | |
440 | chmod +x tmpmultilib4 | |
441 | ||
8182df0f | 442 | # Work over the list of combinations. We have to translate each one |
443 | # to use the directory names rather than the option names, we have to | |
444 | # include the information in matches, and we have to generate the | |
445 | # correct list of options and negations. | |
446 | for combo in ${combinations}; do | |
447 | # Use the directory names rather than the option names. | |
7137cdac | 448 | dirout=`./tmpmultilib3 "${combo}" "${todirnames}" "${toosdirnames}" "${enable_multilib}"` |
c954ff02 | 449 | |
8182df0f | 450 | # Look through the options. We must output each option that is |
d57e159c | 451 | # present, and negate each option that is not present. |
7137cdac | 452 | optout=`./tmpmultilib4 "${combo}" "${options}"` |
8182df0f | 453 | |
8182df0f | 454 | # Output the line with all appropriate matches. |
3d97d965 | 455 | dirout="${dirout}" optout="${optout}" ./tmpmultilib2 |
8182df0f | 456 | done |
457 | ||
a23ce4f3 | 458 | # Terminate the list of string. |
459 | echo "NULL" | |
3d97d965 | 460 | echo "};" |
461 | ||
7137cdac | 462 | # Output rules used for multilib reuse. |
463 | echo "" | |
464 | echo "static const char *const multilib_reuse_raw[] = {" | |
465 | for rrule in ${multilib_reuse}; do | |
466 | # The left part of the rule are the options we used to build multilib. | |
467 | # The right part of the rule are the options that can reuse this multilib. | |
468 | combo=`echo ${rrule} | sed -e 's/=.*$//' -e 's/\./=/g'` | |
469 | copts=`echo ${rrule} | sed -e 's/^.*=//' -e 's/\./=/g'` | |
470 | # The variable ${combinations} are the option combinations we will build | |
471 | # multilib from. If the combination in the left part of reuse rule isn't | |
472 | # in this variable, it means no multilib will be built for current reuse | |
473 | # rule. Thus the reuse purpose specified by current rule is meaningless. | |
474 | if expr "${combinations} " : ".*/${combo}/.*" > /dev/null; then | |
475 | combo="/${combo}/" | |
476 | dirout=`./tmpmultilib3 "${combo}" "${todirnames}" "${toosdirnames}" "${enable_multilib}"` | |
477 | copts="/${copts}/" | |
478 | optout=`./tmpmultilib4 "${copts}" "${options}"` | |
479 | # Output the line with all appropriate matches. | |
480 | dirout="${dirout}" optout="${optout}" ./tmpmultilib2 | |
481 | else | |
482 | echo "The rule ${rrule} is trying to reuse nonexistent multilib." | |
483 | exit 1 | |
484 | fi | |
485 | done | |
486 | ||
487 | # Terminate the list of string. | |
488 | echo "NULL" | |
489 | echo "};" | |
490 | ||
3d97d965 | 491 | # Output all of the matches now as option and that is the same as that, with |
68215e49 | 492 | # a semicolon trailer. Include all of the normal options as well. |
3d97d965 | 493 | # Note, the format of the matches is reversed compared |
494 | # to what we want, so switch them around. | |
495 | echo "" | |
e772a198 | 496 | echo "static const char *const multilib_matches_raw[] = {" |
3d97d965 | 497 | for match in ${matches}; do |
498 | l=`echo ${match} | sed -e 's/=.*$//' -e 's/?/=/g'` | |
499 | r=`echo ${match} | sed -e 's/^.*=//' -e 's/?/=/g'` | |
500 | echo "\"${r} ${l};\"," | |
501 | done | |
502 | for set in ${options}; do | |
d512eff2 | 503 | for opt in `echo ${set} | sed -e 's_[/|]_ _'g`; do |
3d97d965 | 504 | echo "\"${opt} ${opt};\"," |
505 | done | |
506 | done | |
507 | echo "NULL" | |
508 | echo "};" | |
8182df0f | 509 | |
3d97d965 | 510 | # Output the default options now |
511 | echo "" | |
e772a198 | 512 | echo "static const char *multilib_extra = \"${extra}\";" |
54518c3b | 513 | |
514 | # Output the exclusion rules now | |
515 | echo "" | |
e772a198 | 516 | echo "static const char *const multilib_exclusions_raw[] = {" |
54518c3b | 517 | for rule in ${exclusions}; do |
518 | s=`echo ${rule} | sed -e 's,/, ,g'` | |
519 | echo "\"${s};\"," | |
520 | done | |
521 | echo "NULL" | |
522 | echo "};" | |
523 | ||
c954ff02 | 524 | # Output the options now |
525 | moptions=`echo ${options} | sed -e 's,[ ][ ]*, ,g'` | |
526 | echo "" | |
527 | echo "static const char *multilib_options = \"${moptions}\";" | |
528 | ||
0a2326d6 | 529 | # Finally output the disable flag if specified |
530 | if [ "x${disable_multilib}" = xyes ]; then | |
531 | echo "" | |
532 | echo "#define DISABLE_MULTILIB 1" | |
533 | fi | |
534 | ||
23874c36 | 535 | cd .. |
536 | rm -r tmpmultilib.$$ | |
8182df0f | 537 | |
538 | exit 0 |