# $(strip STRING) removes leading and trailing spaces from STRING.
# If what's left is null then it's a match.
+# Setup to make sure at most one match gets selected, useful for android
+# targets which are canonically configured with a linux-android target_os,
+# which would match filtering patterns such as linux% intended to match
+# only regular linux or linux64 variants.
+
+# The current set of selected pairs. A new match remains allowed
+# as long as this isn't assigned a new value.
+SELECTED_PAIRS=PAIRS_NONE
+
# PowerPC VxWorks6 and VxWorks7
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworks7%, $(target_cpu) $(target_vendor) $(target_os))),)
+ SELECTED_PAIRS=powerpc-vxworks
+
ifeq ($(strip $(filter-out powerpc64, $(target_cpu))),)
ARCH_STR=ppc64
else
GCC_SPEC_FILES+=vxworks-smp-$(ARCH_STR)-link.spec
endif
endif
+endif
# x86/x86_64 VxWorks7
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks7%, $(target_cpu) $(target_vendor) $(target_os))),)
+ SELECTED_PAIRS=x86-vxworks7
+
LIBGNAT_TARGET_PAIRS= \
a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
i-vxwork.ads<libgnat/i-vxwork__x86.ads \
GCC_SPEC_FILES+=vxworks7-$(X86CPU)-rtp-base-link.spec
endif
+endif
# ARM and Aarch64 VxWorks7
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out aarch64 arm wrs vxworks7%, $(target_cpu) $(target_vendor) $(target_os))),)
+ SELECTED_PAIRS=arm-vxworks7
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
a-naliop.ads<libgnat/a-naliop__nolibm.ads \
GCC_SPEC_FILES+=vxworks7-rtp-base-link.spec
endif
+endif
+
+# ARM and AARCH64 Android
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
+ifeq ($(strip $(filter-out arm% aarch64 linux-android%,$(target_cpu) $(target_os))),)
-# ARM android
-ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
- EXTRA_LIBGNAT_OBJS+=sigtramp-armdroid.o
+
+ # 32bit arm relies on a sigtramp for signal->exception propagation
+ # while aarch64 relies on kernel dwarf CFI. And as a 64bit target,
+ # aarch64 can also incorporate support for 128bit arithmetic.
+
+ ifeq ($(strip $(filter-out arm%, $(target_cpu))),)
+ SELECTED_PAIRS=arm-android
+
+ EH_MECHANISM=-arm
+ SIGTRAMP_OBJ=sigtramp-armdroid.o
+ else
+ SELECTED_PAIRS=aarch64-android
+
+ EH_MECHANISM=-gcc
+ SIGTRAMP_OBJ=
+
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
+ endif
+
+ EXTRA_LIBGNAT_OBJS+=$(SIGTRAMP_OBJ)
EXTRA_LIBGNAT_SRCS+=sigtramp.h
- EH_MECHANISM=-arm
THREADSLIB =
GNATLIB_SHARED = gnatlib-shared-dual
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# ARM and AARCH64 QNX
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out arm aarch64 %qnx,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=arm-qnx
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__qnx.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
THREADSLIB=
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# SPARC Solaris
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
+
+ SELECTED_PAIRS=sparc-solaris
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__solaris.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# x86 and x86-64 Solaris
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86-solaris
+
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<libgnarl/a-intnam__solaris.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# x86 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-synbar.adb<libgnarl/a-synbar__posix.adb \
GNATLIBCFLAGS_FOR_GCCSJLJ+=-fno-omit-frame-pointer -momit-leaf-frame-pointer
endif
+endif
# x86 kfreebsd
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86-kfreebsd
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
LIBRARY_VERSION := $(LIB_VERSION)
MISCLIB = -lutil
endif
+endif
# i[3456]86-pc-gnu i.e. GNU Hurd
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86 pc gnu,$(target_cpu) $(target_vendor) $(target_os))),)
+
+ SELECTED_PAIRS=x86-gnuhurd
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# x86-64 kfreebsd
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86_64-kfreebsd
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# aarch64 FreeBSD
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %aarch64 freebsd%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=aarch64-freebsd
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
LIBRARY_VERSION := $(LIB_VERSION)
MISCLIB = -lutil
endif
+endif
# x86 FreeBSD
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86-freebsd
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
LIBRARY_VERSION := $(LIB_VERSION)
MISCLIB = -lutil
endif
+endif
# x86-64 FreeBSD
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86_64-freebsd
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
LIBRARY_VERSION := $(LIB_VERSION)
MISCLIB = -lutil
endif
+endif
# x86-64 DragonFly
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86_64-dragonfly
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__dragonfly.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
LIBRARY_VERSION := $(LIB_VERSION)
MISCLIB = -lutil
endif
+endif
# S390 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=s390-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
GNATLIB_SHARED = gnatlib-shared-dual
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# HP/PA HP-UX 10
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),)
+
+ SELECTED_PAIRS=hppa-hpux10
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__hpux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
EH_MECHANISM=-gcc
endif
+endif
# HP/PA HP-UX 11
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) $(target_vendor) $(target_os))),)
+
+ SELECTED_PAIRS=hppa-hpux11
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__hpux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GNATLIB_SHARED = gnatlib-shared-dual
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# IBM AIX
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out ibm aix%,$(target_vendor) $(target_os))),)
+
+ SELECTED_PAIRS=ibm-aix
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__aix.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
endif
+endif
# LynxOS 178 and LynxOS 178 Elf
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out lynxos178%,$(target_os))),)
+
+ SELECTED_PAIRS=lynx178
+
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
LIBGNAT_TARGET_PAIRS = \
EH_MECHANISM=-gcc
endif
+endif
# RTEMS
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out rtems%,$(target_os))),)
+
+ SELECTED_PAIRS=rtems
+
LIBGNAT_TARGET_PAIRS = \
system.ads<libgnat/system-rtems.ads \
a-intnam.ads<libgnarl/a-intnam__rtems.ads \
$(ATOMICS_BUILTINS_TARGET_PAIRS)
endif
endif
+endif
# PikeOS
ifeq ($(strip $(filter-out powerpc% %86 sysgo pikeos,$(target_cpu) $(target_vendor) $(target_os)))),)
TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
endif
+# gjgpp
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %djgpp,$(target_os))),)
+
+ SELECTED_PAIRS=djgpp
GNATRTL_SOCKETS_OBJS =
LIBGNAT_TARGET_PAIRS = \
EH_MECHANISM=-gcc
endif
+endif
# Cygwin/Mingw32
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
+
+ SELECTED_PAIRS=cygming
+
# Cygwin provides a full Posix environment, and so we use the default
# versions g-socthi rather than the Windows-specific MinGW version.
# Ideally we would use all the default versions for Cygwin and none
soext = .dll
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# LoongArch Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=loongarch-linux
+
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
GNATLIBCFLAGS += -mno-strict-align
GNATLIBCFLAGS_FOR_C += -mno-strict-align
endif
-
+endif
# Mips Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=mips-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# PowerPC and e500v2 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=powerpc-linux
+
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# ARM linux, GNU eabi
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=arm-linux-gnueabi
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# AArch64 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=aarch64-linux
+
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# SPARC Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=sparc-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# HP/PA Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=hppa-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# M68K Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out m68k% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=m68k-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# SH4 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=sh4-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# IA64 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=ia64-linux
+
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# IA64 HP-UX
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out ia64% hp hpux%,$(target_cpu) $(target_vendor) $(target_os))),)
+
+ SELECTED_PAIRS=ia64-hpux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__hpux.ads \
s-dorepr.adb<libgnat/s-dorepr__fma.adb \
SO_OPTS = -Wl,+h,
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# Alpha Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=alpha-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
GNATLIB_SHARED=gnatlib-shared-dual
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# x86-64 Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x86_64-linux
+
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
GNATLIBCFLAGS_FOR_GCCSJLJ+=-fno-omit-frame-pointer -momit-leaf-frame-pointer
endif
+endif
+# x32-linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=x32-linux
+
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# RISC-V Linux
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) $(target_os))),)
+
+ SELECTED_PAIRS=riscv-linux
+
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
endif
+endif
# Darwin (Mac OS X)
+ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
ifeq ($(strip $(filter-out darwin%,$(target_os))),)
+
+ SELECTED_PAIRS=darwin
+
SO_OPTS = -shared-libgcc
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__darwin.ads \
soext = .dylib
GCC_LINK_FLAGS=-static-libstdc++
endif
+endif
ifeq ($(EH_MECHANISM),-gcc)
LIBGNAT_TARGET_PAIRS += \