diff options
author | obrien <obrien@FreeBSD.org> | 1999-10-03 09:19:40 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-10-03 09:19:40 +0000 |
commit | aa3f6dfa3a994a96f224c10d1e4959d46572798b (patch) | |
tree | 3f80bab5339d1a088b8a0f3e3375388e3ed67339 /contrib/gcc/genmultilib | |
parent | cef7d41dd55d3c9e0035ecf9b62ecbc51f25cfe9 (diff) | |
download | FreeBSD-src-aa3f6dfa3a994a96f224c10d1e4959d46572798b.zip FreeBSD-src-aa3f6dfa3a994a96f224c10d1e4959d46572798b.tar.gz |
Virgin import of EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/genmultilib')
-rw-r--r-- | contrib/gcc/genmultilib | 114 |
1 files changed, 76 insertions, 38 deletions
diff --git a/contrib/gcc/genmultilib b/contrib/gcc/genmultilib index d4cc7ff..0220696 100644 --- a/contrib/gcc/genmultilib +++ b/contrib/gcc/genmultilib @@ -1,6 +1,6 @@ #!/bin/sh # Generates multilib.h. -# Copyright (C) 1994, 1995 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. #This file is part of GNU CC. @@ -42,6 +42,12 @@ # appear in the first argument, and the second should be a synonym for # it. Question marks are replaced with equal signs in both options. +# 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;\ @@ -59,16 +65,15 @@ # 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 @@ -78,6 +83,10 @@ options=$1 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 @@ -112,6 +121,33 @@ combinations=`initial=/ ./tmpmultilib ${options}` rm -f tmpmultilib +# If there exceptions, weed them out now +if [ -n "${exceptions}" ]; then + rm -f tmpmultilib2 + cat >tmpmultilib2 <<\EOF +#!/bin/sh +# This recursive script weeds out any combination of multilib +# switches that should not be generated. The output looks like +# a list of subdirectory names with leading and trailing slashes. + + for opt in $@; do + case "$opt" in +EOF + + for except in ${exceptions}; do + echo " /${except}/) : ;;" >> tmpmultilib2 + done + +cat >>tmpmultilib2 <<\EOF + *) echo ${opt};; + esac + done +EOF + chmod +x tmpmultilib2 + combinations=`./tmpmultilib2 ${combinations}` + rm -f ./tmpmultilib2 +fi + # Construct a sed pattern which will convert option names to directory # names. todirnames= @@ -128,16 +164,6 @@ if [ -n "${dirnames}" ]; then 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" @@ -154,7 +180,7 @@ cat >tmpmultilib2 <<\EOF # ${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 @@ -169,9 +195,6 @@ fi 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 @@ -180,10 +203,7 @@ 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 @@ -214,18 +234,36 @@ for combo in ${combinations}; do 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 "};" -# That's it. -echo '"' +# Output all of the matches now as option and that is the same as that, with +# a semicolon 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 "};" + +# Output the default options now +echo "" +echo "static char *multilib_extra = \"${extra}\";" +rm -f tmpmultilib2 exit 0 |