mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 20:32:21 +08:00
+template dies an ugly death.
This commit is contained in:
212
configure
vendored
212
configure
vendored
@ -30,6 +30,8 @@
|
|||||||
# config.status is removed.
|
# config.status is removed.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
remove=rm
|
remove=rm
|
||||||
hard_link=ln
|
hard_link=ln
|
||||||
symbolic_link='ln -s'
|
symbolic_link='ln -s'
|
||||||
@ -60,9 +62,17 @@ targets=
|
|||||||
commontargets=
|
commontargets=
|
||||||
configdirs=
|
configdirs=
|
||||||
targetsubdir=
|
targetsubdir=
|
||||||
template=
|
|
||||||
verbose=
|
verbose=
|
||||||
|
|
||||||
|
#if [ "$0" != "./configure" ] ; then
|
||||||
|
# exec ./configure $*
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#if [ ! -f ./config.sub ] ; then
|
||||||
|
# echo '***' Can not find config.sub.
|
||||||
|
# exit 1
|
||||||
|
#fi
|
||||||
|
|
||||||
for arg in $*;
|
for arg in $*;
|
||||||
do
|
do
|
||||||
case ${arg} in
|
case ${arg} in
|
||||||
@ -110,9 +120,6 @@ do
|
|||||||
newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
|
newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
|
||||||
targets="${newtargets}"
|
targets="${newtargets}"
|
||||||
;;
|
;;
|
||||||
-template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
|
|
||||||
template=`echo ${arg} | sed 's/[+-]template=//'`
|
|
||||||
;;
|
|
||||||
-v | -verbose | +v*)
|
-v | -verbose | +v*)
|
||||||
verbose=${arg}
|
verbose=${arg}
|
||||||
;;
|
;;
|
||||||
@ -137,8 +144,8 @@ if [ -n "${verbose}" ] ; then
|
|||||||
echo `pwd`/configure $*
|
echo `pwd`/configure $*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# process host and target only if not rebuilding configure itself or removing.
|
# process host and target only if not removing.
|
||||||
if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
|
if [ -z "${removing}" -a -z "${fatal}" ] ; then
|
||||||
# Complain if an arg is missing
|
# Complain if an arg is missing
|
||||||
if [ -z "${hosts}" ] ; then
|
if [ -z "${hosts}" ] ; then
|
||||||
(echo ;
|
(echo ;
|
||||||
@ -162,7 +169,6 @@ if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
|
|||||||
echo " +norecursion configure this directory only. [recurse]" ;
|
echo " +norecursion configure this directory only. [recurse]" ;
|
||||||
echo " +rm remove this configuration. [build a configuration]" ;
|
echo " +rm remove this configuration. [build a configuration]" ;
|
||||||
echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
|
echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ;
|
||||||
echo " +template=TEM rebuild configure using TEM. [normal config]" ;
|
|
||||||
echo ;
|
echo ;
|
||||||
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
|
echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
|
||||||
echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
|
echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ;
|
||||||
@ -175,137 +181,42 @@ if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#### configure.in common parts come in here.
|
### break up configure.in.
|
||||||
# This file is a shell script fragment that supplies the information
|
if [ -r configure.in ] ; then
|
||||||
# necessary to tailor a template configure script into the configure
|
if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
|
||||||
# script appropriate for this directory. For more information, check
|
echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
|
||||||
# any existing configure script.
|
|
||||||
|
|
||||||
configdirs="libiberty bfd binutils bison gcc readline ld gas gnulib ${clib} gdb emacs make grep diff rcs gdbm cvs prms"
|
|
||||||
srctrigger=README.configure
|
|
||||||
srcname="gnu development package"
|
|
||||||
|
|
||||||
## end of common part.
|
|
||||||
|
|
||||||
# are we rebuilding config itself?
|
|
||||||
if [ -n "${template}" ] ; then
|
|
||||||
if [ ! -r ${template} ] ; then
|
|
||||||
echo '***' "Can't find template ${template}." 1>&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prep the template
|
if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
|
||||||
sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
|
echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
|
||||||
#### configure.in common parts come in here.\
|
exit 1
|
||||||
## end of common part.' \
|
fi
|
||||||
-e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
|
|
||||||
#### configure.in per-host parts come in here.\
|
|
||||||
## end of per-host part.' \
|
|
||||||
-e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
|
|
||||||
#### configure.in per-target parts come in here.\
|
|
||||||
## end of per-target part.' \
|
|
||||||
-e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
|
|
||||||
#### configure.in post-target parts come in here.\
|
|
||||||
## end of post-target part.' \
|
|
||||||
< ${template} > template.new
|
|
||||||
|
|
||||||
if [ -r configure.in ] ; then
|
# split configure.in into common, per-host, per-target,
|
||||||
if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
|
# and post-target parts. Post-target is optional.
|
||||||
echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
|
sed -e '/^# per\-host:/,$d' configure.in > configure.com
|
||||||
exit 1
|
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
|
||||||
fi
|
if grep -s '^# post-target:' configure.in ; then
|
||||||
|
sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
|
||||||
if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
|
sed -e '1,/^# post\-target:/d' configure.in > configure.pos
|
||||||
echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# split configure.in into common, per-host, per-target,
|
|
||||||
# and post-target parts. Post-target is optional.
|
|
||||||
sed -e '/^# per\-host:/,$d' configure.in > configure.com
|
|
||||||
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
|
|
||||||
if grep -s '^# post-target:' configure.in ; then
|
|
||||||
sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
|
|
||||||
sed -e '1,/^# post\-target:/d' configure.in > configure.pos
|
|
||||||
else
|
|
||||||
sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
|
|
||||||
echo >configure.pos
|
|
||||||
fi
|
|
||||||
|
|
||||||
# and insert them
|
|
||||||
sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \
|
|
||||||
-e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \
|
|
||||||
-e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \
|
|
||||||
-e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \
|
|
||||||
template.new > configure.new
|
|
||||||
|
|
||||||
rm -f configure.com configure.tgt configure.hst configure.pos
|
|
||||||
else
|
else
|
||||||
echo Warning: no configure.in in `pwd`
|
sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
|
||||||
cat ${template} >> configure
|
echo >configure.pos
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod a+x configure.new
|
else
|
||||||
rm template.new
|
echo '***' No configure.in in `pwd`
|
||||||
# mv configure configure.old
|
exit 1
|
||||||
mv configure.new configure
|
|
||||||
|
|
||||||
if [ -n "${verbose}" ] ; then
|
|
||||||
echo Rebuilt configure in `pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Now update config.sub from the template directory.
|
|
||||||
if echo "$template" | grep -s 'configure$' ; then
|
|
||||||
cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
|
|
||||||
# mv config.sub config.sub.old
|
|
||||||
mv config.sub.new config.sub
|
|
||||||
|
|
||||||
if [ -n "${verbose}" ] ; then
|
|
||||||
echo Rebuilt config.sub in `pwd`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${norecursion}" ] ; then
|
|
||||||
# If template is relative path, make it absolute for recurring.
|
|
||||||
if echo "${template}" | grep -s '^/' ; then
|
|
||||||
true
|
|
||||||
else
|
|
||||||
template=`pwd`/${template}
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [ -n "${configdirs}" ] ; do
|
|
||||||
# set configdir to car of configdirs, configdirs to cdr of configdirs
|
|
||||||
set ${configdirs}; configdir=$1; shift; configdirs=$*
|
|
||||||
|
|
||||||
if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
|
|
||||||
targetspecificdirs=${configdir}.*
|
|
||||||
else
|
|
||||||
targetspecificdirs=
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i in ${configdir} ${targetspecificdirs} ; do
|
|
||||||
if [ -d $i ] ; then
|
|
||||||
if [ -r $i/configure ] ; then
|
|
||||||
(cd $i ;
|
|
||||||
./configure +template=${template} ${verbose})
|
|
||||||
else
|
|
||||||
echo Warning: No configure script in `pwd`/$i
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ -n "${verbose}" ] ; then
|
|
||||||
echo Warning: directory $i is missing.
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### do common part of configure.in
|
||||||
|
|
||||||
|
. ./configure.com
|
||||||
|
|
||||||
# some sanity checks on configure.in
|
# some sanity checks on configure.in
|
||||||
if [ -z "${srctrigger}" ] ; then
|
if [ -z "${srctrigger}" ] ; then
|
||||||
echo Warning: srctrigger not set in configure.in. `pwd` not configured.
|
echo '***' srctrigger not set in `pwd`/configure.in.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -325,15 +236,7 @@ for host in ${hosts} ; do
|
|||||||
host=${host_cpu}-${host_vendor}-${host_os}
|
host=${host_cpu}-${host_vendor}-${host_os}
|
||||||
host_makefile_frag=config/hmake-${host}
|
host_makefile_frag=config/hmake-${host}
|
||||||
|
|
||||||
#### configure.in per-host parts come in here.
|
. ./configure.hst
|
||||||
|
|
||||||
# XXX - FIXME there needs to be a case for hmake-dgux
|
|
||||||
|
|
||||||
case "${host_os}" in
|
|
||||||
sysv* | irix*) host_makefile_frag=config/hmake-sysv ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
## end of per-host part.
|
|
||||||
|
|
||||||
for target in ${targets} ; do
|
for target in ${targets} ; do
|
||||||
|
|
||||||
@ -345,16 +248,7 @@ esac
|
|||||||
target=${target_cpu}-${target_vendor}-${target_os}
|
target=${target_cpu}-${target_vendor}-${target_os}
|
||||||
target_makefile_frag=config/tmake-${target}
|
target_makefile_frag=config/tmake-${target}
|
||||||
|
|
||||||
#### configure.in per-target parts come in here.
|
. ./configure.tgt
|
||||||
|
|
||||||
# XXX - FIXME there needs to be a case for tmake-a29k
|
|
||||||
|
|
||||||
#
|
|
||||||
# Local Variables:
|
|
||||||
# fill-column: 131
|
|
||||||
# End:
|
|
||||||
#
|
|
||||||
## end of per-target part.
|
|
||||||
|
|
||||||
# Temporarily, we support only direct subdir builds.
|
# Temporarily, we support only direct subdir builds.
|
||||||
hostsubdir=H-${host_alias}
|
hostsubdir=H-${host_alias}
|
||||||
@ -365,7 +259,7 @@ esac
|
|||||||
if [ -d "${hostsubdir}" ] ; then
|
if [ -d "${hostsubdir}" ] ; then
|
||||||
rm -rf ${hostsubdir}/${targetsubdir}
|
rm -rf ${hostsubdir}/${targetsubdir}
|
||||||
|
|
||||||
if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
|
if [ -z "`(ls ${hostsubdir}) 2>&1 | grep T- | grep -v T-independent`" ] ; then
|
||||||
rm -rf ${hostsubdir}
|
rm -rf ${hostsubdir}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -389,11 +283,11 @@ esac
|
|||||||
if [ -z "${commontargets}" ] ; then
|
if [ -z "${commontargets}" ] ; then
|
||||||
mkdir ${targetsubdir}
|
mkdir ${targetsubdir}
|
||||||
else
|
else
|
||||||
if [ ! -d Target-independent ] ; then
|
if [ ! -d T-independent ] ; then
|
||||||
mkdir Target-independent
|
mkdir T-independent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${symbolic_link} Target-independent ${targetsubdir}
|
${symbolic_link} T-independent ${targetsubdir}
|
||||||
fi # if target independent
|
fi # if target independent
|
||||||
fi # if no target dir yet
|
fi # if no target dir yet
|
||||||
|
|
||||||
@ -402,9 +296,11 @@ esac
|
|||||||
srcdir=../..
|
srcdir=../..
|
||||||
else
|
else
|
||||||
# if not subdir builds, then make sure none exist.
|
# if not subdir builds, then make sure none exist.
|
||||||
if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
|
if [ -n "`(ls .) 2>&1 | (grep H- ; true)`" ] ; then
|
||||||
echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
|
echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -565,9 +461,9 @@ esac
|
|||||||
echo "Created \"${Makefile}\"" in `pwd`${andusing}.
|
echo "Created \"${Makefile}\"" in `pwd`${andusing}.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#### configure.in post-target parts come in here.
|
if [ -f ./configure.pos ] ; then
|
||||||
|
. ./configure.pos
|
||||||
## end of post-target part.
|
fi
|
||||||
|
|
||||||
# describe the chosen configuration in config.status.
|
# describe the chosen configuration in config.status.
|
||||||
# Make that file a shellscript which will reestablish
|
# Make that file a shellscript which will reestablish
|
||||||
@ -592,7 +488,7 @@ ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norec
|
|||||||
|
|
||||||
if [ -d ${configdir} ] ; then
|
if [ -d ${configdir} ] ; then
|
||||||
(cd ${configdir} ;
|
(cd ${configdir} ;
|
||||||
./configure +recurring ${host_alias} +target=${target_alias} \
|
configure +recurring ${host_alias} +target=${target_alias} \
|
||||||
${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
|
${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
|
||||||
| sed 's/^/ /'
|
| sed 's/^/ /'
|
||||||
else
|
else
|
||||||
@ -610,7 +506,7 @@ ${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norec
|
|||||||
cat > GNUmakefile << E!O!F
|
cat > GNUmakefile << E!O!F
|
||||||
# Makefile generated by configure for host ${host_alias}.
|
# Makefile generated by configure for host ${host_alias}.
|
||||||
|
|
||||||
ALL := $(shell ls -d Target-*)
|
ALL := $(shell ls -d T-*)
|
||||||
|
|
||||||
%:
|
%:
|
||||||
$(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
|
$(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
|
||||||
@ -621,6 +517,10 @@ E!O!F
|
|||||||
fi
|
fi
|
||||||
done # for each host
|
done # for each host
|
||||||
|
|
||||||
|
### clean up.
|
||||||
|
|
||||||
|
rm -f configure.com configure.tgt configure.hst configure.pos
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user