From patchwork Thu Jun 18 19:31:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 7244 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 123407 invoked by alias); 18 Jun 2015 19:31:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 123398 invoked by uid 89); 18 Jun 2015 19:31:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f201.google.com Received: from mail-ob0-f201.google.com (HELO mail-ob0-f201.google.com) (209.85.214.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 18 Jun 2015 19:31:02 +0000 Received: by obbgq1 with SMTP id gq1so120401obb.0 for ; Thu, 18 Jun 2015 12:31:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-type; bh=P8G6Ttp09s1rxwbog6K8yalMOYiYyrTTbujQx6nTJyU=; b=RDI1cnnDZ2oina+k7Wzyf5wbY5FoXCZC2gRDmPJV5dY7mLaF2spd4SR0sPq7If8wn8 pOsoMh80UeLXR8rHmlt03fd/lmtjBz1vA9+2KU31fdnQyy4VZyDaehv8WErfgdLvuo6j 6dFZ0gW6hxC/RIEkwKG0+xCGbuE5TLTEzSkzqkPu4nlxXTkMd4TMboUSpz1QcXZpc3Py eB85FPKa2ZyN5tFFhjWDnAvgKSrZpYH1g7/fnxuN1lmnavRnxjpXpX6tTUdDA7mKIaUR ZKHHlmfPnJvc3+xP7jIET/O0LPnASCGK+PH2JMmi9GOg51bSoGnQTFZtdtKUc7VJpblb LNsQ== X-Gm-Message-State: ALoCoQn/Gmy3iEnvq5qtB4APhIFY4MvYv/5X/ujpP4dQK4CgasQKwus3uHA7JvjN2KJHAt1tRV9JqOCc359YQJBmPsMPD/7Ikaukd+SiqRV8bODYtMf6VUqtxQqdUSTzSC/3oobuC4UYdWcqvTLkVXlDWF/tGPX/MWbLLpL1XgR+S8zj81CWwn4= MIME-Version: 1.0 X-Received: by 10.182.99.201 with SMTP id es9mr13034186obb.25.1434655860845; Thu, 18 Jun 2015 12:31:00 -0700 (PDT) Message-ID: <047d7bd7600cf629310518cfd8de@google.com> Date: Thu, 18 Jun 2015 19:31:00 +0000 Subject: [PATCH]: sim: prototype of --enable-targets support From: Doug Evans To: gdb-patches@sourceware.org X-IsSubscribed: yes Hi. 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 \ --enable-sim 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 configure.ac. 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 * configure.ac: Add support for --enable-targets. * configure.tgt: Use $targ instead of $target. Remove AC_SUBST(sim_arch). * configure: Regenerate. ;; @@ -104,4 +107,3 @@ case "${target}" in sim_common=no ;; esac -AC_SUBST(sim_arch) diff --git a/sim/configure.ac b/sim/configure.ac index f1734e3..c6ac81e 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -27,6 +27,29 @@ AC_SUBST(CC_FOR_BUILD) CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}} AC_SUBST(CFLAGS_FOR_BUILD) +AC_ARG_ENABLE(targets, +[ --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 ;; +esac])dnl + +# 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 +fi + # If a cpu ever has more than one simulator to choose from, use # --enable-sim=... to choose. AC_ARG_ENABLE(sim, @@ -36,19 +59,55 @@ yes | no) ;; *) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;; esac]) +# 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], [ sim_arch=$1 AC_CONFIG_SUBDIRS($1) ]) + 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 + AC_CONFIG_SUBDIRS(igen) + fi fi AC_OUTPUT(Makefile) 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])]) sim_common=yes sim_igen=no sim_arch= -case "${target}" in + +# N.B. The order here is alphabetical. + +case "${targ}" in arm*-*-*) SIM_ARCH(arm)