#!/bin/sh
# Generates multilib.h.
-# Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
#This file is part of GNU CC.
# The optional fourth argument is a list of multilib directory
# combinations that should not be built.
+# The optional fifth argument is a list of options that should be
+# used whenever building multilib libraries.
+
# The output looks like
# #define MULTILIB_MATCHES "\
# SUBDIRECTORY OPTIONS;\
# genmultilib "m68000/m68020 msoft-float" "m68000 m68020 msoft-float"
# "m68000=mc68000"
# This produces:
-# #define MULTILIB_SELECT "\
-# . !m68000 !mc68000 !m68020 !msoft-float;\
-# m68000 m68000 !m68020 !msoft-float;\
-# m68000 mc60000 !m68020 !msoft-float;\
-# m68020 !m68000 !mc68000 m68020 !msoft-float;\
-# msoft-float !m68000 !mc68000 !m68020 msoft-float;\
-# m68000/msoft-float m68000 !m68020 msoft-float;\
-# m68000/msoft-float mc68000 !m68020 msoft-float;\
-# m68020/msoft-float !m68000 !mc68000 m68020 msoft-float;\
-# "
+# ". !m68000 !mc68000 !m68020 !msoft-float;",
+# "m68000 m68000 !m68020 !msoft-float;",
+# "m68000 mc60000 !m68020 !msoft-float;",
+# "m68020 !m68000 !mc68000 m68020 !msoft-float;",
+# "msoft-float !m68000 !mc68000 !m68020 msoft-float;",
+# "m68000/msoft-float m68000 !m68020 msoft-float;",
+# "m68000/msoft-float mc68000 !m68020 msoft-float;",
+# "m68020/msoft-float !m68000 !mc68000 m68020 msoft-float;",
+#
# The effect is that `gcc -msoft-float' (for example) will append
# msoft-float to the directory name when searching for libraries or
# startup files, and `gcc -m68000 -msoft-float' (for example) will
dirnames=$2
matches=$3
exceptions=$4
+extra=$5
+
+echo "static char *multilib_raw[] = {"
# What we want to do is select all combinations of the sets in
# options. Each combination which includes a set of mutually
done
fi
-# Construct a sed pattern which will add negations based on the
-# matches. The semicolons are easier than getting the shell to accept
-# quoted spaces when expanding a variable.
-matchnegations=
-for i in ${matches}; do
- l=`echo $i | sed -e 's/=.*$//' -e 's/?/=/g'`
- r=`echo $i | sed -e 's/^.*=//' -e 's/?/=/g'`
- matchnegations="${matchnegations} -e s/;!${l};/;!${l};!${r};/"
-done
-
# We need another recursive shell script to correctly handle positive
# matches. If we are invoked as
# genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2"
# ${dirout} is the directory name and ${optout} is the current list of
# options.
if [ "$#" = "0" ]; then
- echo "${dirout} ${optout};\\"
+ echo "\"${dirout} ${optout};\","
else
first=$1
shift
EOF
chmod +x tmpmultilib2
-# We are ready to start output.
-echo '#define MULTILIB_SELECT "\'
-
# Start with the current directory, which includes only negations.
optout=
for set in ${options}; do
done
done
optout=`echo ${optout} | sed -e 's/^ //'`
-if [ -n "${matchnegations}" ]; then
- optout=`echo ";${optout};" | sed -e 's/ /;/g' ${matchnegations} -e 's/^;//' -e 's/;$//' -e 's/;/ /g'`
-fi
-echo ". ${optout};\\"
+echo "\". ${optout};\","
# Work over the list of combinations. We have to translate each one
# to use the directory names rather than the option names, we have to
done
optout=`echo ${optout} | sed -e 's/^ //'`
- # Add any negations of matches.
- if [ -n "${matchnegations}" ]; then
- optout=`echo ";${optout};" | sed -e 's/ /;/g' ${matchnegations} -e 's/^;//' -e 's/;$//' -e 's/;/ /g'`
- fi
-
# Output the line with all appropriate matches.
- dirout="${dirout}" optout="${optout}" ./tmpmultilib2 ${matches}
+ dirout="${dirout}" optout="${optout}" ./tmpmultilib2
done
-rm -f tmpmultilib2
+# Terminate the list of string.
+echo "NULL"
+echo "};"
+
+# Output all of the matches now as option and that is the same as that, with
+# a semicolan trailer. Include all of the normal options as well.
+# Note, the format of the matches is reversed compared
+# to what we want, so switch them around.
+echo ""
+echo "static char *multilib_matches_raw[] = {"
+for match in ${matches}; do
+ l=`echo ${match} | sed -e 's/=.*$//' -e 's/?/=/g'`
+ r=`echo ${match} | sed -e 's/^.*=//' -e 's/?/=/g'`
+ echo "\"${r} ${l};\","
+done
+for set in ${options}; do
+ for opt in `echo ${set} | sed -e 's|/| |'g`; do
+ echo "\"${opt} ${opt};\","
+ done
+done
+echo "NULL"
+echo "};"
-# That's it.
-echo '"'
+# Output the default options now
+echo ""
+echo "static char *multilib_extra = \"${extra}\";"
+rm -f tmpmultilib2
exit 0