This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: sim: prototype of --enable-targets support


I wanted to test a change to the generation of cgen simulator files.
Rather than have a build for each sim, which is what I normally
do but my system with those sandboxes is down,
I figured I might as well hack a prototype of --enable-targets=all
support for the sims.

Obviously, this is just a prototype, and it doesn't link
all sims into gdb.  It just exists to make it trivial to
build all the sim directories.

bash$ $src/configure --prefix=$(pwd)/rel \
    --enable-cgen-maint \
    --enable-targets=all \
bash$ make -j10 all-sim

I'm not intending to apply this, at least not as is.
Need to think about it some more.
And is it worth it without the hard part which is linking
all the sims into gdb?
OTOH, being able to trivially build all the sims today is really nice.

There are a couple of issues in the patch.
1) ${sim}-unknown-unknown is used as the target triplet.
   when --enable-targets=all is specified.
   It works, but maybe it could be cleaner.
2) IWBN if all_sims was defined in configure.tgt and not
   However, configure.tgt can only be sinclude'd once.
   I wrote a different version that solves this, but it had its
   own issues.

2015-06-18  Doug Evans  <>

	* Add support for --enable-targets.
	* configure.tgt: Use $targ instead of $target.
	Remove AC_SUBST(sim_arch).
	* configure: Regenerate.

diff --git a/sim/ b/sim/
index f1734e3..c6ac81e 100644
--- a/sim/
+++ b/sim/
@@ -27,6 +27,29 @@ AC_SUBST(CC_FOR_BUILD)

+[  --enable-targets        alternative target configurations],
+[case "${enableval}" in
+ yes | "") AC_MSG_ERROR([enable-targets option must specify target names or 'all'])
+            ;;
+  no)       enable_targets= ;;
+  *)        enable_targets=$enableval ;;
+# Canonicalize the secondary target names.
+if test -n "$enable_targets" ; then
+    for targ in `echo $enable_targets | sed 's/,/ /g'`
+    do
+	result=`$ac_config_sub $targ 2>/dev/null`
+	if test -n "$result" ; then
+	    canon_targets="$canon_targets $result"
+	else
+	    # Allow targets that config.sub doesn't recognize, like "all".
+	    canon_targets="$canon_targets $targ"
+	fi
+    done
 # If a cpu ever has more than one simulator to choose from, use
 # --enable-sim=... to choose.
@@ -36,19 +59,55 @@ yes | no) ;;
 *)	AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;

+# IWBN to define all_sims in configure.tgt, but we can only sinclude
+# configure.tgt once.  Otherwise autoconf complains about the apparent
+# duplicate calls to AC_CONFIG_SUBDIRS for each arch.
+all_sims="arm avr bfin cr16 cris d10v frv h8300 iq2000 lm32 m32c m32r"
+all_sims="$all_sims m68hc11 mcore microblaze mips mn10300 moxie msp430"
+all_sims="$all_sims rl78 rx sh64 sh erc32 ppc ft32 v850"
 m4_define([SIM_ARCH], [
 if test "${enable_sim}" != no; then
-   sinclude(configure.tgt)
-   AC_CONFIG_SUBDIRS(testsuite)
-   if test "$sim_common" = yes; then
-      AC_CONFIG_SUBDIRS(common)
-   fi
-   if test "$sim_igen" = yes; then
-      AC_CONFIG_SUBDIRS(igen)
-   fi
+  any_sim_uses_sim_common=no
+  any_sim_uses_sim_igen=no
+  all_targets=false
+  for targ in $canon_targets
+  do
+    if test "x$targ" = xall; then
+      all_targets=true
+    fi
+  done
+  if test "$all_targets" = true; then
+    canon_targets=
+    for sim in $all_sims
+    do
+      canon_targets="$canon_targets ${sim}-unknown-unknown"
+    done
+  fi
+  for targ in $target $canon_targets
+  do
+    sinclude(configure.tgt)
+    if test "x$sim_common" = xyes; then
+      any_sim_uses_sim_common=yes
+    fi
+    if test "x$sim_igen" = xyes; then
+      any_sim_uses_sim_igen=yes
+    fi
+  done
+  AC_CONFIG_SUBDIRS(testsuite)
+  if test "$any_sim_uses_sim_common" = yes; then
+    AC_CONFIG_SUBDIRS(common)
+  fi
+  if test "$any_sim_uses_sim_igen" = yes; then
+  fi

diff --git a/sim/configure.tgt b/sim/configure.tgt
index 5f3bb03..1924b39 100644
--- a/sim/configure.tgt
+++ b/sim/configure.tgt
@@ -14,7 +14,10 @@ m4_ifndef([SIM_ARCH], [AC_DEFUN([SIM_ARCH],[sim_arch=$1])])
-case "${target}" in
+# N.B. The order here is alphabetical.
+case "${targ}" in
@@ -104,4 +107,3 @@ case "${target}" in

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]