Patchwork [ada,build] host/target configuration (was: Restore Solaris/amd64 Ada bootstrap (PR ada/57188))

login
register
mail settings
Submitter Thomas Schwinge
Date May 28, 2013, 7:28 a.m.
Message ID <87txlnlg0z.fsf@kepler.schwinge.homeip.net>
Download mbox | patch
Permalink /patch/246717/
State New
Headers show

Comments

Thomas Schwinge - May 28, 2013, 7:28 a.m.
Hi!

On Wed, 08 May 2013 11:27:09 +0200, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
> As described in the PR, amd64-pc-solaris2.1[01] Ada bootstrap was failing
> for some time.  It has turned out that this patch is the culprit:
> 
> 2013-04-23  Eric Botcazou  <ebotcazou@adacore.com>
>             Pascal Obry    <obry@adacore.com>
> 
>         * gcc-interface/Makefile.in (targ): Fix target name check.
> 
> diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
> --- a/gcc/ada/gcc-interface/Makefile.in
> +++ b/gcc/ada/gcc-interface/Makefile.in
> @@ -259,7 +259,7 @@ TOOLS_LIBS = targext.o link.o ../../ggc-
>  # manufacturer, and operating system and assign each of those to its own
>  # variable.
>  host:=$(subst -, ,$(host_canonical))
> -targ:=$(subst -, ,$(target))
> +targ:=$(subst -, ,$(subst -gnu, ,$(target_alias)))
>  arch:=$(word 1,$(targ))
>  ifeq ($(words $(targ)),2)
>    manu:=
|    osys:=$(word 2,$(targ))
|  else
|    manu:=$(word 2,$(targ))
|    osys:=$(word 3,$(targ))
|  endif

> I couldn't find the gcc-patches posting for this patch, thus I'm missing
> the rationale for it.  It seems rather counterintuitive and fragile to
> me, replacing the canonical $target by the far more varied $target_alias.

I concur, and this has now caused confusion for the (pending upstream
re-submission) x86 GNU/Hurd port, too, for which, upon removing -gnu from
the target of i686-pc-gnu0.3, now a mere 0.3 remains for osys...

> If there's really a good reason to keep that patch nonetheless, [...]

How about we use something like the following (untested) patch?  In
essence, replace the manual parsing in gcc/ada/gcc-interface/Makefile.in
by using the values the configure script already computed for us.  This
is largely straightforward (I would hope); please especially review the
more involved cases such as the one where I'm now using linux%eabi -- for
example, does that do the right thing or interfere with the Android
configurations?

The target_cpu_canonical substitution has been added in commit
369e542b3ad1c0acfa9bfaeb72b338d8db5ba2ef (2009-02-27, r144463, schwab)
but unused ever since, thus removed.

I'll now be testing for x86 GNU/Linux and GNU/Hurd; further testing
appreciated.

Other than rebuilding from scratch, how do I rebuild only the affected
Ada/GNAT bits after regenerating gcc/ada/gcc-interface/Makefile?  It
doesn't just work, and »make clean-target-libada clean-gnattools« doesn't
help either?



Grüße,
 Thomas
Thomas Schwinge - May 29, 2013, 10:50 a.m.
Hi!

On Tue, 28 May 2013 09:28:28 +0200, I wrote:
> On Wed, 08 May 2013 11:27:09 +0200, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
> > As described in [PR ada/57188], amd64-pc-solaris2.1[01] Ada bootstrap was failing
> > for some time.  It has turned out that this patch is the culprit:
> > 
> > 2013-04-23  Eric Botcazou  <ebotcazou@adacore.com>
> >             Pascal Obry    <obry@adacore.com>
> > 
> >         * gcc-interface/Makefile.in (targ): Fix target name check.
> > 
> > diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
> > --- a/gcc/ada/gcc-interface/Makefile.in
> > +++ b/gcc/ada/gcc-interface/Makefile.in
> > @@ -259,7 +259,7 @@ TOOLS_LIBS = targext.o link.o ../../ggc-
> >  # manufacturer, and operating system and assign each of those to its own
> >  # variable.
> >  host:=$(subst -, ,$(host_canonical))
> > -targ:=$(subst -, ,$(target))
> > +targ:=$(subst -, ,$(subst -gnu, ,$(target_alias)))
> >  arch:=$(word 1,$(targ))
> >  ifeq ($(words $(targ)),2)
> >    manu:=
> |    osys:=$(word 2,$(targ))
> |  else
> |    manu:=$(word 2,$(targ))
> |    osys:=$(word 3,$(targ))
> |  endif
> 
> > I couldn't find the gcc-patches posting for this patch, thus I'm missing
> > the rationale for it.  It seems rather counterintuitive and fragile to
> > me, replacing the canonical $target by the far more varied $target_alias.
> 
> I concur, and this has now caused confusion for the (pending upstream
> re-submission) x86 GNU/Hurd port, too, for which, upon removing -gnu from
> the target of i686-pc-gnu0.3, now a mere 0.3 remains for osys...
> 
> > If there's really a good reason to keep that patch nonetheless, [...]
> 
> How about we use something like the following [...] patch?  In
> essence, replace the manual parsing in gcc/ada/gcc-interface/Makefile.in
> by using the values the configure script already computed for us.  This
> is largely straightforward (I would hope); please especially review the
> more involved cases such as the one where I'm now using linux%eabi -- for
> example, does that do the right thing or interfere with the Android
> configurations?
> 
> The target_cpu_canonical substitution has been added in commit
> 369e542b3ad1c0acfa9bfaeb72b338d8db5ba2ef (2009-02-27, r144463, schwab)
> but unused ever since, thus removed.
> 
> I'll now be testing for x86 GNU/Linux and GNU/Hurd; further testing
> appreciated.

For these two configurations, I have now successfully tested the patch I
posted.  Further review/testing appreciated.  (Adding »build machinery
(*.in)« maintainers.)


> Other than rebuilding from scratch, how do I rebuild only the affected
> Ada/GNAT bits after regenerating gcc/ada/gcc-interface/Makefile?  It
> doesn't just work, and »make clean-target-libada clean-gnattools« doesn't
> help either?


gcc/ada/
	* gcc-interface/Makefile.in (target_alias, host_canonical)
	(target_cpu_default): Don't substitute.
	(target_cpu, target_vendor, target_os, host_cpu, host_vendor)
	(host_os): Substitute.
	(host, targ, arch, manu, osys): Don't set, and replace their
	usage with the newly substituted target_* and host_* variables.

