[rfc] [9/9] Multi-target support: Add --enable-targets= option
Ulrich Weigand
uweigand@de.ibm.com
Fri Oct 26 01:31:00 GMT 2007
Hello,
this finally adds the --enable-targets= configure option. The semantics
is exactly the same as the existing binutils precedent. The basic idea
is that configure executes configure.tgt multiple times, once for each
desired target configuration, and accumulates all setting where appropriate
(currently only gdb_target_obs). Other settings remain to be determined
by the "master" target only.
The one special case is --enable-targets=all, which simply uses an
explicit list of all target-dependent object files in the Makefile.
(This also matches precedent, e.g. in the linker.)
Bye,
Ulrich
ChangeLog:
* configure.ac (--enable-targets): New configure option.
Collect gdb_target_obs of multiple targets into TARGET_OBS.
Call configure.tgt multiple times, using $targ as operand.
* configure.tgt: Operate on $targ instead of $target.
* configure: Regenerate.
* Makefile.in (ALL_TARGET_OBS): Define.
diff -urNp gdb-orig/gdb/configure gdb-head/gdb/configure
--- gdb-orig/gdb/configure 2007-10-25 23:49:47.714216171 +0200
+++ gdb-head/gdb/configure 2007-10-26 00:00:31.824201573 +0200
@@ -860,6 +860,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
+ --enable-targets alternative target configurations
--disable-gdbcli disable command-line interface (CLI)
--disable-gdbmi disable machine-interface (MI)
--enable-tui enable full-screen terminal user interface (TUI)
@@ -3080,6 +3081,20 @@ esac
subdirs="$subdirs doc testsuite"
+# Check whether to support alternative target configurations
+# Check whether --enable-targets or --disable-targets was given.
+if test "${enable_targets+set}" = set; then
+ enableval="$enable_targets"
+ case "${enableval}" in
+ yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5
+echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ no) enable_targets= ;;
+ *) enable_targets=$enableval ;;
+esac
+fi;
+
# Provide defaults for some variables set by the per-host and per-target
# configuration.
gdb_host_obs=posix-hdep.o
@@ -3092,7 +3107,49 @@ fi
. $srcdir/configure.host
-. $srcdir/configure.tgt
+# Accumulate some settings from configure.tgt over all enabled targets
+
+TARGET_OBS=
+all_targets=
+
+for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
+do
+ if test "$targ_alias" = "all"; then
+ all_targets=true
+ else
+ # Canonicalize the secondary target names.
+ result=`$ac_config_sub $targ_alias 2>/dev/null`
+ if test -n "$result"; then
+ targ=$result
+ else
+ targ=$targ_alias
+ fi
+
+ . ${srcdir}/configure.tgt
+
+ # Target-specific object files
+ for i in ${gdb_target_obs}; do
+ case " $TARGET_OBS " in
+ *" ${i} "*) ;;
+ *)
+ TARGET_OBS="$TARGET_OBS ${i}"
+ ;;
+ esac
+ done
+ fi
+done
+
+if test x${all_targets} = xtrue; then
+ TARGET_OBS='$(ALL_TARGET_OBS)'
+fi
+
+
+
+# For other settings, only the main target counts.
+gdb_sim=
+gdb_osabi=
+build_gdbserver=
+targ=$target; . ${srcdir}/configure.tgt
# Fetch the default architecture and default target vector from BFD.
targ=$target; . $srcdir/../bfd/config.bfd
@@ -3116,9 +3173,6 @@ _ACEOF
fi
-TARGET_OBS="${gdb_target_obs}"
-
-
test "$program_prefix" != NONE &&
program_transform_name="s,^,$program_prefix,;$program_transform_name"
# Use a double $ so make ignores it.
diff -urNp gdb-orig/gdb/configure.ac gdb-head/gdb/configure.ac
--- gdb-orig/gdb/configure.ac 2007-10-25 23:49:47.724214729 +0200
+++ gdb-head/gdb/configure.ac 2007-10-26 00:00:31.868195229 +0200
@@ -91,6 +91,16 @@ esac
AC_CONFIG_SUBDIRS(doc testsuite)
+# Check whether to support alternative target configurations
+AC_ARG_ENABLE(targets,
+[ --enable-targets alternative target configurations],
+[case "${enableval}" in
+ yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
+ ;;
+ no) enable_targets= ;;
+ *) enable_targets=$enableval ;;
+esac])
+
# Provide defaults for some variables set by the per-host and per-target
# configuration.
gdb_host_obs=posix-hdep.o
@@ -103,7 +113,49 @@ fi
. $srcdir/configure.host
-. $srcdir/configure.tgt
+# Accumulate some settings from configure.tgt over all enabled targets
+
+TARGET_OBS=
+all_targets=
+
+for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
+do
+ if test "$targ_alias" = "all"; then
+ all_targets=true
+ else
+ # Canonicalize the secondary target names.
+ result=`$ac_config_sub $targ_alias 2>/dev/null`
+ if test -n "$result"; then
+ targ=$result
+ else
+ targ=$targ_alias
+ fi
+
+ . ${srcdir}/configure.tgt
+
+ # Target-specific object files
+ for i in ${gdb_target_obs}; do
+ case " $TARGET_OBS " in
+ *" ${i} "*) ;;
+ *)
+ TARGET_OBS="$TARGET_OBS ${i}"
+ ;;
+ esac
+ done
+ fi
+done
+
+if test x${all_targets} = xtrue; then
+ TARGET_OBS='$(ALL_TARGET_OBS)'
+fi
+
+AC_SUBST(TARGET_OBS)
+
+# For other settings, only the main target counts.
+gdb_sim=
+gdb_osabi=
+build_gdbserver=
+targ=$target; . ${srcdir}/configure.tgt
# Fetch the default architecture and default target vector from BFD.
targ=$target; . $srcdir/../bfd/config.bfd
@@ -121,9 +173,6 @@ if test "x$targ_defvec" != x; then
[Define to BFD's default target vector. ])
fi
-TARGET_OBS="${gdb_target_obs}"
-AC_SUBST(TARGET_OBS)
-
AC_ARG_PROGRAM
# The CLI cannot be disabled yet, but may be in the future.
diff -urNp gdb-orig/gdb/configure.tgt gdb-head/gdb/configure.tgt
--- gdb-orig/gdb/configure.tgt 2007-10-25 23:49:47.730213864 +0200
+++ gdb-head/gdb/configure.tgt 2007-10-26 00:01:59.428865689 +0200
@@ -7,7 +7,7 @@
# gdb_osabi default OS ABI to use with target
# build_gdbserver set to "yes" if gdbserver supports target
-case $target in
+case $targ in
d10v-*-* | \
hppa*-*-hiux* | \
i[34567]86-ncr-* | \
@@ -19,7 +19,7 @@ case $target in
rs6000-*-lynxos* | \
sh*-*-pe | \
null)
- echo "*** Configuration $target is obsolete." >&2
+ echo "*** Configuration $targ is obsolete." >&2
echo "*** Support has been REMOVED." >&2
exit 1
;;
@@ -27,7 +27,7 @@ esac
# map target info into gdb names.
-case "${target}" in
+case "${targ}" in
alpha*-*-osf*)
# Target: Little-endian Alpha running OSF/1
@@ -521,7 +521,7 @@ esac
# map target onto default OS ABI
-case "${target}" in
+case "${targ}" in
*-*-freebsd*) gdb_osabi=GDB_OSABI_FREEBSD_ELF ;;
*-*-linux*) gdb_osabi=GDB_OSABI_LINUX ;;
*-*-nto*) gdb_osabi=GDB_OSABI_QNXNTO ;;
diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in 2007-10-26 00:00:20.966038303 +0200
+++ gdb-head/gdb/Makefile.in 2007-10-26 00:00:31.884192922 +0200
@@ -425,6 +425,62 @@ SIM_OBS = @SIM_OBS@
# Target-dependent object files.
TARGET_OBS = @TARGET_OBS@
+# All target-dependent objects files (used with --enable-targets=all).
+ALL_TARGET_OBS = \
+ alphabsd-tdep.o alphafbsd-tdep.o alpha-linux-tdep.o alpha-mdebug-tdep.o \
+ alphanbsd-tdep.o alphaobsd-tdep.o alpha-osf1-tdep.o alpha-tdep.o \
+ amd64fbsd-tdep.o amd64-linux-tdep.o amd64nbsd-tdep.o amd64obsd-tdep.o \
+ amd64-sol2-tdep.o amd64-tdep.o \
+ armbsd-tdep.o arm-linux-tdep.o armnbsd-tdep.o armobsd-tdep.o \
+ arm-tdep.o arm-wince-tdep.o \
+ avr-tdep.o \
+ cris-tdep.o \
+ frv-linux-tdep.o frv-tdep.o \
+ h8300-tdep.o \
+ hppabsd-tdep.o hppa-hpux-tdep.o hppa-linux-tdep.o hppa-tdep.o \
+ i386bsd-tdep.o i386-cygwin-tdep.o i386fbsd-tdep.o i386gnu-tdep.o \
+ i386-linux-tdep.o i386nbsd-tdep.o i386-nto-tdep.o i386obsd-tdep.o \
+ i386-sol2-tdep.o i386-tdep.o i387-tdep.o \
+ ia64-linux-tdep.o ia64-tdep.o \
+ iq2000-tdep.o \
+ m32c-tdep.o \
+ m32r-linux-tdep.o m32r-tdep.o \
+ m68hc11-tdep.o \
+ m68kbsd-tdep.o m68klinux-tdep.o m68k-tdep.o \
+ m88k-tdep.o \
+ mep-tdep.o \
+ mips64obsd-tdep.o mips-irix-tdep.o mips-linux-tdep.o \
+ mipsnbsd-tdep.o mips-tdep.o \
+ mn10300-linux-tdep.o mn10300-tdep.o \
+ mt-tdep.o \
+ nto-tdep.o \
+ ppc-linux-tdep.o ppcnbsd-tdep.o ppcobsd-tdep.o ppc-sysv-tdep.o \
+ rs6000-aix-tdep.o rs6000-tdep.o \
+ s390-tdep.o \
+ score-tdep.o \
+ sh64-tdep.o sh-linux-tdep.o shnbsd-tdep.o sh-tdep.o \
+ sparc64fbsd-tdep.o sparc64-linux-tdep.o sparc64nbsd-tdep.o \
+ sparc64obsd-tdep.o sparc64-sol2-tdep.o sparc64-tdep.o \
+ sparc-linux-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o \
+ sparc-sol2-tdep.o sparc-tdep.o \
+ spu-tdep.o \
+ v850-tdep.o \
+ vaxnbsd-tdep.o vaxobsd-tdep.o vax-tdep.o \
+ xstormy16-tdep.o \
+ xtensa-config.o xtensa-tdep.o \
+ glibc-tdep.o \
+ bsd-uthread.o \
+ nbsd-tdep.o obsd-tdep.o \
+ sol2-tdep.o \
+ solib.o solib-frv.o solib-irix.o solib-svr4.o solib-target.o \
+ solib-som.o solib-pa64.o \
+ dbug-rom.o dink32-rom.o ppcbug-rom.o m32r-rom.o dsrec.o monitor.o \
+ remote-m32r-sdi.o \
+ xcoffread.o \
+ prologue-value.o \
+ symfile-mem.o \
+ corelow.o
+
# Host-dependent makefile fragment comes in here.
@host_makefile_frag@
# End of host-dependent makefile fragment
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list