> diff --git gcc/ada/gcc-interface/Makefile.in gcc/ada/gcc-interface/Makefile.in
> index eeb8c7f..c07722b 100644
> --- gcc/ada/gcc-interface/Makefile.in
> +++ gcc/ada/gcc-interface/Makefile.in
> @@ -151,12 +151,15 @@ GCC_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)
>  program_transform_name =
>  objdir = .
>  
> -target_alias=@target_alias@
>  target=@target@
> +target_cpu=@target_cpu@
> +target_vendor=@target_vendor@
> +target_os=@target_os@
> +host_cpu=@host_cpu@
> +host_vendor=@host_vendor@
> +host_os=@host_os@
>  xmake_file = @xmake_file@
>  tmake_file = @tmake_file@
> -host_canonical=@host@
> -target_cpu_default=@target_cpu_default@
>  #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
>  #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
>  
> @@ -255,20 +258,6 @@ TOOLS_LIBS = targext.o link.o ../../ggc-none.o ../../libcommon-target.a \
>    ../../../libbacktrace/.libs/libbacktrace.a ../../../libiberty/libiberty.a \
>    $(SYSLIBS) $(TGT_LIB)
>  
> -# Convert the target variable into a space separated list of architecture,
> -# manufacturer, and operating system and assign each of those to its own
> -# variable.
> -host:=$(subst -, ,$(host_canonical))
> -targ:=$(subst -, ,$(subst -gnu, ,$(target_alias)))
> -arch:=$(word 1,$(targ))
> -ifeq ($(words $(targ)),2)
> -  manu:=
> -  osys:=$(word 2,$(targ))
> -else
> -  manu:=$(word 2,$(targ))
> -  osys:=$(word 3,$(targ))
> -endif
> -
>  # Specify the directories to be searched for header files.
>  # Both . and srcdir are used, in that order,
>  # so that tm.h and config.h will be found in the compilation
> @@ -280,7 +269,7 @@ ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
>  # Likewise, but valid for subdirectories of the current dir.
>  # FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in
>  # that directory conflicts with a system header file.
> -ifneq ($(findstring vxworks,$(osys)),)
> +ifneq ($(findstring vxworks,$(target_os)),)
>    INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
>  			-iquote $(fsrcdir)/ada \
>  			-I$(fsrcdir)/../include $(GMPINC)
> @@ -348,16 +337,16 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
>   uname.o urealp.o usage.o widechar.o \
>   $(EXTRA_GNATMAKE_OBJS)
>  
> -# Make arch match the current multilib so that the RTS selection code
> +# Make target_cpu match the current multilib so that the RTS selection code
>  # picks up the right files. For a given target this must be coherent
>  # with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
>  
> -ifeq ($(strip $(filter-out %x86_64, $(arch))),)
> +ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
>    ifeq ($(strip $(MULTISUBDIR)),/32)
> -    arch:=i686
> +    target_cpu := i686
>    else
>      ifeq ($(strip $(MULTISUBDIR)),/x32)
> -      arch:=x32
> +      target_cpu := x32
>      endif
>    endif
>  endif
> @@ -460,7 +449,7 @@ EXTRA_LIBGNAT_SRCS=
>  # If what's left is null then it's a match.
>  
>  # m68k VxWorks
> -ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
> +ifeq ($(strip $(filter-out m68k% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-vxworks.ads \
>    a-numaux.ads<a-numaux-vxworks.ads \
> @@ -503,7 +492,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
>  endif
>  
>  # PowerPC and e500v2 VxWorks
> -ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
> +ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-vxworks.ads \
>    a-numaux.ads<a-numaux-vxworks.ads \
> @@ -609,7 +598,7 @@ ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
>  endif
>  
>  # PowerPC and e500v2 VxWorks 653
> -ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
> +ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(target_cpu) $(target_vendor) $(target_os))),)
>    # target pairs for vthreads runtime
>    LIBGNAT_TARGET_PAIRS = \
>    a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
> @@ -671,7 +660,7 @@ ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
>  endif
>  
>  # PowerPC and e500v2 VxWorks MILS
> -ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
> +ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(target_cpu) $(target_vendor) $(target_os))),)
>    # target pairs for vthreads runtime
>    LIBGNAT_TARGET_PAIRS = \
>    a-elchha.adb<a-elchha-vx6-raven-cert.adb \
> @@ -721,7 +710,7 @@ ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
>  endif
>  
>  # VxWorksae / VxWorks 653 for x86 (vxsim) - ?? VxWorks mils not implemented
> -ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
> +ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(target_cpu) $(target_vendor) $(target_os))),)
>    # target pairs for kernel + vthreads runtime
>    LIBGNAT_TARGET_PAIRS = \
>    a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
> @@ -781,7 +770,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
>  endif
>  
>  # Sparc VxWorks
> -ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
> +ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-vxworks.ads \
>    a-numaux.ads<a-numaux-vxworks.ads \
> @@ -808,7 +797,7 @@ ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
>    mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
>    indepsw.adb<indepsw-gnu.adb
>  
> -  ifeq ($(strip $(filter-out sparc erc32 leon leon3, $(arch))),)
> +  ifeq ($(strip $(filter-out sparc erc32 leon leon3, $(target_cpu))),)
>      # 32-bits
>      LIBGNAT_TARGET_PAIRS += \
>      s-vxwork.ads<s-vxwork-sparc.ads \
> @@ -833,7 +822,7 @@ ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
>  endif
>  
>  # x86 VxWorks
> -ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
> +ifeq ($(strip $(filter-out %86 wrs vxworks,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-vxworks.ads \
>    i-vxwork.ads<i-vxwork-x86.ads \
> @@ -924,7 +913,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
>  endif
>  
>  # ARM VxWorks
> -ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
> +ifeq ($(strip $(filter-out arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-vxworks.ads \
>    a-numaux.ads<a-numaux-vxworks.ads \
> @@ -960,7 +949,7 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
>  endif
>  
>  # MIPS VxWorks
> -ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
> +ifeq ($(strip $(filter-out mips% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-vxworks.ads \
>    a-numaux.ads<a-numaux-vxworks.ads \
> @@ -995,7 +984,7 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
>    EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
>  endif
>  
> -ifeq ($(strip $(filter-out arm% linux-androideabi,$(arch) $(osys)-$(word 4,$(targ)))),)
> +ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1023,7 +1012,7 @@ ifeq ($(strip $(filter-out arm% linux-androideabi,$(arch) $(osys)-$(word 4,$(tar
>  endif
>  
>  # Sparc Solaris
> -ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
> +ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-solaris.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1047,7 +1036,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
>    $(ATOMICS_TARGET_PAIRS) \
>    $(ATOMICS_BUILTINS_TARGET_PAIRS)
>  
> -  ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
> +  ifeq ($(strip $(filter-out sparc sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
>      ifeq ($(strip $(MULTISUBDIR)),/sparcv9)
>        LIBGNAT_TARGET_PAIRS = \
>        $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
> @@ -1098,7 +1087,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
>  endif
>  
>  # x86 and x86-64 solaris
> -ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-solaris.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1123,7 +1112,7 @@ ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
>    $(X86_64_TARGET_PAIRS) \
>    system.ads<system-solaris-x86_64.ads
>  
> -  ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
> +  ifeq ($(strip $(filter-out %86 solaris2%,$(target_cpu) $(target_os))),)
>      ifeq ($(strip $(MULTISUBDIR)),/amd64)
>        LIBGNAT_TARGET_PAIRS = \
>        $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
> @@ -1155,7 +1144,7 @@ ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
>  endif
>  
>  # x86 Linux
> -ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    a-synbar.adb<a-synbar-posix.adb \
> @@ -1216,7 +1205,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
>  endif
>  
>  # x86 kfreebsd
> -ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-freebsd.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1247,7 +1236,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
>    MISCLIB = -lutil
>  endif
>  
> -ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-freebsd.ads \
>    a-numaux.adb<a-numaux-x86.adb \
> @@ -1276,7 +1265,7 @@ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
>  endif
>  
>  # x86 FreeBSD
> -ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-freebsd.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1305,7 +1294,7 @@ ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
>  endif
>  
>  # x86-64 FreeBSD
> -ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-freebsd.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1334,7 +1323,7 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
>  endif
>  
>  # x86 GNU/Hurd
> -ifeq ($(strip $(filter-out %86 gnu%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %86 gnu%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>      a-intnam.ads<a-intnam-freebsd.ads \
>      s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1363,7 +1352,7 @@ ifeq ($(strip $(filter-out %86 gnu%,$(arch) $(osys))),)
>  endif
>  
>  # S390 Linux
> -ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1384,7 +1373,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
>    LIBGNAT_TARGET_PAIRS_64 = \
>    system.ads<system-linux-s390x.ads
>  
> -  ifeq ($(strip $(filter-out s390x,$(arch))),)
> +  ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
>      ifeq ($(strip $(MULTISUBDIR)),/32)
>        LIBGNAT_TARGET_PAIRS = \
>        $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
> @@ -1409,7 +1398,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
>  endif
>  
>  # HP/PA HP-UX 10
> -ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
> +ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-excpol.adb<a-excpol-abort.adb \
>    a-intnam.ads<a-intnam-hpux.ads \
> @@ -1429,7 +1418,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
>  endif
>  
>  # HP/PA HP-UX 11
> -ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
> +ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-hpux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1456,7 +1445,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
>  endif
>  
>  # IBM AIX
> -ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
> +ifeq ($(strip $(filter-out ibm aix%,$(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-aix.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1500,7 +1489,7 @@ ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
>  endif
>  
>  # RTEMS
> -ifeq ($(strip $(filter-out rtems%,$(osys))),)
> +ifeq ($(strip $(filter-out rtems%,$(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    system.ads<system-rtems.ads \
>    a-intnam.ads<a-intnam-rtems.ads \
> @@ -1518,7 +1507,7 @@ ifeq ($(strip $(filter-out rtems%,$(osys))),)
>  endif
>  
>  # OpenVMS (host)
> -ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)
> +ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host_cpu) $(host_vendor) $(host_os))),)
>  
>  soext  = .exe
>  hyphen = _
> @@ -1528,7 +1517,7 @@ LN_S = cp -p
>  endif
>  
>  # OpenVMS (target)
> -ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
> +ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>      a-caldel.adb<a-caldel-vms.adb \
>      a-calend.adb<a-calend-vms.adb \
> @@ -1562,7 +1551,7 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
>      s-tpopde.adb<s-tpopde-vms.adb \
>      s-tpopde.ads<s-tpopde-vms.ads
>  
> -  ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
> +  ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(target_cpu) $(target_vendor) $(target_os))),)
>      LIBGNAT_TARGET_PAIRS += \
>        g-enblsp.adb<g-enblsp-vms-ia64.adb \
>        g-trasym.adb<g-trasym-vms-ia64.adb \
> @@ -1582,7 +1571,7 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
>        symbols.adb<symbols-vms.adb \
>        symbols-processing.adb<symbols-processing-vms-ia64.adb
>    else
> -    ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
> +    ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(target_cpu) $(target_vendor) $(target_os))),)
>        LIBGNAT_TARGET_PAIRS += \
>          g-enblsp.adb<g-enblsp-vms-alpha.adb \
>          g-trasym.adb<g-trasym-vms-alpha.adb \
> @@ -1621,21 +1610,21 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
>  endif
>  
>  # *-elf
> -ifeq ($(strip $(filter-out lmp avr none powerpc% eabispe leon% erc32% unknown elf,$(targ))),)
> +ifeq ($(strip $(filter-out lmp avr none powerpc% eabispe leon% erc32% unknown elf,$(target_cpu) $(target_vendor) $(target_os))),)
>    TOOLS_TARGET_PAIRS=\
>    mlib-tgt-specific.adb<mlib-tgt-specific-xi.adb \
>    indepsw.adb<indepsw-gnu.adb
>  endif
>  
>  # Cygwin/Mingw32
> -ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
> +ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
>    # Cygwin provides a full Posix environment, and so we use the default
>    # versions of s-memory and g-socthi rather than the Windows-specific
>    # MinGW versions.  Ideally we would use all the default versions for
>    # Cygwin and none of the MinGW versions, but for historical reasons
>    # the Cygwin port has always been a CygMing frankenhybrid and it is
>    # a long-term project to disentangle them.
> -  ifeq ($(strip $(filter-out cygwin%,$(osys))),)
> +  ifeq ($(strip $(filter-out cygwin%,$(target_os))),)
>      LIBGNAT_TARGET_PAIRS = \
>      s-memory.adb<s-memory.adb \
>      g-socthi.ads<g-socthi.ads \
> @@ -1693,7 +1682,7 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
>      s-osprim.adb<s-osprim-mingw.adb \
>      s-taprop.adb<s-taprop-mingw.adb
>  
> -    ifeq ($(strip $(filter-out x86_64%,$(arch))),)
> +    ifeq ($(strip $(filter-out x86_64%,$(target_cpu))),)
>        ifeq ($(strip $(MULTISUBDIR)),/32)
>  	LIBGNAT_TARGET_PAIRS += \
>  	  $(X86_TARGET_PAIRS) \
> @@ -1744,7 +1733,7 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
>  endif
>  
>  # Mips Linux
> -ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out mips linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1768,7 +1757,7 @@ ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
>  endif
>  
>  # Mips/el Linux
> -ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out mipsel linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1811,7 +1800,7 @@ ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
>  endif
>  
>  # Mips64/el Linux
> -ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out mips64el linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1854,7 +1843,7 @@ ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
>  endif
>  
>  # PowerPC and e500v2 Linux
> -ifeq ($(strip $(filter-out powerpc% e500% linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out powerpc% e500% linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-exetim.adb<a-exetim-posix.adb \
>    a-exetim.ads<a-exetim-default.ads \
> @@ -1917,7 +1906,7 @@ ifeq ($(strip $(filter-out powerpc% e500% linux%,$(arch) $(osys))),)
>    LIBRARY_VERSION := $(LIB_VERSION)
>  endif
>  
> -ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)
> +ifeq ($(strip $(filter-out arm% linux%eabi,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1932,7 +1921,7 @@ ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(
>    s-taspri.ads<s-taspri-posix-noaltstack.ads \
>    s-tpopsp.adb<s-tpopsp-posix-foreign.adb
>  
> -  ifeq ($(strip $(filter-out arm%b,$(arch))),)
> +  ifeq ($(strip $(filter-out arm%b,$(target_cpu))),)
>      LIBGNAT_TARGET_PAIRS += \
>      system.ads<system-linux-armeb.ads
>    else
> @@ -1953,7 +1942,7 @@ ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(
>  endif
>  
>  # Sparc Linux
> -ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS_COMMON = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -1995,7 +1984,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
>  endif
>  
>  # HP/PA Linux
> -ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -2024,7 +2013,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
>  endif
>  
>  # SH4 Linux
> -ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -2054,7 +2043,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
>  endif
>  
>  # IA64 Linux
> -ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-exetim.adb<a-exetim-posix.adb \
>    a-exetim.ads<a-exetim-default.ads \
> @@ -2093,7 +2082,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
>  endif
>  
>  # IA64 HP-UX
> -ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
> +ifeq ($(strip $(filter-out ia64% hp hpux%,$(target_cpu) $(target_vendor) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-hpux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -2122,7 +2111,7 @@ ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
>  endif
>  
>  # Alpha Linux
> -ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-intnam.ads<a-intnam-linux.ads \
>    s-inmaop.adb<s-inmaop-posix.adb \
> @@ -2153,7 +2142,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
>  endif
>  
>  # x86-64 Linux
> -ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-exetim.adb<a-exetim-posix.adb \
>    a-exetim.ads<a-exetim-default.ads \
> @@ -2190,7 +2179,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
>    LIBRARY_VERSION := $(LIB_VERSION)
>  endif
>  
> -ifeq ($(strip $(filter-out %x32 linux%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    a-exetim.adb<a-exetim-posix.adb \
>    a-exetim.ads<a-exetim-default.ads \
> @@ -2228,7 +2217,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(arch) $(osys))),)
>  endif
>  
>  # Darwin (Mac OS X)
> -ifeq ($(strip $(filter-out darwin%,$(osys))),)
> +ifeq ($(strip $(filter-out darwin%,$(target_os))),)
>    SO_OPTS = -shared-libgcc
>    LIBGNAT_TARGET_PAIRS = \
>      a-intnam.ads<a-intnam-darwin.ads \
> @@ -2239,7 +2228,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
>      s-taspri.ads<s-taspri-posix.ads \
>      s-tpopsp.adb<s-tpopsp-posix-foreign.adb
>  
> -  ifeq ($(strip $(filter-out %86,$(arch))),)
> +  ifeq ($(strip $(filter-out %86,$(target_cpu))),)
>      LIBGNAT_TARGET_PAIRS += \
>        s-intman.adb<s-intman-susv3.adb \
>        s-osprim.adb<s-osprim-darwin.adb \
> @@ -2259,7 +2248,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
>      EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
>    endif
>  
> -  ifeq ($(strip $(filter-out %x86_64,$(arch))),)
> +  ifeq ($(strip $(filter-out %x86_64,$(target_cpu))),)
>      LIBGNAT_TARGET_PAIRS += \
>        s-intman.adb<s-intman-susv3.adb \
>        s-osprim.adb<s-osprim-darwin.adb \
> @@ -2279,7 +2268,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
>      EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
>    endif
>  
> -  ifeq ($(strip $(filter-out powerpc%,$(arch))),)
> +  ifeq ($(strip $(filter-out powerpc%,$(target_cpu))),)
>      LIBGNAT_TARGET_PAIRS += \
>        s-intman.adb<s-intman-posix.adb \
>        s-osprim.adb<s-osprim-posix.adb \
> @@ -2309,7 +2298,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
>  endif
>  
>  # ARM Nucleus
> -ifeq ($(strip $(filter-out arm nucleus%,$(arch) $(osys))),)
> +ifeq ($(strip $(filter-out arm nucleus%,$(target_cpu) $(target_os))),)
>    LIBGNAT_TARGET_PAIRS = \
>    system.ads<system-nucleus-arm.ads \
>    a-numaux.ads<a-numaux-vxworks.ads \
> @@ -2651,7 +2640,7 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
>  	$(RM) ../stamp-gnatlib-$(RTSDIR)
>  	touch ../stamp-gnatlib1-$(RTSDIR)
>  
> -ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
> +ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host_cpu) $(host_vendor) $(host_os))),)
>  OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \
>               -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c
>  


Grüße,
 Thomas
Paolo Bonzini - May 29, 2013, 2:21 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 29/05/2013 12:50, Thomas Schwinge ha scritto:
>>> How about we use something like the following [...] patch?  In 
>>> essence, replace the manual parsing in
>>> gcc/ada/gcc-interface/Makefile.in by using the values the
>>> configure script already computed for us.  This is largely
>>> straightforward (I would hope); please especially review the 
>>> more involved cases such as the one where I'm now using
>>> linux%eabi -- for example, does that do the right thing or
>>> interfere with the Android configurations?
>>> 
>>> The target_cpu_canonical substitution has been added in commit 
>>> 369e542b3ad1c0acfa9bfaeb72b338d8db5ba2ef (2009-02-27, r144463,
>>> schwab) but unused ever since, thus removed.
>>> 
>>> I'll now be testing for x86 GNU/Linux and GNU/Hurd; further
>>> testing appreciated.
> For these two configurations, I have now successfully tested the
> patch I posted.  Further review/testing appreciated.  (Adding
> »build machinery (*.in)« maintainers.)
> 
> 

I agree that using $(target_os) and linux% matches is a better way to
strip out the "-gnu"s.

The patch is long, but I think I reviewed it carefully enough.  It's
okay for mainline.

Regarding the android change:

> -ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if
> $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),) +ifeq
> ($(strip $(filter-out arm% linux%eabi,$(target_cpu)
> $(target_os))),)

This is okay, it will match arm-none-linux-androideabi both before and
after (perhaps linux-%eabi would be more readable).

However, it seems that the first androideabi snippet was dead code.
Can you delete it in a follow-up?

Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRpg7xAAoJEBvWZb6bTYbyEKgP/RI1fU8fEdzH1UK+3BG8sqgF
DSoK0mo25PBIGHYT8p4Qe2a9tE2fZys93NHufPmQnVQ1M/YqmB5JyspCoe0mqke0
fQUMI8DpV0f+g9MquIZFDYrceR4qGEaFZ9KlnHGcpErA5zs1Wb7Shj6SoWt4I3b3
2dQy61hD7DcVe1xctG349xU6Hc2j34VCk8axUcpFCm9iD6UBB8GAUmZCk6egkIJr
BWs9anasAhmh1E4aEOjGFvhWQcB23pmxSkIIk5wSkKBHZpHURIwXqOUmK1I0ebme
j7ee2+9SzSwk0emY4lBdDg14byVSvRMKnMDpFdIfHTJvYEqm6ha8jeNxBKqM/xvk
pz7AX1jwfsX22QSWiZuqcqqYBR0y7qVA0/5rjyFitLB85PY+yIfe5BNH4d5KdeuF
yDuss+n6vZrYCnyRpk0P4VbLQ5gnrtqDhxTKPABf3eMNFI6iyyadRh0qLQVrnyX5
qmUciuZTMouC4rAx1H/oAAHZbPmeHWS6cH7ggO0WlS5Us/Ws/s3OdFUePygXhQpL
xpOgqjSaDhE6s4PQAZkX79EOqvtEJynX/gGi3NTyZey/Fsp9n5JFperjAUfPG/Bt
2Cu7tDmcXLKlNKeaL7IuLppVPmVicfXTUAnYemWja78ijbbKLeD2W5OGzsfxTMuV
QoH7oqV2NqSIayTAmYg6
=Sh4D
-----END PGP SIGNATURE-----
Thomas Schwinge - May 29, 2013, 9:36 p.m.
Hi!

On Wed, 29 May 2013 16:21:38 +0200, Paolo Bonzini <bonzini@gnu.org> wrote:
> Il 29/05/2013 12:50, Thomas Schwinge ha scritto:
> >>> How about we use something like the following [...] patch?  In 
> >>> essence, replace the manual parsing in
> >>> gcc/ada/gcc-interface/Makefile.in by using the values the
> >>> configure script already computed for us.  This is largely
> >>> straightforward (I would hope); please especially review the 
> >>> more involved cases such as the one where I'm now using
> >>> linux%eabi -- for example, does that do the right thing or
> >>> interfere with the Android configurations?

> I agree that using $(target_os) and linux% matches is a better way to
> strip out the "-gnu"s.
> 
> The patch is long, but I think I reviewed it carefully enough.  It's
> okay for mainline.

Thanks for the review.  Before I commit however:

> Regarding the android change:
> 
> > -ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)
> > +ifeq ($(strip $(filter-out arm% linux%eabi,$(target_cpu) $(target_os))),)
> 
> This is okay, it will match arm-none-linux-androideabi both before and
> after

Well, upon more carful inspection I came to realize that the old/still
current code accepts arm-*-linux-*eabi but also plain arm-*-linux, which
my new code no longer accepts.  Is the old/still current behavior
intentional here, or a bug?  It has been introduced in commit
f49eb158fa5618dbd1130e47281e0bae13798ec6 (r192475):

gcc/ada/
2012-10-15  Matthias Klose  <doko@ubuntu.com>

	* gcc-interface/Makefile.in: Match arm*-*-linux-*eabi* for
	ARM Linux/GNU.

    -ifeq ($(strip $(filter-out arm% linux-gnueabi,$(arch) $(osys)-$(word 4,$(targ)))),)
    +ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)

From the description, I understand that change to mean any ARM,
Linux-kernel, EABI configuration with any kind of user-land, so my new
interpretation seems correct, and the current code wrong to also accept
plain arm-*-linux.  That change just cite should just have replaced
linux-gnueabi with linux-%eabi?

> (perhaps linux-%eabi would be more readable).

As soon as we've clarified the previous question, I'll do that change.


> However, it seems that the first androideabi snippet was dead code.
> Can you delete it in a follow-up?

That has been added in commit 7a5ee35f18bc945ec8abbcd1377c446352504e6e
(r193238):

2012-11-06  Arnaud Charlet  <charlet@adacore.com>

	[...]
	* gcc-interface/Makefile.in: Add runtime pairs for Android.
	Rework handling of s-oscons.ads.
	* s-osinte-android.ads, s-osinte-android.adb: New files.

    +ifeq ($(strip $(filter-out arm% linux-androideabi,$(arch) $(osys)-$(word 4,$(targ)))),)
    +  LIBGNAT_TARGET_PAIRS = \
    +  [...]
    +  s-osinte.adb<s-osinte-android.adb \
    +  s-osinte.ads<s-osinte-android.ads \
    +  [...]

Indeed I agree that the second snippet in the Makefile.in (as changed by
Matthias on 2012-10-15) triggers anytime the first one (as added by
Arnaud on 2012-11-06) triggered, so Arnaud's LIBGNAT_TARGET_PAIRS setting
will always be overwritten by Matthias', so to speak, and thus the new
s-osinte-android.* files never be used in the current code.  Arnaud,
Matthias, please clarify the intended behavior?  Of course I would assume
that for *-android* configurations the new s-osinte-android.* files be
used, but as Arnaud's change has gone in after Matthias', so this can
never have worked (unless I'm confused)?


Grüße,
 Thomas
Paolo Bonzini - May 30, 2013, 7:26 a.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 29/05/2013 23:36, Thomas Schwinge ha scritto:
> Hi!
> 
> On Wed, 29 May 2013 16:21:38 +0200, Paolo Bonzini <bonzini@gnu.org>
> wrote:
>> Il 29/05/2013 12:50, Thomas Schwinge ha scritto:
>>>>> How about we use something like the following [...] patch?
>>>>> In essence, replace the manual parsing in 
>>>>> gcc/ada/gcc-interface/Makefile.in by using the values the 
>>>>> configure script already computed for us.  This is largely 
>>>>> straightforward (I would hope); please especially review
>>>>> the more involved cases such as the one where I'm now
>>>>> using linux%eabi -- for example, does that do the right
>>>>> thing or interfere with the Android configurations?
> 
>> I agree that using $(target_os) and linux% matches is a better
>> way to strip out the "-gnu"s.
>> 
>> The patch is long, but I think I reviewed it carefully enough.
>> It's okay for mainline.
> 
> Thanks for the review.  Before I commit however:
> 
>> Regarding the android change:
>> 
>>> -ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if
>>> $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),) 
>>> +ifeq ($(strip $(filter-out arm% linux%eabi,$(target_cpu)
>>> $(target_os))),)
>> 
>> This is okay, it will match arm-none-linux-androideabi both
>> before and after
> 
> Well, upon more carful inspection I came to realize that the
> old/still current code accepts arm-*-linux-*eabi but also plain
> arm-*-linux, which my new code no longer accepts.  Is the old/still
> current behavior intentional here, or a bug?  It has been
> introduced in commit f49eb158fa5618dbd1130e47281e0bae13798ec6
> (r192475):

Looking at http://thread.gmane.org/gmane.comp.gcc.patches/265800, it's
a bug.  The right way would have been something like

$(if $(findstring eabi,$(word 4,$(targ))),,no-match)

Your patch fixes it.

It would be really really nice to move all this to fragments, using a
saner bash case statement to pick the right one.  It's a huge amount
of work though.

> gcc/ada/ 2012-10-15  Matthias Klose  <doko@ubuntu.com>
> 
> * gcc-interface/Makefile.in: Match arm*-*-linux-*eabi* for ARM
> Linux/GNU.
> 
> -ifeq ($(strip $(filter-out arm% linux-gnueabi,$(arch)
> $(osys)-$(word 4,$(targ)))),) +ifeq ($(strip $(filter-out
> arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word
> 4,$(targ))),,$(word 4,$(targ)))),)
> 
> From the description, I understand that change to mean any ARM, 
> Linux-kernel, EABI configuration with any kind of user-land, so my
> new interpretation seems correct, and the current code wrong to
> also accept plain arm-*-linux.  That change just cite should just
> have replaced linux-gnueabi with linux-%eabi?
> 
>> (perhaps linux-%eabi would be more readable).
> 
> As soon as we've clarified the previous question, I'll do that
> change.

Thanks.

>> However, it seems that the first androideabi snippet was dead
>> code. Can you delete it in a follow-up?
> 
> That has been added in commit
> 7a5ee35f18bc945ec8abbcd1377c446352504e6e (r193238):
> 
> 2012-11-06  Arnaud Charlet  <charlet@adacore.com>
> 
> [...] * gcc-interface/Makefile.in: Add runtime pairs for Android. 
> Rework handling of s-oscons.ads. * s-osinte-android.ads,
> s-osinte-android.adb: New files.
> 
> +ifeq ($(strip $(filter-out arm% linux-androideabi,$(arch)
> $(osys)-$(word 4,$(targ)))),) +  LIBGNAT_TARGET_PAIRS = \ +  [...] 
> +  s-osinte.adb<s-osinte-android.adb \ +
> s-osinte.ads<s-osinte-android.ads \ +  [...]
> 
> Indeed I agree that the second snippet in the Makefile.in (as
> changed by Matthias on 2012-10-15) triggers anytime the first one
> (as added by Arnaud on 2012-11-06) triggered, so Arnaud's
> LIBGNAT_TARGET_PAIRS setting will always be overwritten by
> Matthias', so to speak, and thus the new s-osinte-android.* files
> never be used in the current code.  Arnaud, Matthias, please
> clarify the intended behavior?  Of course I would assume that for
> *-android* configurations the new s-osinte-android.* files be used,
> but as Arnaud's change has gone in after Matthias', so this can 
> never have worked (unless I'm confused)?

I think it is an unintended conflict, but then I'd leave it to Arnaud
to move the second snippet after the first.

(This shows that, in such a conversion to bash case statements, the
order should be reversed).

Paolo

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRpv8VAAoJEBvWZb6bTYbydrAP/2l4gMGykKZGtqbj+/9ta0jm
IlKJ3tZ1u8LupMX75Rb6l7Cx3268WLoAZY1gGceQZuSWX6cD1KNkHR8uMEsgXwmR
WAyRmp8m0FXcQEGC2rdUvRmV0OXIJU/EWhNGiH70pCxteLR8z3/rFAlRUNXGko/o
1od0RaR2jlT2+EBNaKE6PwMdFG94b0qeXEEpFy3/f7jr/5e+E5tcq1YuMg06xs6Q
xMIG9QyQlUUbR5o/1J4MVdDGbL0APqMm/E0R7aUsGHpNFBdn2hurEvVx72ZWWXv/
loEBDIkiNQAdv0JGRSJ+NhreoyZbbRXHzZnMXc0coQyLe+wmn396MAWaCadF7Vie
lKXN0HRUHTHzeroZPExxOvcXWx/+orgZLlXMMdC/jG3oGiouNQnEuJbKul53hmWz
VD1g7gCDyvZBaksFfZcV9GKQKbstf0y4ONOSJP2MyqIhLAzDLy59winv9ph95ymM
B/DFN+u3XWMIh0LV4+ngL2afhRpbLyhP0BOzrnNqiJ5fB9RiRhEHXJ4VCnMongB2
DAX2Fw2bsqKgJDi5pKesvXpozyAou2rRi+MQPKvkuHSI5xMg0w1qMgmesoLugPEu
Z1vMAr8Hx76l8435or3R5yVAZaTKBGrLKZ/ZH+I9btiukG0jfXyEpGmKZXvN1kgE
1Xzwose5CFQk5OnZLYXZ
=NsI2
-----END PGP SIGNATURE-----
Arnaud Charlet - May 30, 2013, 1:44 p.m.
> >>> The target_cpu_canonical substitution has been added in commit
> >>> 369e542b3ad1c0acfa9bfaeb72b338d8db5ba2ef (2009-02-27, r144463,
> >>> schwab) but unused ever since, thus removed.
> >>> 
> >>> I'll now be testing for x86 GNU/Linux and GNU/Hurd; further
> >>> testing appreciated.
> > For these two configurations, I have now successfully tested the
> > patch I posted.  Further review/testing appreciated.  (Adding
> > »build machinery (*.in)« maintainers.)
> > 
> > 
> 
> I agree that using $(target_os) and linux% matches is a better way to
> strip out the "-gnu"s.
> 
> The patch is long, but I think I reviewed it carefully enough.  It's
> okay for mainline.

Not so fast, we are talking about the Ada build machinery which requires
an Ada maintainer to review it.

The patch seems to go in the right direction but needs careful review
which hasn't been done yet, so please hold on your change for now, thanks.

In other words, this change will impact basically all targets, so needs
either much more testing, or more review, which is on going.

Arno
Olivier Hainque - May 30, 2013, 9:08 p.m.
On May 30, 2013, at 15:44 , Arnaud Charlet <charlet@adacore.com> wrote:
> In other words, this change will impact basically all targets, so needs
> either much more testing, or more review, which is on going.

 Part of the issue comes from the need to support some targets
 with non-canonical names (in the configure --target sense) for
 which we want the canonical behavior except for a few variations
 in the Ada RTSes, for example powerpc-wrs-vxworksmils instead of
 powerpc-wrs-vxworksae.

 Adjusting the loads of case selections everywhere, missing some
 cases at times, to attempt materializing the 99.9% equivalence
 turned out problematic, and leveraging config.sub sounded a lot
 simpler and more appropriate.

 The idea of the "target->target_alias" change in gcc-interface/Makefile.in
 for Ada was to let us still distinguish for the purpose of the Ada RTSes in
 particular.

 This happens to be significant in a limited amount of cases only.

 We need to assess which ones and how best we could deal
 with the differences in a different manner if possible.

 Olivier
Olivier Hainque - May 31, 2013, 1:41 p.m.
On May 30, 2013, at 23:08 , Olivier Hainque <hainque@adacore.com> wrote:
> The idea of the "target->target_alias" change in gcc-interface/Makefile.in
> for Ada was to let us still distinguish for the purpose of the Ada RTSes in
> particular.
> 
> This happens to be significant in a limited amount of cases only.


 A very limited number of cases actually.

 * e500v? canonicalized as powerpc (in our tree), which is a
   non-issue because the pairs are all identical.

 * leon vs sparc-leon maybe, I'm not so sure but this should be
   straightforward to adjust in any case

 * vxworksmils canonicalized into vxworksae


 A safe and simple approach to this issue would be to

 - revert to our former computations, based on target and
   not target_alias. Revert the subsequent adjustments as
   well.

 - Remove the pointless and confusing references to e500,
   adjusting comments to indicate that e500 is canonicalized
   into powerpc

 - Use target_alias explicitly just at the points where
   we know that we need to depart from the canonical name

 The proposed idea of using the configure computed names instead of doing our
 own computations is interesting. It's sort of orthogonal and seems potentially
 disruptive as well, so I'd defer to a later moment.
Alexandre Oliva - June 2, 2013, 7:18 p.m.
On May 31, 2013, Olivier Hainque <hainque@adacore.com> wrote:

>  - revert to our former computations, based on target and
>    not target_alias. Revert the subsequent adjustments as
>    well.

*nod*

>  - Use target_alias explicitly just at the points where
>    we know that we need to depart from the canonical name

I suggest another approach: if there are significant differences between
the run-time systems, they ought to be preserved in the canonical target
names.  So, adjust config.sub so that it preserve them, and then we can
decide based on the canonical target name only.
Olivier Hainque - June 3, 2013, 8:59 p.m.
On Jun 2, 2013, at 21:18 , Alexandre Oliva <aoliva@redhat.com> wrote:
>> - Use target_alias explicitly just at the points where
>>   we know that we need to depart from the canonical name
> 
> I suggest another approach: if there are significant differences between
> the run-time systems, they ought to be preserved in the canonical target
> names.  So, adjust config.sub so that it preserve them, and then we can
> decide based on the canonical target name only.

 Can we do that without adding loads of
 instances of this canonical names in all the
 switch/case statements around ?

 The idea was trying not to go there because
 this is a maintenance pain, essentially pointless
 if the only differences are a couple of Ada
 RTS unit selections.
Olivier Hainque - June 4, 2013, 3:13 p.m.
On Jun 3, 2013, at 22:59 , Olivier Hainque <hainque@adacore.com> wrote:
>> I suggest another approach: if there are significant differences between
>> the run-time systems, they ought to be preserved in the canonical target
>> names.  So, adjust config.sub so that it preserve them, and then we can
>> decide based on the canonical target name only.
> 
> Can we do that without adding loads of
> instances of this canonical names in all the
> switch/case statements around ?
> 
> The idea was trying not to go there because
> this is a maintenance pain, essentially pointless
> if the only differences are a couple of Ada
> RTS unit selections.

 I can't help but thinking there might be something else that would deserve
 using a different canonical name. I need to dig in further to determine.

 Olivier

Patch

diff --git gcc/ada/gcc-interface/Makefile.in gcc/ada/gcc-interface/Makefile.in
index eeb8c7f..c07722b 100644
--- gcc/ada/gcc-interface/Makefile.in
+++ gcc/ada/gcc-interface/Makefile.in
@@ -151,12 +151,15 @@  GCC_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)
 program_transform_name =
 objdir = .
 
-target_alias=@target_alias@
 target=@target@
+target_cpu=@target_cpu@
+target_vendor=@target_vendor@
+target_os=@target_os@
+host_cpu=@host_cpu@
+host_vendor=@host_vendor@
+host_os=@host_os@
 xmake_file = @xmake_file@
 tmake_file = @tmake_file@
-host_canonical=@host@
-target_cpu_default=@target_cpu_default@
 #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
 #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
 
@@ -255,20 +258,6 @@  TOOLS_LIBS = targext.o link.o ../../ggc-none.o ../../libcommon-target.a \
   ../../../libbacktrace/.libs/libbacktrace.a ../../../libiberty/libiberty.a \
   $(SYSLIBS) $(TGT_LIB)
 
-# Convert the target variable into a space separated list of architecture,
-# manufacturer, and operating system and assign each of those to its own
-# variable.
-host:=$(subst -, ,$(host_canonical))
-targ:=$(subst -, ,$(subst -gnu, ,$(target_alias)))
-arch:=$(word 1,$(targ))
-ifeq ($(words $(targ)),2)
-  manu:=
-  osys:=$(word 2,$(targ))
-else
-  manu:=$(word 2,$(targ))
-  osys:=$(word 3,$(targ))
-endif
-
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
 # so that tm.h and config.h will be found in the compilation
@@ -280,7 +269,7 @@  ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
 # Likewise, but valid for subdirectories of the current dir.
 # FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in
 # that directory conflicts with a system header file.
-ifneq ($(findstring vxworks,$(osys)),)
+ifneq ($(findstring vxworks,$(target_os)),)
   INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
 			-iquote $(fsrcdir)/ada \
 			-I$(fsrcdir)/../include $(GMPINC)
@@ -348,16 +337,16 @@  GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
  uname.o urealp.o usage.o widechar.o \
  $(EXTRA_GNATMAKE_OBJS)
 
-# Make arch match the current multilib so that the RTS selection code
+# Make target_cpu match the current multilib so that the RTS selection code
 # picks up the right files. For a given target this must be coherent
 # with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
 
-ifeq ($(strip $(filter-out %x86_64, $(arch))),)
+ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
   ifeq ($(strip $(MULTISUBDIR)),/32)
-    arch:=i686
+    target_cpu := i686
   else
     ifeq ($(strip $(MULTISUBDIR)),/x32)
-      arch:=x32
+      target_cpu := x32
     endif
   endif
 endif
@@ -460,7 +449,7 @@  EXTRA_LIBGNAT_SRCS=
 # If what's left is null then it's a match.
 
 # m68k VxWorks
-ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out m68k% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-vxworks.ads \
   a-numaux.ads<a-numaux-vxworks.ads \
@@ -503,7 +492,7 @@  ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
 endif
 
 # PowerPC and e500v2 VxWorks
-ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
+ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-vxworks.ads \
   a-numaux.ads<a-numaux-vxworks.ads \
@@ -609,7 +598,7 @@  ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
 endif
 
 # PowerPC and e500v2 VxWorks 653
-ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
+ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(target_cpu) $(target_vendor) $(target_os))),)
   # target pairs for vthreads runtime
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
@@ -671,7 +660,7 @@  ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
 endif
 
 # PowerPC and e500v2 VxWorks MILS
-ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
+ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(target_cpu) $(target_vendor) $(target_os))),)
   # target pairs for vthreads runtime
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<a-elchha-vx6-raven-cert.adb \
@@ -721,7 +710,7 @@  ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
 endif
 
 # VxWorksae / VxWorks 653 for x86 (vxsim) - ?? VxWorks mils not implemented
-ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
+ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(target_cpu) $(target_vendor) $(target_os))),)
   # target pairs for kernel + vthreads runtime
   LIBGNAT_TARGET_PAIRS = \
   a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
@@ -781,7 +770,7 @@  ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
 endif
 
 # Sparc VxWorks
-ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-vxworks.ads \
   a-numaux.ads<a-numaux-vxworks.ads \
@@ -808,7 +797,7 @@  ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
   mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
   indepsw.adb<indepsw-gnu.adb
 
-  ifeq ($(strip $(filter-out sparc erc32 leon leon3, $(arch))),)
+  ifeq ($(strip $(filter-out sparc erc32 leon leon3, $(target_cpu))),)
     # 32-bits
     LIBGNAT_TARGET_PAIRS += \
     s-vxwork.ads<s-vxwork-sparc.ads \
@@ -833,7 +822,7 @@  ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
 endif
 
 # x86 VxWorks
-ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
+ifeq ($(strip $(filter-out %86 wrs vxworks,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-vxworks.ads \
   i-vxwork.ads<i-vxwork-x86.ads \
@@ -924,7 +913,7 @@  ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
 endif
 
 # ARM VxWorks
-ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-vxworks.ads \
   a-numaux.ads<a-numaux-vxworks.ads \
@@ -960,7 +949,7 @@  ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
 endif
 
 # MIPS VxWorks
-ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out mips% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-vxworks.ads \
   a-numaux.ads<a-numaux-vxworks.ads \
@@ -995,7 +984,7 @@  ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
   EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
 endif
 
-ifeq ($(strip $(filter-out arm% linux-androideabi,$(arch) $(osys)-$(word 4,$(targ)))),)
+ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1023,7 +1012,7 @@  ifeq ($(strip $(filter-out arm% linux-androideabi,$(arch) $(osys)-$(word 4,$(tar
 endif
 
 # Sparc Solaris
-ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
+ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-solaris.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1047,7 +1036,7 @@  ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
   $(ATOMICS_TARGET_PAIRS) \
   $(ATOMICS_BUILTINS_TARGET_PAIRS)
 
-  ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
+  ifeq ($(strip $(filter-out sparc sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
     ifeq ($(strip $(MULTISUBDIR)),/sparcv9)
       LIBGNAT_TARGET_PAIRS = \
       $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
@@ -1098,7 +1087,7 @@  ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
 endif
 
 # x86 and x86-64 solaris
-ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-solaris.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1123,7 +1112,7 @@  ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
   $(X86_64_TARGET_PAIRS) \
   system.ads<system-solaris-x86_64.ads
 
-  ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
+  ifeq ($(strip $(filter-out %86 solaris2%,$(target_cpu) $(target_os))),)
     ifeq ($(strip $(MULTISUBDIR)),/amd64)
       LIBGNAT_TARGET_PAIRS = \
       $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
@@ -1155,7 +1144,7 @@  ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
 endif
 
 # x86 Linux
-ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   a-synbar.adb<a-synbar-posix.adb \
@@ -1216,7 +1205,7 @@  ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
 endif
 
 # x86 kfreebsd
-ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-freebsd.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1247,7 +1236,7 @@  ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
   MISCLIB = -lutil
 endif
 
-ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-freebsd.ads \
   a-numaux.adb<a-numaux-x86.adb \
@@ -1276,7 +1265,7 @@  ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
 endif
 
 # x86 FreeBSD
-ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-freebsd.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1305,7 +1294,7 @@  ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
 endif
 
 # x86-64 FreeBSD
-ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-freebsd.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1334,7 +1323,7 @@  ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
 endif
 
 # x86 GNU/Hurd
-ifeq ($(strip $(filter-out %86 gnu%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 gnu%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
     a-intnam.ads<a-intnam-freebsd.ads \
     s-inmaop.adb<s-inmaop-posix.adb \
@@ -1363,7 +1352,7 @@  ifeq ($(strip $(filter-out %86 gnu%,$(arch) $(osys))),)
 endif
 
 # S390 Linux
-ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1384,7 +1373,7 @@  ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
   LIBGNAT_TARGET_PAIRS_64 = \
   system.ads<system-linux-s390x.ads
 
-  ifeq ($(strip $(filter-out s390x,$(arch))),)
+  ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
     ifeq ($(strip $(MULTISUBDIR)),/32)
       LIBGNAT_TARGET_PAIRS = \
       $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
@@ -1409,7 +1398,7 @@  ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
 endif
 
 # HP/PA HP-UX 10
-ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
+ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-excpol.adb<a-excpol-abort.adb \
   a-intnam.ads<a-intnam-hpux.ads \
@@ -1429,7 +1418,7 @@  ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
 endif
 
 # HP/PA HP-UX 11
-ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
+ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-hpux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1456,7 +1445,7 @@  ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
 endif
 
 # IBM AIX
-ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
+ifeq ($(strip $(filter-out ibm aix%,$(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-aix.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1500,7 +1489,7 @@  ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
 endif
 
 # RTEMS
-ifeq ($(strip $(filter-out rtems%,$(osys))),)
+ifeq ($(strip $(filter-out rtems%,$(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   system.ads<system-rtems.ads \
   a-intnam.ads<a-intnam-rtems.ads \
@@ -1518,7 +1507,7 @@  ifeq ($(strip $(filter-out rtems%,$(osys))),)
 endif
 
 # OpenVMS (host)
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host_cpu) $(host_vendor) $(host_os))),)
 
 soext  = .exe
 hyphen = _
@@ -1528,7 +1517,7 @@  LN_S = cp -p
 endif
 
 # OpenVMS (target)
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
     a-caldel.adb<a-caldel-vms.adb \
     a-calend.adb<a-calend-vms.adb \
@@ -1562,7 +1551,7 @@  ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
     s-tpopde.adb<s-tpopde-vms.adb \
     s-tpopde.ads<s-tpopde-vms.ads
 
-  ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
+  ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(target_cpu) $(target_vendor) $(target_os))),)
     LIBGNAT_TARGET_PAIRS += \
       g-enblsp.adb<g-enblsp-vms-ia64.adb \
       g-trasym.adb<g-trasym-vms-ia64.adb \
@@ -1582,7 +1571,7 @@  ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
       symbols.adb<symbols-vms.adb \
       symbols-processing.adb<symbols-processing-vms-ia64.adb
   else
-    ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
+    ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(target_cpu) $(target_vendor) $(target_os))),)
       LIBGNAT_TARGET_PAIRS += \
         g-enblsp.adb<g-enblsp-vms-alpha.adb \
         g-trasym.adb<g-trasym-vms-alpha.adb \
@@ -1621,21 +1610,21 @@  ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
 endif
 
 # *-elf
-ifeq ($(strip $(filter-out lmp avr none powerpc% eabispe leon% erc32% unknown elf,$(targ))),)
+ifeq ($(strip $(filter-out lmp avr none powerpc% eabispe leon% erc32% unknown elf,$(target_cpu) $(target_vendor) $(target_os))),)
   TOOLS_TARGET_PAIRS=\
   mlib-tgt-specific.adb<mlib-tgt-specific-xi.adb \
   indepsw.adb<indepsw-gnu.adb
 endif
 
 # Cygwin/Mingw32
-ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
+ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
   # Cygwin provides a full Posix environment, and so we use the default
   # versions of s-memory and g-socthi rather than the Windows-specific
   # MinGW versions.  Ideally we would use all the default versions for
   # Cygwin and none of the MinGW versions, but for historical reasons
   # the Cygwin port has always been a CygMing frankenhybrid and it is
   # a long-term project to disentangle them.
-  ifeq ($(strip $(filter-out cygwin%,$(osys))),)
+  ifeq ($(strip $(filter-out cygwin%,$(target_os))),)
     LIBGNAT_TARGET_PAIRS = \
     s-memory.adb<s-memory.adb \
     g-socthi.ads<g-socthi.ads \
@@ -1693,7 +1682,7 @@  ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
     s-osprim.adb<s-osprim-mingw.adb \
     s-taprop.adb<s-taprop-mingw.adb
 
-    ifeq ($(strip $(filter-out x86_64%,$(arch))),)
+    ifeq ($(strip $(filter-out x86_64%,$(target_cpu))),)
       ifeq ($(strip $(MULTISUBDIR)),/32)
 	LIBGNAT_TARGET_PAIRS += \
 	  $(X86_TARGET_PAIRS) \
@@ -1744,7 +1733,7 @@  ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
 endif
 
 # Mips Linux
-ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out mips linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1768,7 +1757,7 @@  ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
 endif
 
 # Mips/el Linux
-ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out mipsel linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1811,7 +1800,7 @@  ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
 endif
 
 # Mips64/el Linux
-ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out mips64el linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1854,7 +1843,7 @@  ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
 endif
 
 # PowerPC and e500v2 Linux
-ifeq ($(strip $(filter-out powerpc% e500% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out powerpc% e500% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-exetim.adb<a-exetim-posix.adb \
   a-exetim.ads<a-exetim-default.ads \
@@ -1917,7 +1906,7 @@  ifeq ($(strip $(filter-out powerpc% e500% linux%,$(arch) $(osys))),)
   LIBRARY_VERSION := $(LIB_VERSION)
 endif
 
-ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)
+ifeq ($(strip $(filter-out arm% linux%eabi,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1932,7 +1921,7 @@  ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(
   s-taspri.ads<s-taspri-posix-noaltstack.ads \
   s-tpopsp.adb<s-tpopsp-posix-foreign.adb
 
-  ifeq ($(strip $(filter-out arm%b,$(arch))),)
+  ifeq ($(strip $(filter-out arm%b,$(target_cpu))),)
     LIBGNAT_TARGET_PAIRS += \
     system.ads<system-linux-armeb.ads
   else
@@ -1953,7 +1942,7 @@  ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(
 endif
 
 # Sparc Linux
-ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS_COMMON = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -1995,7 +1984,7 @@  ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
 endif
 
 # HP/PA Linux
-ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -2024,7 +2013,7 @@  ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
 endif
 
 # SH4 Linux
-ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -2054,7 +2043,7 @@  ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
 endif
 
 # IA64 Linux
-ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-exetim.adb<a-exetim-posix.adb \
   a-exetim.ads<a-exetim-default.ads \
@@ -2093,7 +2082,7 @@  ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
 endif
 
 # IA64 HP-UX
-ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
+ifeq ($(strip $(filter-out ia64% hp hpux%,$(target_cpu) $(target_vendor) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-hpux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -2122,7 +2111,7 @@  ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
 endif
 
 # Alpha Linux
-ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
@@ -2153,7 +2142,7 @@  ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
 endif
 
 # x86-64 Linux
-ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-exetim.adb<a-exetim-posix.adb \
   a-exetim.ads<a-exetim-default.ads \
@@ -2190,7 +2179,7 @@  ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
   LIBRARY_VERSION := $(LIB_VERSION)
 endif
 
-ifeq ($(strip $(filter-out %x32 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-exetim.adb<a-exetim-posix.adb \
   a-exetim.ads<a-exetim-default.ads \
@@ -2228,7 +2217,7 @@  ifeq ($(strip $(filter-out %x32 linux%,$(arch) $(osys))),)
 endif
 
 # Darwin (Mac OS X)
-ifeq ($(strip $(filter-out darwin%,$(osys))),)
+ifeq ($(strip $(filter-out darwin%,$(target_os))),)
   SO_OPTS = -shared-libgcc
   LIBGNAT_TARGET_PAIRS = \
     a-intnam.ads<a-intnam-darwin.ads \
@@ -2239,7 +2228,7 @@  ifeq ($(strip $(filter-out darwin%,$(osys))),)
     s-taspri.ads<s-taspri-posix.ads \
     s-tpopsp.adb<s-tpopsp-posix-foreign.adb
 
-  ifeq ($(strip $(filter-out %86,$(arch))),)
+  ifeq ($(strip $(filter-out %86,$(target_cpu))),)
     LIBGNAT_TARGET_PAIRS += \
       s-intman.adb<s-intman-susv3.adb \
       s-osprim.adb<s-osprim-darwin.adb \
@@ -2259,7 +2248,7 @@  ifeq ($(strip $(filter-out darwin%,$(osys))),)
     EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
   endif
 
-  ifeq ($(strip $(filter-out %x86_64,$(arch))),)
+  ifeq ($(strip $(filter-out %x86_64,$(target_cpu))),)
     LIBGNAT_TARGET_PAIRS += \
       s-intman.adb<s-intman-susv3.adb \
       s-osprim.adb<s-osprim-darwin.adb \
@@ -2279,7 +2268,7 @@  ifeq ($(strip $(filter-out darwin%,$(osys))),)
     EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
   endif
 
-  ifeq ($(strip $(filter-out powerpc%,$(arch))),)
+  ifeq ($(strip $(filter-out powerpc%,$(target_cpu))),)
     LIBGNAT_TARGET_PAIRS += \
       s-intman.adb<s-intman-posix.adb \
       s-osprim.adb<s-osprim-posix.adb \
@@ -2309,7 +2298,7 @@  ifeq ($(strip $(filter-out darwin%,$(osys))),)
 endif
 
 # ARM Nucleus
-ifeq ($(strip $(filter-out arm nucleus%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out arm nucleus%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   system.ads<system-nucleus-arm.ads \
   a-numaux.ads<a-numaux-vxworks.ads \
@@ -2651,7 +2640,7 @@  install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
 	$(RM) ../stamp-gnatlib-$(RTSDIR)
 	touch ../stamp-gnatlib1-$(RTSDIR)
 
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host_cpu) $(host_vendor) $(host_os))),)
 OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \
              -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c