1# Makefile for GNU Ada Compiler (GNAT).
2#   Copyright (C) 1994-2017 Free Software Foundation, Inc.
3
4#This file is part of GCC.
5
6#GCC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 3, or (at your option)
9#any later version.
10
11#GCC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License
17#along with GCC; see the file COPYING3.  If not see
18#<http://www.gnu.org/licenses/>.
19
20# The makefile built from this file lives in the language subdirectory.
21# Its purpose is to provide support for:
22#
23# 1) recursion where necessary, and only then (building .o's), and
24# 2) building and debugging cc1 from the language subdirectory, and
25# 3) nothing else.
26#
27# The parent makefile handles all other chores, with help from the
28# language makefile fragment, of course.
29#
30# The targets for external use are:
31# all, TAGS, ???mostlyclean, ???clean.
32
33# This makefile will only work with Gnu make.
34# The rules are written assuming a minimum subset of tools are available:
35#
36# Required:
37#      MAKE:    Only Gnu make will work.
38#      MV:      Must accept (at least) one, maybe wildcard, source argument,
39#               a file or directory destination, and support creation/
40#               modification date preservation.  Gnu mv -f works.
41#      RM:      Must accept an arbitrary number of space separated file
42#               arguments, or one wildcard argument. Gnu rm works.
43#      RMDIR:   Must delete a directory and all its contents. Gnu rm -rf works.
44#      ECHO:    Must support command line redirection. Any Unix-like
45#               shell will typically provide this, otherwise a custom version
46#               is trivial to write.
47#      AR:      Gnu ar works.
48#      MKDIR:   Gnu mkdir works.
49#      CHMOD:   Gnu chmod works.
50#      true:    Does nothing and returns a normal successful return code.
51#      pwd:     Prints the current directory on stdout.
52#      cd:      Change directory.
53#
54# Optional:
55#      BISON:   Gnu bison works.
56#      FLEX:    Gnu flex works.
57#      Other miscellaneous tools for obscure targets.
58
59# Suppress smart makes who think they know how to automake Yacc files
60.y.c:
61
62# Variables that exist for you to override.
63# See below for how to change them for certain systems.
64
65# Various ways of specifying flags for compilations:
66# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
67# BOOT_CFLAGS is the value of CFLAGS to pass
68# to the stage2 and stage3 compilations
69CFLAGS = -g
70BOOT_CFLAGS = -O $(CFLAGS)
71# These exists to be overridden by the t-* files, respectively.
72T_CFLAGS =
73
74CC = cc
75BISON = bison
76BISONFLAGS =
77ECHO = echo
78LEX = flex
79LEXFLAGS =
80CHMOD = chmod
81LN = ln
82LN_S = ln -s
83CP = cp -p
84MV = mv -f
85RM = rm -f
86RMDIR = rm -rf
87MKDIR = mkdir -p
88AR = ar
89AR_FLAGS = rc
90LS = ls
91RANLIB = @RANLIB@
92RANLIB_FLAGS = @ranlib_flags@
93AWK = @AWK@
94
95COMPILER = $(CC)
96COMPILER_FLAGS = $(CFLAGS)
97
98SHELL = @SHELL@
99PWD_COMMAND = $${PWDCMD-pwd}
100# How to copy preserving the date
101INSTALL_DATA_DATE = cp -p
102MAKEINFO = makeinfo
103TEXI2DVI = texi2dvi
104TEXI2PDF = texi2pdf
105GNATBIND_FLAGS = -static -x
106ADA_CFLAGS =
107ADAFLAGS = -W -Wall -gnatpg -gnata
108FORCE_DEBUG_ADAFLAGS = -g
109NO_INLINE_ADAFLAGS = -fno-inline
110NO_OMIT_ADAFLAGS = -fno-omit-frame-pointer
111NO_SIBLING_ADAFLAGS = -fno-optimize-sibling-calls
112NO_REORDER_ADAFLAGS = -fno-toplevel-reorder
113GNATLIBFLAGS = -W -Wall -gnatpg -nostdinc
114GNATLIBCFLAGS = -g -O2
115# Pretend that _Unwind_GetIPInfo is available for the target by default.  This
116# should be autodetected during the configuration of libada and passed down to
117# here, but we need something for --disable-libada and hope for the best.
118GNATLIBCFLAGS_FOR_C = \
119  -W -Wall $(GNATLIBCFLAGS) -fexceptions -DIN_RTS -DHAVE_GETIPINFO
120PICFLAG_FOR_TARGET = @PICFLAG_FOR_TARGET@
121ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
122THREAD_KIND = native
123THREADSLIB =
124GMEM_LIB =
125MISCLIB =
126OUTPUT_OPTION = -o $@
127
128objext = .o
129exeext =
130arext  = .a
131soext  = .so
132shext  =
133hyphen = -
134
135# program_transform_name and objdir are set by configure.ac.
136program_transform_name =
137objdir = .
138
139target_alias=@target_alias@
140target=@target@
141target_cpu=@target_cpu@
142target_vendor=@target_vendor@
143target_os=@target_os@
144host_cpu=@host_cpu@
145host_vendor=@host_vendor@
146host_os=@host_os@
147target_cpu_default = @target_cpu_default@
148xmake_file = @xmake_file@
149tmake_file = @tmake_file@
150#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
151#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
152
153# Directory where sources are, from where we are.
154VPATH = $(srcdir)/ada
155
156# Full path to top source directory
157# In particular this is used to access libgcc headers, so that references to
158# these headers from GNAT runtime objects have path names in debugging info
159# that are consistent with libgcc objects.  Also used for other references to
160# the top source directory for consistency.
161ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND})
162
163fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND})
164fsrcpfx := $(shell cd $(srcdir);${PWD_COMMAND})/
165fcurdir := $(shell ${PWD_COMMAND})
166fcurpfx := $(shell ${PWD_COMMAND})/
167
168# Top build directory, relative to here.
169top_builddir = ../..
170
171# Internationalization library.
172LIBINTL = @LIBINTL@
173LIBINTL_DEP = @LIBINTL_DEP@
174
175# Character encoding conversion library.
176LIBICONV = @LIBICONV@
177LIBICONV_DEP = @LIBICONV_DEP@
178
179# Any system libraries needed just for GNAT.
180SYSLIBS = @GNAT_LIBEXC@
181
182# List extra gnattools
183EXTRA_GNATTOOLS =
184
185# List of target dependent sources, overridden below as necessary
186TARGET_ADA_SRCS =
187
188# Type of tools build we are doing; default is not compiling tools.
189TOOLSCASE =
190
191# Multilib handling
192MULTISUBDIR =
193RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
194
195# Link flags used to build gnat tools.  By default we prefer to statically
196# link with libgcc to avoid a dependency on shared libgcc (which is tricky
197# to deal with as it may conflict with the libgcc provided by the system).
198GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc
199
200# End of variables for you to override.
201
202all: all.indirect
203
204# This tells GNU Make version 3 not to put all variables in the environment.
205.NOEXPORT:
206
207# target overrides
208ifneq ($(tmake_file),)
209include $(tmake_file)
210endif
211
212# host overrides
213ifneq ($(xmake_file),)
214include $(xmake_file)
215endif
216
217# Now figure out from those variables how to compile and link.
218
219all.indirect: Makefile ../gnat1$(exeext)
220
221# IN_GCC is meant to distinguish between code compiled into GCC itself, i.e.
222# for the host, and the rest.  But we also use it for the tools (link.c) and
223# even break the host/target wall by using it for the library (targext.c).
224# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross
225# compiler which does not use the native libraries and headers.
226INTERNAL_CFLAGS = @CROSS@ -DIN_GCC
227
228# This is the variable actually used when we compile.
229ALL_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)
230
231# Likewise.
232ALL_CPPFLAGS = $(CPPFLAGS)
233
234# Used with $(COMPILER).
235ALL_COMPILERFLAGS = $(ALL_CFLAGS)
236
237# This is where we get libiberty.a from.
238LIBIBERTY = ../../libiberty/libiberty.a
239
240# We need to link against libbacktrace because diagnostic.c in
241# libcommon.a uses it.
242LIBBACKTRACE = ../../libbacktrace/.libs/libbacktrace.a
243
244# How to link with both our special library facilities
245# and the system's installed libraries.
246LIBS = $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) $(LIBIBERTY) $(SYSLIBS)
247LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBBACKTRACE) $(LIBIBERTY)
248# Default is no TGT_LIB; one might be passed down or something
249TGT_LIB =
250TOOLS_LIBS = ../link.o ../targext.o ../../ggc-none.o ../../libcommon-target.a \
251  ../../libcommon.a ../../../libcpp/libcpp.a $(LIBGNAT) $(LIBINTL) $(LIBICONV) \
252  ../$(LIBBACKTRACE) ../$(LIBIBERTY) $(SYSLIBS) $(TGT_LIB)
253
254# Add -no-pie to TOOLS_LIBS since some of them are compiled with -fno-PIE.
255TOOLS_LIBS += @NO_PIE_FLAG@
256
257# Specify the directories to be searched for header files.
258# Both . and srcdir are used, in that order,
259# so that tm.h and config.h will be found in the compilation
260# subdirectory rather than in the source directory.
261INCLUDES = -iquote . -iquote .. -iquote $(srcdir)/ada -iquote $(srcdir) \
262	   -I $(ftop_srcdir)/include $(GMPINC)
263
264ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
265
266# Likewise, but valid for subdirectories of the current dir.
267# FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in
268# that directory conflicts with a system header file.
269ifneq ($(findstring vxworks,$(target_os)),)
270  INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
271			-iquote $(fsrcdir)/ada \
272			-I$(ftop_srcdir)/include $(GMPINC)
273else
274  INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
275			-iquote $(fsrcdir)/ada -iquote $(fsrcdir) \
276			-I$(ftop_srcdir)/include $(GMPINC)
277endif
278
279ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
280
281# Avoid a lot of time thinking about remaking Makefile.in and *.def.
282.SUFFIXES: .in .def
283
284# Say how to compile Ada programs.
285.SUFFIXES: .ada .adb .ads .asm
286
287# Always use -I$(srcdir)/config when compiling.
288.asm.o:
289	$(CC) -c -x assembler $< $(OUTPUT_OPTION)
290
291.c.o:
292	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
293	  $(INCLUDES) $< $(OUTPUT_OPTION)
294
295.adb.o:
296	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
297
298.ads.o:
299	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
300
301# how to regenerate this file
302Makefile: ../config.status $(srcdir)/ada/gcc-interface/Makefile.in $(srcdir)/ada/Makefile.in $(srcdir)/version.c
303	cd ..; \
304	LANGUAGES="$(CONFIG_LANGUAGES)" \
305	CONFIG_HEADERS= \
306	CONFIG_FILES="ada/gcc-interface/Makefile ada/Makefile" $(SHELL) config.status
307
308# This tells GNU make version 3 not to export all the variables
309# defined in this file into the environment.
310.NOEXPORT:
311
312# Lists of files for various purposes.
313
314GNATLINK_OBJS = gnatlink.o \
315 a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \
316 gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \
317 osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
318 sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
319 types.o validsw.o widechar.o
320
321GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
322 atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o errout.o \
323 erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
324 gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
325 make.o makeusg.o make_util.o namet.o nlists.o opt.o osint.o osint-m.o \
326 output.o restrict.o rident.o s-exctab.o \
327 s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \
328 s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \
329 snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \
330 switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o uintp.o \
331 uname.o urealp.o usage.o widechar.o \
332 $(EXTRA_GNATMAKE_OBJS)
333
334# Make arch match the current multilib so that the RTS selection code
335# picks up the right files. For a given target this must be coherent
336# with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
337
338ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
339  ifeq ($(strip $(MULTISUBDIR)),/32)
340    target_cpu:=i686
341  else
342    ifeq ($(strip $(MULTISUBDIR)),/x32)
343      target_cpu:=x32
344    endif
345  endif
346endif
347
348# ???: handle more multilib targets
349
350# LIBGNAT_TARGET_PAIRS is a list of pairs of filenames.
351# The members of each pair must be separated by a '<' and no whitespace.
352# Each pair must be separated by some amount of whitespace from the following
353# pair.
354
355# Non-tasking case:
356
357LIBGNAT_TARGET_PAIRS = \
358a-intnam.ads<libgnarl/a-intnam__dummy.ads \
359s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
360s-intman.adb<libgnarl/s-intman__dummy.adb \
361s-osinte.ads<libgnarl/s-osinte__dummy.ads \
362s-osprim.adb<libgnat/s-osprim__posix.adb \
363s-taprop.adb<libgnarl/s-taprop__dummy.adb \
364s-taspri.ads<libgnarl/s-taspri__dummy.ads
365
366# When using the GCC exception handling mechanism, we need to use an
367# alternate body for a-exexpr.adb (a-exexpr-gcc.adb)
368
369EH_MECHANISM=
370
371# Default shared object option. Note that we rely on the fact that the "soname"
372# option will always be present and last in this flag, so that we can have
373# $(SO_OPTS)libgnat-x.xx
374
375SO_OPTS = -Wl,-soname,
376
377# Default gnatlib-shared target.
378# By default, equivalent to gnatlib.
379# Set to gnatlib-shared-default, gnatlib-shared-dual, or a platform specific
380# target when supported.
381GNATLIB_SHARED = gnatlib
382
383# By default, build socket support units. On platforms that do not support
384# sockets, reset this variable to empty and add DUMMY_SOCKETS_TARGET_PAIRS
385# to LIBGNAT_TARGET_PAIRS.
386
387GNATRTL_SOCKETS_OBJS = g-soccon$(objext) g-socket$(objext) g-socthi$(objext) \
388  g-soliop$(objext) g-sothco$(objext)
389
390DUMMY_SOCKETS_TARGET_PAIRS = \
391  g-socket.adb<libgnat/g-socket__dummy.adb \
392  g-socket.ads<libgnat/g-socket__dummy.ads \
393  g-socthi.adb<libgnat/g-socthi__dummy.adb \
394  g-socthi.ads<libgnat/g-socthi__dummy.ads \
395  g-sothco.adb<libgnat/g-sothco__dummy.adb \
396  g-sothco.ads<libgnat/g-sothco__dummy.ads
397
398# On platforms where atomic increment/decrement operations are supported,
399# special version of Ada.Strings.Unbounded package can be used.
400
401ATOMICS_TARGET_PAIRS = \
402  a-coinho.adb<libgnat/a-coinho__shared.adb \
403  a-coinho.ads<libgnat/a-coinho__shared.ads \
404  a-stunau.adb<libgnat/a-stunau__shared.adb \
405  a-suteio.adb<libgnat/a-suteio__shared.adb \
406  a-strunb.ads<libgnat/a-strunb__shared.ads \
407  a-strunb.adb<libgnat/a-strunb__shared.adb \
408  a-stwiun.adb<libgnat/a-stwiun__shared.adb \
409  a-stwiun.ads<libgnat/a-stwiun__shared.ads \
410  a-swunau.adb<libgnat/a-swunau__shared.adb \
411  a-swuwti.adb<libgnat/a-swuwti__shared.adb \
412  a-stzunb.adb<libgnat/a-stzunb__shared.adb \
413  a-stzunb.ads<libgnat/a-stzunb__shared.ads \
414  a-szunau.adb<libgnat/a-szunau__shared.adb \
415  a-szuzti.adb<libgnat/a-szuzti__shared.adb
416
417ATOMICS_BUILTINS_TARGET_PAIRS = \
418  s-atocou.adb<libgnat/s-atocou__builtin.adb
419
420# Special version of units for x86 and x86-64 platforms.
421
422X86_TARGET_PAIRS = \
423  a-numaux.ads<libgnat/a-numaux__x86.ads \
424  a-numaux.adb<libgnat/a-numaux__x86.adb \
425  s-atocou.adb<libgnat/s-atocou__x86.adb
426
427X86_64_TARGET_PAIRS = \
428  a-numaux.ads<libgnat/a-numaux__x86.ads \
429  a-numaux.adb<libgnat/a-numaux__x86.adb \
430  s-atocou.adb<libgnat/s-atocou__builtin.adb
431
432# Implementation of symbolic traceback based on dwarf
433TRASYM_DWARF_UNIX_PAIRS = \
434  s-trasym.adb<libgnat/s-trasym__dwarf.adb \
435  s-mmosin.ads<libgnat/s-mmosin__unix.ads \
436  s-mmosin.adb<libgnat/s-mmosin__unix.adb \
437  s-mmauni.ads<libgnat/s-mmauni__long.ads
438
439TRASYM_DWARF_MINGW_PAIRS = \
440  s-trasym.adb<libgnat/s-trasym__dwarf.adb \
441  s-mmosin.ads<libgnat/s-mmosin__mingw.ads \
442  s-mmosin.adb<libgnat/s-mmosin__mingw.adb
443
444TRASYM_DWARF_COMMON_OBJS = s-objrea$(objext) s-dwalin$(objext) s-mmap$(objext) \
445  s-mmosin$(objext)
446
447TRASYM_DWARF_UNIX_OBJS = $(TRASYM_DWARF_COMMON_OBJS) s-mmauni$(objext)
448
449TRASYM_DWARF_MINGW_OBJS = $(TRASYM_DWARF_COMMON_OBJS)
450
451# Shared library version
452LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)ada/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
453
454# Additionnal object files from C source to be added to libgnat.
455EXTRA_LIBGNAT_OBJS=
456
457# Additionnal C source files to be added to libgnat without corresponding
458# object file (#included files). This should include at least the GNAT
459# specific header files required to rebuild the runtime library from sources.
460EXTRA_LIBGNAT_SRCS=
461
462# Additionnal object files from Ada sources to be added in libgnat
463EXTRA_GNATRTL_NONTASKING_OBJS=
464
465# Additionnal object files from Ada sources to be added in libgnarl
466EXTRA_GNATRTL_TASKING_OBJS=
467
468# Subsets of extra libgnat sources that always go together
469VX_SIGTRAMP_EXTRA_SRCS=sigtramp.h sigtramp-vxworks-target.inc
470
471# Additional object files that should go in the same directory as libgnat,
472# aside the library itself. Typically useful for crtbegin/crtend kind of files.
473EXTRA_ADALIB_OBJS=
474
475VX_CRTBE_EXTRA_ADALIB_OBJS=vx_crtbegin.o vx_crtbegin_auto.o vx_crtend.o
476
477# GCC spec files to be installed in $(libsubdir), so --specs=<spec-filename>
478# finds them at runtime.
479GCC_SPEC_FILES=
480
481# $(filter-out PATTERN...,TEXT) removes all PATTERN words from TEXT.
482# $(strip STRING) removes leading and trailing spaces from STRING.
483# If what's left is null then it's a match.
484
485# PowerPC and e500v2 VxWorks
486ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7 vxworks7spe,$(target_cpu) $(target_vendor) $(target_os))),)
487
488  ifeq ($(strip $(filter-out e500%, $(target_alias))),)
489     ARCH_STR=e500
490     # gcc config translates the target e500v2-wrs-vxworks to
491     # powerpc-wrs-vxworksspe. Let's keep the original alias here when
492     # generating s-oscons.ads.
493     target=$(target_alias)
494  else
495     ifeq ($(strip $(filter-out powerpc64, $(target_cpu))),)
496        ARCH_STR=ppc64
497     else
498        ARCH_STR=ppc
499     endif
500  endif
501
502  ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
503     SVX=system-vxworks7
504  else
505     SVX=system-vxworks
506  endif
507
508  LIBGNAT_TARGET_PAIRS = \
509  a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
510  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
511  s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
512  s-intman.ads<libgnarl/s-intman__vxworks.ads \
513  s-intman.adb<libgnarl/s-intman__vxworks.adb \
514  s-osinte.ads<libgnarl/s-osinte__vxworks.ads \
515  s-osinte.adb<libgnarl/s-osinte__vxworks.adb \
516  s-osprim.adb<libgnat/s-osprim__vxworks.adb \
517  s-parame.ads<libgnat/s-parame__vxworks.ads \
518  s-parame.adb<libgnat/s-parame__vxworks.adb \
519  s-taprop.adb<libgnarl/s-taprop__vxworks.adb \
520  s-tasinf.ads<libgnarl/s-tasinf__vxworks.ads \
521  s-taspri.ads<libgnarl/s-taspri__vxworks.ads \
522  s-vxwork.ads<libgnarl/s-vxwork__ppc.ads \
523  g-socthi.ads<libgnat/g-socthi__vxworks.ads \
524  g-socthi.adb<libgnat/g-socthi__vxworks.adb \
525  g-stsifd.adb<libgnat/g-stsifd__sockets.adb \
526  $(ATOMICS_TARGET_PAIRS) \
527  $(ATOMICS_BUILTINS_TARGET_PAIRS)
528
529  # VxWorks 5 and 6 both use the same target triplet making them
530  # indistinguishable in the context of this make file. Package
531  # System.Stack_Checking.Operations is not needed on VxWorks 6 as it leads to
532  # an undefined symbol when building a dynamic shared library. To alleviate
533  # this problem and distinguish this case, we use the THREAD_KIND and include
534  # the package only in default mode.
535
536  ifeq ($(strip $(filter-out default,$(THREAD_KIND))),)
537    LIBGNAT_TARGET_PAIRS += \
538      s-stchop.ads<libgnat/s-stchop__limit.ads \
539      s-stchop.adb<libgnat/s-stchop__vxworks.adb
540    EXTRA_GNATRTL_NONTASKING_OBJS+=s-stchop.o
541  endif
542
543  TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
544
545  ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
546    LIBGNAT_TARGET_PAIRS += \
547    s-vxwext.ads<libgnarl/s-vxwext__rtp.ads \
548    s-vxwext.adb<libgnarl/s-vxwext__rtp.adb \
549    s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-rtp.adb \
550    system.ads<libgnat/system-vxworks-$(ARCH_STR)-rtp.ads
551
552    EH_MECHANISM=-gcc
553  else
554    ifeq ($(strip $(filter-out rtp-smp,$(THREAD_KIND))),)
555      LIBGNAT_TARGET_PAIRS += \
556      s-mudido.adb<libgnarl/s-mudido__affinity.adb \
557      s-vxwext.ads<libgnarl/s-vxwext__rtp.ads \
558      s-vxwext.adb<libgnarl/s-vxwext__rtp-smp.adb \
559      s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-tls.adb \
560      system.ads<libgnat/$(SVX)-$(ARCH_STR)-rtp-smp.ads
561
562      EH_MECHANISM=-gcc
563      EXTRA_LIBGNAT_OBJS+=affinity.o
564    else
565      ifeq ($(strip $(filter-out kernel-smp,$(THREAD_KIND))),)
566        LIBGNAT_TARGET_PAIRS += \
567        s-interr.adb<libgnarl/s-interr__vxworks.adb \
568        s-mudido.adb<libgnarl/s-mudido__affinity.adb \
569        s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-tls.adb \
570        s-vxwext.ads<libgnarl/s-vxwext__kernel.ads \
571        s-vxwext.adb<libgnarl/s-vxwext__kernel-smp.adb \
572        system.ads<libgnat/system-vxworks-$(ARCH_STR)-kernel.ads
573
574        EH_MECHANISM=-gcc
575        EXTRA_LIBGNAT_OBJS+=affinity.o
576      else
577        LIBGNAT_TARGET_PAIRS += \
578        s-interr.adb<libgnarl/s-interr__vxworks.adb \
579        s-tpopsp.adb<libgnarl/s-tpopsp__vxworks.adb
580
581        ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
582          EH_MECHANISM=-gcc
583          LIBGNAT_TARGET_PAIRS += \
584          s-vxwext.ads<libgnarl/s-vxwext__kernel.ads \
585          s-vxwext.adb<libgnarl/s-vxwext__kernel.adb \
586          system.ads<libgnat/system-vxworks-$(ARCH_STR)-kernel.ads
587        else
588          LIBGNAT_TARGET_PAIRS += \
589          system.ads<libgnat/system-vxworks-ppc.ads
590        endif
591      endif
592      EXTRA_GNATRTL_NONTASKING_OBJS+=i-vxinco.o i-vxwork.o i-vxwoio.o
593    endif
594  endif
595
596  EXTRA_GNATRTL_TASKING_OBJS += s-vxwork.o s-vxwext.o
597
598  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
599
600  EXTRA_ADALIB_OBJS+=$(VX_CRTBE_EXTRA_ADALIB_OBJS)
601  EXTRA_LIBGNAT_SRCS+=vx_crtbegin.inc
602  GCC_SPEC_FILES+=vxworks-gnat-crtbe-link.spec
603
604  ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
605    ifeq ($(strip $(filter-out powerpc64, $(target_cpu))),)
606      GCC_SPEC_FILES+=vxworks7-ppc64-rtp-base-link.spec
607    else
608      GCC_SPEC_FILES+=vxworks7-rtp-base-link.spec
609    endif
610  else
611    GCC_SPEC_FILES+=vxworks-$(ARCH_STR)-link.spec
612    GCC_SPEC_FILES+=vxworks-cert-$(ARCH_STR)-link.spec
613    GCC_SPEC_FILES+=vxworks-smp-$(ARCH_STR)-link.spec
614  endif
615endif
616
617# x86/x86_64 VxWorks
618ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7,$(target_cpu) $(target_vendor) $(target_os))),)
619
620  EH_MECHANISM=-gcc
621
622  ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
623     SVX=system-vxworks7
624  else
625     SVX=system-vxworks
626  endif
627
628  ifeq ($(strip $(filter-out x86_64, $(target_cpu))),)
629     X86CPU=x86_64
630     LIBGNAT_TARGET_PAIRS=$(X86_64_TARGET_PAIRS)
631  else
632     X86CPU=x86
633     LIBGNAT_TARGET_PAIRS=$(X86_TARGET_PAIRS)
634  endif
635
636  LIBGNAT_TARGET_PAIRS+= \
637  a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
638  i-vxwork.ads<libgnat/i-vxwork__x86.ads \
639  s-osinte.adb<libgnarl/s-osinte__vxworks.adb \
640  s-osinte.ads<libgnarl/s-osinte__vxworks.ads \
641  s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
642  s-intman.ads<libgnarl/s-intman__vxworks.ads \
643  s-intman.adb<libgnarl/s-intman__vxworks.adb \
644  s-osprim.adb<libgnat/s-osprim__vxworks.adb \
645  s-parame.ads<libgnat/s-parame__vxworks.ads \
646  s-parame.adb<libgnat/s-parame__vxworks.adb \
647  s-stchop.ads<libgnat/s-stchop__limit.ads \
648  s-stchop.adb<libgnat/s-stchop__vxworks.adb \
649  s-taprop.adb<libgnarl/s-taprop__vxworks.adb \
650  s-tasinf.ads<libgnarl/s-tasinf__vxworks.ads \
651  s-taspri.ads<libgnarl/s-taspri__vxworks.ads \
652  s-vxwork.ads<libgnarl/s-vxwork__x86.ads \
653  g-socthi.ads<libgnat/g-socthi__vxworks.ads \
654  g-socthi.adb<libgnat/g-socthi__vxworks.adb \
655  g-stsifd.adb<libgnat/g-stsifd__sockets.adb \
656  $(ATOMICS_TARGET_PAIRS)
657
658  TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
659
660  # The CPU setting for VxSim varies with the
661  # host (Windows or Linux)
662  # target (VxWorks6 or VxWorks7)
663  # runtime (rtp or kernel)
664  # -------------------------------------------------------------
665  #					vx6		vx7
666  # Windows (host_os = mingw32)
667  #	kernel				SIMNT		SIMNT
668  #	rtp				SIMPENTIUM	SIMNT
669  # Linux (host_os = linux-gnu)
670  #	kernel				SIMLINUX	SIMLINUX
671  #	rtp				SIMPENTIUM	SIMLINUX
672  # -------------------------------------------------------------
673  # It is overridden by VXSIM_CPU only in files init-vxsim.c and
674  # sigtramp-vxworks-vxsim.c which contain functions determined at
675  # runtime to be called if a program is running on VxSim vs real hardware
676  # (due to differences in signal context for unwinding).
677
678  ifneq ($(strip $(filter-out vxworks7, $(target_os))),)
679    ifeq ($(strip $(filter-out vxworks rtp rtp-smp,$(target_os) $(THREAD_KIND))),)
680      VXSIM_CPU = SIMPENTIUM
681    else
682      ifeq ($(strip $(filter-out kernel kernel-smp rtp rtp-smp,$(THREAD_KIND))),)
683        ifeq ($(strip $(filter-out linux%,$(host_os))),)
684          # Linux
685          VXSIM_CPU = SIMLINUX
686        else
687          # Windows
688          VXSIM_CPU = SIMNT
689        endif
690      endif
691    endif
692
693    GNATLIBCFLAGS_FOR_C := $(GNATLIBCFLAGS_FOR_C) -D__VXSIM_CPU__=$(VXSIM_CPU)
694  endif
695
696  ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
697    # Runtime N/A for VxWorks7 (non-existent system file)
698    LIBGNAT_TARGET_PAIRS += \
699    s-vxwext.ads<libgnarl/s-vxwext__rtp.ads \
700    s-vxwext.adb<libgnarl/s-vxwext__rtp.adb \
701    s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-rtp.adb \
702    system.ads<libgnat/system-vxworks-x86-rtp.ads
703  else
704    ifeq ($(strip $(filter-out rtp-smp, $(THREAD_KIND))),)
705      LIBGNAT_TARGET_PAIRS += \
706      s-mudido.adb<libgnarl/s-mudido__affinity.adb \
707      s-vxwext.ads<libgnarl/s-vxwext__rtp.ads \
708      s-vxwext.adb<libgnarl/s-vxwext__rtp-smp.adb \
709      s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-tls.adb \
710      system.ads<libgnat/$(SVX)-$(X86CPU)-rtp-smp.ads
711
712      EXTRA_LIBGNAT_OBJS+=affinity.o
713    else
714      ifeq ($(strip $(filter-out kernel-smp, $(THREAD_KIND))),)
715        LIBGNAT_TARGET_PAIRS += \
716        s-interr.adb<libgnarl/s-interr__vxworks.adb \
717        s-mudido.adb<libgnarl/s-mudido__affinity.adb \
718        s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-tls.adb \
719        s-vxwext.ads<libgnarl/s-vxwext__kernel.ads \
720        s-vxwext.adb<libgnarl/s-vxwext__kernel-smp.adb \
721        system.ads<libgnat/$(SVX)-$(X86CPU)-kernel.ads
722
723        EXTRA_LIBGNAT_OBJS+=affinity.o
724      else
725        LIBGNAT_TARGET_PAIRS += \
726        s-interr.adb<libgnarl/s-interr__vxworks.adb \
727        s-tpopsp.adb<libgnarl/s-tpopsp__vxworks.adb
728
729        ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
730          # Runtime N/A for VxWorks7 (non-existent system file)
731          LIBGNAT_TARGET_PAIRS += \
732          s-vxwext.ads<libgnarl/s-vxwext__kernel.ads \
733          s-vxwext.adb<libgnarl/s-vxwext__kernel.adb \
734          system.ads<libgnat/$(SVX)-x86-kernel.ads
735        else
736          LIBGNAT_TARGET_PAIRS += \
737          system.ads<libgnat/system-vxworks-x86.ads
738        endif
739      endif
740
741      EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
742    endif
743  endif
744
745  EXTRA_GNATRTL_NONTASKING_OBJS += s-stchop.o
746  EXTRA_GNATRTL_TASKING_OBJS += i-vxinco.o s-vxwork.o s-vxwext.o
747
748  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
749
750  EXTRA_LIBGNAT_OBJS+=sigtramp-vxworks.o
751  EXTRA_LIBGNAT_SRCS+=$(VX_SIGTRAMP_EXTRA_SRCS)
752
753  EXTRA_ADALIB_OBJS+=$(VX_CRTBE_EXTRA_ADALIB_OBJS)
754  EXTRA_LIBGNAT_SRCS+=vx_crtbegin.inc
755  GCC_SPEC_FILES+=vxworks-gnat-crtbe-link.spec
756
757  ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
758    GCC_SPEC_FILES+=vxworks7-$(X86CPU)-rtp-base-link.spec
759  else
760    GCC_SPEC_FILES+=vxworks-x86-link.spec
761    GCC_SPEC_FILES+=vxworks-cert-x86-link.spec
762    GCC_SPEC_FILES+=vxworks-smp-x86-link.spec
763  endif
764endif
765
766# ARM and Aarch64 VxWorks
767ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
768
769  ifeq ($(strip $(filter-out aarch64, $(target_cpu))),)
770    ARCH_STR=aarch64
771    SVX=system-vxworks7
772    EH_MECHANISM=-gcc
773    SIGTRAMP_OBJ=sigtramp-vxworks.o
774  else
775    ifeq ($(strip $(filter-out arm%, $(target_cpu))),)
776      ARCH_STR=arm
777      ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
778        SVX=system-vxworks7
779        EH_MECHANISM=-arm
780        SIGTRAMP_OBJ=sigtramp-armvxworks.o
781      else
782        SVX=system-vxworks
783        EH_MECHANISM=-gcc
784        SIGTRAMP_OBJ=sigtramp-vxworks.o
785      endif
786    else
787      ARCH_STR=coff
788    endif
789  endif
790
791  LIBGNAT_TARGET_PAIRS = \
792  a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
793  a-numaux.ads<libgnat/a-numaux__vxworks.ads \
794  s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
795  s-interr.adb<libgnarl/s-interr__vxworks.adb \
796  s-intman.ads<libgnarl/s-intman__vxworks.ads \
797  s-intman.adb<libgnarl/s-intman__vxworks.adb \
798  s-osinte.adb<libgnarl/s-osinte__vxworks.adb \
799  s-osinte.ads<libgnarl/s-osinte__vxworks.ads \
800  s-osprim.adb<libgnat/s-osprim__vxworks.adb \
801  s-parame.ads<libgnat/s-parame__vxworks.ads \
802  s-parame.adb<libgnat/s-parame__vxworks.adb \
803  s-stchop.ads<libgnat/s-stchop__limit.ads \
804  s-stchop.adb<libgnat/s-stchop__vxworks.adb \
805  s-taprop.adb<libgnarl/s-taprop__vxworks.adb \
806  s-tasinf.ads<libgnarl/s-tasinf__vxworks.ads \
807  s-taspri.ads<libgnarl/s-taspri__vxworks.ads \
808  s-vxwork.ads<libgnarl/s-vxwork__$(ARCH_STR).ads \
809  g-socthi.ads<libgnat/g-socthi__vxworks.ads \
810  g-socthi.adb<libgnat/g-socthi__vxworks.adb \
811  g-stsifd.adb<libgnat/g-stsifd__sockets.adb
812
813  TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
814
815  ifeq ($(strip $(filter-out rtp-smp,$(THREAD_KIND))),)
816    LIBGNAT_TARGET_PAIRS += \
817    s-mudido.adb<libgnarl/s-mudido__affinity.adb \
818    s-vxwext.ads<libgnarl/s-vxwext__rtp.ads \
819    s-vxwext.adb<libgnarl/s-vxwext__rtp-smp.adb \
820    s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-tls.adb \
821    system.ads<libgnat/$(SVX)-$(ARCH_STR)-rtp-smp.ads
822
823    EXTRA_LIBGNAT_OBJS+=affinity.o
824
825    EXTRA_LIBGNAT_OBJS+=$(SIGTRAMP_OBJ)
826    EXTRA_LIBGNAT_SRCS+=$(VX_SIGTRAMP_EXTRA_SRCS)
827  else
828    ifeq ($(strip $(filter-out kernel-smp,$(THREAD_KIND))),)
829      LIBGNAT_TARGET_PAIRS += \
830      s-mudido.adb<libgnarl/s-mudido__affinity.adb \
831      s-tpopsp.adb<libgnarl/s-tpopsp__vxworks-tls.adb \
832      s-vxwext.ads<libgnarl/s-vxwext__kernel.ads \
833      s-vxwext.adb<libgnarl/s-vxwext__kernel-smp.adb \
834      system.ads<libgnat/$(SVX)-$(ARCH_STR).ads
835
836      EXTRA_LIBGNAT_OBJS+=affinity.o
837
838      EXTRA_LIBGNAT_OBJS+=$(SIGTRAMP_OBJ)
839      EXTRA_LIBGNAT_SRCS+=$(VX_SIGTRAMP_EXTRA_SRCS)
840    else
841      LIBGNAT_TARGET_PAIRS += \
842      s-tpopsp.adb<libgnarl/s-tpopsp__vxworks.adb \
843      system.ads<libgnat/$(SVX)-$(ARCH_STR).ads
844
845      ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
846        LIBGNAT_TARGET_PAIRS += \
847        s-vxwext.ads<libgnarl/s-vxwext__kernel.ads \
848        s-vxwext.adb<libgnarl/s-vxwext__kernel.adb
849
850        EXTRA_LIBGNAT_OBJS+=$(SIGTRAMP_OBJ)
851        EXTRA_LIBGNAT_SRCS+=$(VX_SIGTRAMP_EXTRA_SRCS)
852      endif
853    endif
854  endif
855
856  EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o \
857    s-stchop.o
858  EXTRA_GNATRTL_TASKING_OBJS=i-vxinco.o s-vxwork.o s-vxwext.o
859
860  EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
861
862  ifeq ($(strip $(filter-out arm vxworks7%, $(target_cpu) $(target_os))),)
863    GCC_SPEC_FILES+=vxworks7-rtp-base-link.spec
864  else
865    ifeq ($(strip $(filter-out aarch64, $(target_cpu))),)
866      GCC_SPEC_FILES+=vxworks7-rtp-base-link.spec
867    endif
868    EXTRA_ADALIB_OBJS+=$(VX_CRTBE_EXTRA_ADALIB_OBJS)
869    EXTRA_LIBGNAT_SRCS+=vx_crtbegin.inc
870    GCC_SPEC_FILES+=vxworks-gnat-crtbe-link.spec
871
872    ifneq ($(strip $(filter-out vxworks7%, $(target_os))),)
873      GCC_SPEC_FILES+=vxworks-arm-link.spec
874      GCC_SPEC_FILES+=vxworks-smp-arm-link.spec
875    endif
876  endif
877endif
878
879# ARM android
880ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
881  LIBGNAT_TARGET_PAIRS = \
882  a-intnam.ads<libgnarl/a-intnam__linux.ads \
883  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
884  s-intman.adb<libgnarl/s-intman__android.adb \
885  s-linux.ads<libgnarl/s-linux__android.ads \
886  s-osinte.adb<libgnarl/s-osinte__android.adb \
887  s-osinte.ads<libgnarl/s-osinte__android.ads \
888  s-osprim.adb<libgnat/s-osprim__posix.adb \
889  s-taprop.adb<libgnarl/s-taprop__posix.adb \
890  s-taspri.ads<libgnarl/s-taspri__posix.ads \
891  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
892  $(ATOMICS_TARGET_PAIRS) \
893  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
894  system.ads<libgnat/system-linux-arm.ads
895
896  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
897
898  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
899  EXTRA_LIBGNAT_OBJS+=sigtramp-armdroid.o
900  EXTRA_LIBGNAT_SRCS+=sigtramp.h
901  EH_MECHANISM=-arm
902  THREADSLIB =
903  GNATLIB_SHARED = gnatlib-shared-dual
904  LIBRARY_VERSION := $(LIB_VERSION)
905endif
906
907# AARCH64 QNX
908ifeq ($(strip $(filter-out aarch64 %qnx,$(target_cpu) $(target_os))),)
909  LIBGNAT_TARGET_PAIRS = \
910  a-intnam.ads<libgnarl/a-intnam__qnx.ads \
911  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
912  s-intman.adb<libgnarl/s-intman__qnx.adb \
913  s-osinte.adb<libgnarl/s-osinte__qnx.adb \
914  s-osinte.ads<libgnarl/s-osinte__qnx.ads \
915  s-osprim.adb<libgnat/s-osprim__posix.adb \
916  s-qnx.ads<libgnarl/s-qnx.ads \
917  s-taprop.adb<libgnarl/s-taprop__qnx.adb \
918  s-taspri.ads<libgnarl/s-taspri__posix.ads \
919  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
920  $(ATOMICS_TARGET_PAIRS) \
921  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
922  system.ads<libgnat/system-qnx-aarch64.ads
923
924  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
925
926  EXTRA_GNATRTL_TASKING_OBJS=s-qnx.o
927  EXTRA_LIBGNAT_OBJS+=sigtramp-qnx.o
928  EXTRA_LIBGNAT_SRCS+=sigtramp.h
929  EH_MECHANISM=-gcc
930
931  SO_OPTS= -shared-libgcc -Wl,-soname,
932  MISCLIB= - lsocket
933  THREADSLIB =
934  GNATLIB_SHARED = gnatlib-shared-dual
935  LIBRARY_VERSION := $(LIB_VERSION)
936endif
937
938# Sparc Solaris
939ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
940  LIBGNAT_TARGET_PAIRS = \
941  a-intnam.ads<libgnarl/a-intnam__solaris.ads \
942  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
943  s-intman.adb<libgnarl/s-intman__solaris.adb \
944  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
945  s-osinte.adb<libgnarl/s-osinte__solaris.adb \
946  s-osinte.ads<libgnarl/s-osinte__solaris.ads \
947  s-osprim.adb<libgnat/s-osprim__solaris.adb \
948  s-taprop.adb<libgnarl/s-taprop__solaris.adb \
949  s-tasinf.adb<libgnarl/s-tasinf__solaris.adb \
950  s-tasinf.ads<libgnarl/s-tasinf__solaris.ads \
951  s-taspri.ads<libgnarl/s-taspri__solaris.ads \
952  s-tpopsp.adb<libgnarl/s-tpopsp__solaris.adb \
953  g-soliop.ads<libgnat/g-soliop__solaris.ads \
954  $(TRASYM_DWARF_UNIX_PAIRS) \
955  $(ATOMICS_TARGET_PAIRS) \
956  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
957  system.ads<libgnat/system-solaris-sparc.ads
958
959  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
960
961  EH_MECHANISM=-gcc
962  THREADSLIB = -lposix4 -lthread
963  MISCLIB = -lposix4 -lnsl -lsocket
964  SO_OPTS = -Wl,-h,
965  GNATLIB_SHARED = gnatlib-shared-dual
966  GMEM_LIB = gmemlib
967  LIBRARY_VERSION := $(LIB_VERSION)
968endif
969
970# x86 and x86-64 solaris
971ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),)
972  LIBGNAT_TARGET_PAIRS_COMMON = \
973  a-intnam.ads<libgnarl/a-intnam__solaris.ads \
974  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
975  s-intman.adb<libgnarl/s-intman__solaris.adb \
976  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
977  s-osinte.adb<libgnarl/s-osinte__solaris.adb \
978  s-osinte.ads<libgnarl/s-osinte__solaris.ads \
979  s-osprim.adb<libgnat/s-osprim__solaris.adb \
980  s-taprop.adb<libgnarl/s-taprop__solaris.adb \
981  s-tasinf.adb<libgnarl/s-tasinf__solaris.adb \
982  s-tasinf.ads<libgnarl/s-tasinf__solaris.ads \
983  s-taspri.ads<libgnarl/s-taspri__solaris.ads \
984  s-tpopsp.adb<libgnarl/s-tpopsp__solaris.adb \
985  g-soliop.ads<libgnat/g-soliop__solaris.ads \
986  $(TRASYM_DWARF_UNIX_PAIRS) \
987  $(ATOMICS_TARGET_PAIRS) \
988  system.ads<libgnat/system-solaris-x86.ads
989
990  ifeq ($(strip $(filter-out %86 solaris2%,$(target_cpu) $(target_os))),)
991    ifeq ($(strip $(MULTISUBDIR)),/amd64)
992      LIBGNAT_TARGET_PAIRS = \
993      $(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_64_TARGET_PAIRS)
994    else
995      LIBGNAT_TARGET_PAIRS = \
996      $(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_TARGET_PAIRS)
997    endif
998  else
999    ifeq ($(strip $(MULTISUBDIR)),/32)
1000      LIBGNAT_TARGET_PAIRS = \
1001      $(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_TARGET_PAIRS)
1002    else
1003      LIBGNAT_TARGET_PAIRS = \
1004      $(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_64_TARGET_PAIRS)
1005    endif
1006  endif
1007
1008  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1009  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1010
1011  EH_MECHANISM=-gcc
1012  THREADSLIB = -lposix4 -lthread
1013  MISCLIB = -lposix4 -lnsl -lsocket
1014  SO_OPTS = -Wl,-h,
1015  GNATLIB_SHARED = gnatlib-shared-dual
1016  GMEM_LIB = gmemlib
1017  LIBRARY_VERSION := $(LIB_VERSION)
1018endif
1019
1020# x86 Linux
1021ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
1022  LIBGNAT_TARGET_PAIRS = \
1023  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1024  a-synbar.adb<libgnarl/a-synbar__posix.adb \
1025  a-synbar.ads<libgnarl/a-synbar__posix.ads \
1026  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1027  s-intman.adb<libgnarl/s-intman__posix.adb \
1028  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1029  $(TRASYM_DWARF_UNIX_PAIRS) \
1030  g-sercom.adb<libgnat/g-sercom__linux.adb \
1031  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
1032  a-exetim.adb<libgnarl/a-exetim__posix.adb \
1033  a-exetim.ads<libgnarl/a-exetim__default.ads \
1034  s-linux.ads<libgnarl/s-linux.ads \
1035  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1036  $(ATOMICS_TARGET_PAIRS) \
1037  system.ads<libgnat/system-linux-x86.ads
1038
1039  ifeq ($(strip $(MULTISUBDIR)),/64)
1040    LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
1041  else
1042    LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
1043  endif
1044
1045  LIBGNAT_TARGET_PAIRS += \
1046  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1047  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1048  s-osprim.adb<libgnat/s-osprim__posix.adb \
1049  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1050  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1051  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1052  s-taspri.ads<libgnarl/s-taspri__posix.ads
1053
1054  EH_MECHANISM=-gcc
1055  THREADSLIB = -lpthread -lrt
1056  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1057  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1058  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
1059
1060  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1061
1062  GNATLIB_SHARED = gnatlib-shared-dual
1063  MISCLIB = -ldl
1064  GMEM_LIB = gmemlib
1065  LIBRARY_VERSION := $(LIB_VERSION)
1066endif
1067
1068# x86 kfreebsd
1069ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
1070  LIBGNAT_TARGET_PAIRS = \
1071  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
1072  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1073  s-intman.adb<libgnarl/s-intman__posix.adb \
1074  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1075  s-osinte.ads<libgnarl/s-osinte__kfreebsd-gnu.ads \
1076  s-osprim.adb<libgnat/s-osprim__posix.adb \
1077  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1078  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1079  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1080  $(TRASYM_DWARF_UNIX_PAIRS) \
1081  $(ATOMICS_TARGET_PAIRS) \
1082  $(X86_TARGET_PAIRS) \
1083  system.ads<libgnat/system-freebsd.ads
1084
1085  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1086
1087  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1088  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1089
1090  EH_MECHANISM=-gcc
1091  THREADSLIB = -lpthread
1092  GNATLIB_SHARED = gnatlib-shared-dual
1093  GMEM_LIB = gmemlib
1094  LIBRARY_VERSION := $(LIB_VERSION)
1095  MISCLIB = -lutil
1096endif
1097
1098# i[3456]86-pc-gnu i.e. GNU Hurd
1099ifeq ($(strip $(filter-out %86 pc gnu,$(target_cpu) $(target_vendor) $(target_os))),)
1100  LIBGNAT_TARGET_PAIRS = \
1101  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
1102  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1103  s-intman.adb<libgnarl/s-intman__posix.adb \
1104  s-osinte.adb<libgnarl/s-osinte__gnu.adb \
1105  s-osinte.ads<libgnarl/s-osinte__gnu.ads \
1106  s-osprim.adb<libgnat/s-osprim__posix.adb \
1107  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1108  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1109  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1110  $(ATOMICS_TARGET_PAIRS) \
1111  $(X86_TARGET_PAIRS) \
1112  system.ads<libgnat/system-freebsd.ads
1113
1114  TOOLS_TARGET_PAIRS =  indepsw.adb<indepsw-gnu.adb
1115
1116  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
1117
1118  EH_MECHANISM=-gcc
1119  THREADSLIB = -lpthread
1120  GNATLIB_SHARED = gnatlib-shared-dual
1121  GMEM_LIB = gmemlib
1122  LIBRARY_VERSION := $(LIB_VERSION)
1123endif
1124
1125ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
1126  LIBGNAT_TARGET_PAIRS = \
1127  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
1128  a-numaux.adb<libgnat/a-numaux__x86.adb \
1129  a-numaux.ads<libgnat/a-numaux__x86.ads \
1130  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1131  s-intman.adb<libgnarl/s-intman__posix.adb \
1132  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1133  s-osinte.ads<libgnarl/s-osinte__kfreebsd-gnu.ads \
1134  s-osprim.adb<libgnat/s-osprim__posix.adb \
1135  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1136  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1137  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1138  system.ads<libgnat/system-freebsd.ads
1139
1140  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1141
1142  EH_MECHANISM=-gcc
1143  THREADSLIB = -lpthread
1144  GNATLIB_SHARED = gnatlib-shared-dual
1145  GMEM_LIB = gmemlib
1146  LIBRARY_VERSION := $(LIB_VERSION)
1147endif
1148
1149# aarch64 FreeBSD
1150ifeq ($(strip $(filter-out %aarch64 freebsd%,$(target_cpu) $(target_os))),)
1151  LIBGNAT_TARGET_PAIRS = \
1152  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
1153  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1154  s-intman.adb<libgnarl/s-intman__posix.adb \
1155  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1156  s-osinte.adb<libgnarl/s-osinte__freebsd.adb \
1157  s-osinte.ads<libgnarl/s-osinte__freebsd.ads \
1158  s-osprim.adb<libgnat/s-osprim__posix.adb \
1159  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1160  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1161  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
1162  $(ATOMICS_TARGET_PAIRS) \
1163  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1164  system.ads<libgnat/system-freebsd.ads
1165
1166  GNATLIB_SHARED = gnatlib-shared-dual
1167
1168  EH_MECHANISM=-gcc
1169  THREADSLIB= -lpthread
1170  GMEM_LIB = gmemlib
1171  LIBRARY_VERSION := $(LIB_VERSION)
1172  MISCLIB = -lutil
1173endif
1174
1175# x86 FreeBSD
1176ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
1177  LIBGNAT_TARGET_PAIRS = \
1178  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
1179  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1180  s-intman.adb<libgnarl/s-intman__posix.adb \
1181  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1182  s-osinte.adb<libgnarl/s-osinte__freebsd.adb \
1183  s-osinte.ads<libgnarl/s-osinte__freebsd.ads \
1184  s-osprim.adb<libgnat/s-osprim__posix.adb \
1185  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1186  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1187  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
1188  $(TRASYM_DWARF_UNIX_PAIRS) \
1189  $(ATOMICS_TARGET_PAIRS) \
1190  $(X86_TARGET_PAIRS) \
1191  system.ads<libgnat/system-freebsd.ads
1192
1193  GNATLIB_SHARED = gnatlib-shared-dual
1194
1195  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1196  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1197
1198  EH_MECHANISM=-gcc
1199  THREADSLIB= -lpthread
1200  GMEM_LIB = gmemlib
1201  LIBRARY_VERSION := $(LIB_VERSION)
1202  MISCLIB = -lutil
1203endif
1204
1205# x86-64 FreeBSD
1206ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
1207  LIBGNAT_TARGET_PAIRS = \
1208  a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
1209  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1210  s-intman.adb<libgnarl/s-intman__posix.adb \
1211  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1212  s-osinte.adb<libgnarl/s-osinte__freebsd.adb \
1213  s-osinte.ads<libgnarl/s-osinte__freebsd.ads \
1214  s-osprim.adb<libgnat/s-osprim__posix.adb \
1215  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1216  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1217  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
1218  $(TRASYM_DWARF_UNIX_PAIRS) \
1219  $(ATOMICS_TARGET_PAIRS) \
1220  $(X86_64_TARGET_PAIRS) \
1221  system.ads<libgnat/system-freebsd.ads
1222
1223  GNATLIB_SHARED = gnatlib-shared-dual
1224
1225  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1226  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1227
1228  EH_MECHANISM=-gcc
1229  THREADSLIB= -lpthread
1230  GMEM_LIB = gmemlib
1231  LIBRARY_VERSION := $(LIB_VERSION)
1232  MISCLIB = -lutil
1233endif
1234
1235# x86-64 DragonFly
1236ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
1237  LIBGNAT_TARGET_PAIRS = \
1238  a-intnam.ads<libgnarl/a-intnam__dragonfly.ads \
1239  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1240  s-intman.adb<libgnarl/s-intman__posix.adb \
1241  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1242  s-osinte.adb<libgnarl/s-osinte__dragonfly.adb \
1243  s-osinte.ads<libgnarl/s-osinte__dragonfly.ads \
1244  s-osprim.adb<libgnat/s-osprim__posix.adb \
1245  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1246  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1247  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
1248  $(ATOMICS_TARGET_PAIRS) \
1249  $(X86_64_TARGET_PAIRS) \
1250  system.ads<libgnat/system-dragonfly-x86_64.ads
1251
1252  GNATLIB_SHARED = gnatlib-shared-dual
1253
1254  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
1255
1256  EH_MECHANISM=-gcc
1257  THREADSLIB= -lpthread
1258  GMEM_LIB = gmemlib
1259  LIBRARY_VERSION := $(LIB_VERSION)
1260  MISCLIB = -lutil
1261endif
1262
1263# S390 Linux
1264ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
1265  LIBGNAT_TARGET_PAIRS = \
1266  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1267  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1268  s-intman.adb<libgnarl/s-intman__posix.adb \
1269  s-linux.ads<libgnarl/s-linux.ads \
1270  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1271  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1272  s-osprim.adb<libgnat/s-osprim__posix.adb \
1273  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1274  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1275  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1276  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1277  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1278  system.ads<libgnat/system-linux-s390.ads
1279
1280  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1281
1282  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1283  EH_MECHANISM=-gcc
1284  THREADSLIB = -lpthread
1285  GNATLIB_SHARED = gnatlib-shared-dual
1286  LIBRARY_VERSION := $(LIB_VERSION)
1287endif
1288
1289# HP/PA HP-UX 10
1290ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),)
1291  LIBGNAT_TARGET_PAIRS = \
1292  a-excpol.adb<libgnat/a-excpol__abort.adb \
1293  a-intnam.ads<libgnarl/a-intnam__hpux.ads \
1294  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1295  s-interr.adb<libgnarl/s-interr__sigaction.adb \
1296  s-intman.adb<libgnarl/s-intman__posix.adb \
1297  s-osinte.adb<libgnarl/s-osinte__hpux-dce.adb \
1298  s-osinte.ads<libgnarl/s-osinte__hpux-dce.ads \
1299  s-parame.ads<libgnat/s-parame__hpux.ads \
1300  s-osprim.adb<libgnat/s-osprim__posix.adb \
1301  s-taprop.adb<libgnarl/s-taprop__hpux-dce.adb \
1302  s-taspri.ads<libgnarl/s-taspri__hpux-dce.ads \
1303  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
1304  system.ads<libgnat/system-hpux.ads
1305
1306  EH_MECHANISM=-gcc
1307endif
1308
1309# HP/PA HP-UX 11
1310ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) $(target_vendor) $(target_os))),)
1311  LIBGNAT_TARGET_PAIRS = \
1312  a-intnam.ads<libgnarl/a-intnam__hpux.ads \
1313  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1314  s-intman.adb<libgnarl/s-intman__posix.adb \
1315  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1316  s-osinte.ads<libgnarl/s-osinte__hpux.ads \
1317  s-parame.ads<libgnat/s-parame__hpux.ads \
1318  s-osprim.adb<libgnat/s-osprim__posix.adb \
1319  s-traceb.adb<libgnat/s-traceb__hpux.adb \
1320  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1321  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1322  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1323  system.ads<libgnat/system-hpux.ads
1324
1325  EH_MECHANISM=-gcc
1326  TGT_LIB = /usr/lib/libcl.a
1327  THREADSLIB = -lpthread
1328  GMEM_LIB = gmemlib
1329  soext = .sl
1330  SO_OPTS = -Wl,+h,
1331  GNATLIB_SHARED = gnatlib-shared-dual
1332  LIBRARY_VERSION := $(LIB_VERSION)
1333endif
1334
1335# IBM AIX
1336ifeq ($(strip $(filter-out ibm aix%,$(target_vendor) $(target_os))),)
1337  LIBGNAT_TARGET_PAIRS = \
1338  a-intnam.ads<libgnarl/a-intnam__aix.ads \
1339  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1340  s-intman.adb<libgnarl/s-intman__posix.adb \
1341  s-osinte.adb<libgnarl/s-osinte__aix.adb \
1342  s-osinte.ads<libgnarl/s-osinte__aix.ads \
1343  s-osprim.adb<libgnat/s-osprim__posix.adb \
1344  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1345  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1346  s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
1347  $(TRASYM_DWARF_UNIX_PAIRS) \
1348  $(ATOMICS_TARGET_PAIRS) \
1349  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1350  system.ads<libgnat/system-aix.ads
1351
1352  ifeq ($(findstring ppc64, \
1353	  $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) \
1354		   -print-multi-os-directory)), \
1355	ppc64)
1356    TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-aix.adb
1357  else
1358    TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1359  endif
1360
1361  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1362
1363  THREADSLIB = -lpthreads
1364  EH_MECHANISM=-gcc
1365
1366  GMEM_LIB = gmemlib
1367endif
1368
1369# RTEMS
1370ifeq ($(strip $(filter-out rtems%,$(target_os))),)
1371  LIBGNAT_TARGET_PAIRS = \
1372  system.ads<libgnat/system-rtems.ads \
1373  a-intnam.ads<libgnarl/a-intnam__rtems.ads \
1374  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1375  s-intman.adb<libgnarl/s-intman__posix.adb \
1376  s-osinte.adb<libgnarl/s-osinte__rtems.adb \
1377  s-osinte.ads<libgnarl/s-osinte__rtems.ads \
1378  s-osprim.adb<libgnat/s-osprim__rtems.adb \
1379  s-parame.adb<libgnat/s-parame__rtems.adb \
1380  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1381  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1382  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1383  s-stchop.adb<libgnat/s-stchop__rtems.adb \
1384  s-interr.adb<libgnarl/s-interr__hwint.adb
1385  ifeq ($(strip $(filter-out arm%, $(target_cpu))),)
1386    EH_MECHANISM=-arm
1387  else
1388    EH_MECHANISM=-gcc
1389  endif
1390endif
1391
1392# PikeOS
1393ifeq ($(strip $(filter-out powerpc% %86 sysgo pikeos,$(target_cpu) $(target_vendor) $(target_os)))),)
1394  TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
1395endif
1396
1397# *-elf, *-eabi, or *-eabispe
1398ifeq ($(strip $(filter-out elf eabi eabispe,$(target_os))),)
1399  TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
1400endif
1401
1402ifeq ($(strip $(filter-out %djgpp,$(target_os))),)
1403  GNATRTL_SOCKETS_OBJS =
1404
1405  LIBGNAT_TARGET_PAIRS = \
1406	a-intnam.ads<libgnarl/a-intnam__dummy.ads \
1407	s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
1408	s-intman.adb<libgnarl/s-intman__dummy.adb \
1409	s-osinte.ads<libgnarl/s-osinte__dummy.ads \
1410	s-osprim.adb<libgnat/s-osprim__unix.adb \
1411	s-taprop.adb<libgnarl/s-taprop__dummy.adb \
1412	s-taspri.ads<libgnarl/s-taspri__dummy.ads \
1413	system.ads<libgnat/system-djgpp.ads \
1414	$(DUMMY_SOCKETS_TARGET_PAIRS)
1415
1416  EH_MECHANISM=-gcc
1417endif
1418
1419# Cygwin/Mingw32
1420ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
1421  # Cygwin provides a full Posix environment, and so we use the default
1422  # versions of s-memory and g-socthi rather than the Windows-specific
1423  # MinGW versions.  Ideally we would use all the default versions for
1424  # Cygwin and none of the MinGW versions, but for historical reasons
1425  # the Cygwin port has always been a CygMing frankenhybrid and it is
1426  # a long-term project to disentangle them.
1427  ifeq ($(strip $(filter-out cygwin%,$(target_os))),)
1428    LIBGNAT_TARGET_PAIRS = \
1429    s-memory.adb<libgnat/s-memory.adb \
1430    g-socthi.ads<libgnat/g-socthi.ads \
1431    g-socthi.adb<libgnat/g-socthi.adb
1432  else
1433    LIBGNAT_TARGET_PAIRS = \
1434    s-memory.adb<libgnat/s-memory__mingw.adb \
1435    g-socthi.ads<libgnat/g-socthi__mingw.ads \
1436    g-socthi.adb<libgnat/g-socthi__mingw.adb
1437  endif
1438  LIBGNAT_TARGET_PAIRS += \
1439  a-dirval.adb<libgnat/a-dirval__mingw.adb \
1440  a-excpol.adb<libgnat/a-excpol__abort.adb \
1441  s-gloloc.adb<libgnat/s-gloloc__mingw.adb \
1442  s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
1443  s-taspri.ads<libgnarl/s-taspri__mingw.ads \
1444  s-tasinf.adb<libgnarl/s-tasinf__mingw.adb \
1445  s-tasinf.ads<libgnarl/s-tasinf__mingw.ads \
1446  g-stsifd.adb<libgnat/g-stsifd__sockets.adb \
1447  g-soliop.ads<libgnat/g-soliop__mingw.ads \
1448  $(ATOMICS_TARGET_PAIRS) \
1449  system.ads<libgnat/system-mingw.ads
1450
1451  LIBGNAT_TARGET_PAIRS += \
1452  a-exetim.adb<libgnarl/a-exetim__mingw.adb \
1453  a-exetim.ads<libgnarl/a-exetim__mingw.ads \
1454  a-intnam.ads<libgnarl/a-intnam__mingw.ads \
1455  g-sercom.adb<libgnat/g-sercom__mingw.adb \
1456  $(TRASYM_DWARF_MINGW_PAIRS) \
1457  s-tsmona.adb<libgnat/s-tsmona__mingw.adb \
1458  s-interr.adb<libgnarl/s-interr__sigaction.adb \
1459  s-intman.adb<libgnarl/s-intman__mingw.adb \
1460  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1461  s-osinte.ads<libgnarl/s-osinte__mingw.ads \
1462  s-osprim.adb<libgnat/s-osprim__mingw.adb \
1463  s-taprop.adb<libgnarl/s-taprop__mingw.adb
1464
1465  ifeq ($(strip $(filter-out x86_64%,$(target_cpu))),)
1466    ifeq ($(strip $(MULTISUBDIR)),/32)
1467      LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
1468      SO_OPTS= -m32 -Wl,-soname,
1469    else
1470      LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
1471      SO_OPTS = -m64 -Wl,-soname,
1472    endif
1473  else
1474    ifeq ($(strip $(MULTISUBDIR)),/64)
1475      LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
1476      SO_OPTS = -m64 -Wl,-soname,
1477    else
1478      LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
1479      SO_OPTS = -m32 -Wl,-soname,
1480    endif
1481  endif
1482
1483  EXTRA_GNATRTL_NONTASKING_OBJS += \
1484    s-win32.o s-winext.o g-regist.o g-sse.o g-ssvety.o
1485  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_MINGW_OBJS)
1486  EXTRA_GNATRTL_TASKING_OBJS = a-exetim.o
1487  EXTRA_LIBGNAT_SRCS+=mingw32.h
1488  MISCLIB = -lws2_32
1489
1490  # ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
1491  # auto-import support for array/record will be done.
1492  GNATLIB_SHARED = gnatlib-shared-win32
1493
1494  EH_MECHANISM=-gcc
1495
1496  TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
1497
1498  GMEM_LIB = gmemlib
1499  EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
1500  EXTRA_GNATMAKE_OBJS = mdll.o mdll-utl.o mdll-fil.o
1501  soext = .dll
1502  LIBRARY_VERSION := $(LIB_VERSION)
1503endif
1504
1505# Mips Linux
1506ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
1507  LIBGNAT_TARGET_PAIRS = \
1508  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1509  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1510  s-intman.adb<libgnarl/s-intman__posix.adb \
1511  s-linux.ads<libgnarl/s-linux__mips.ads \
1512  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1513  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1514  s-osprim.adb<libgnat/s-osprim__posix.adb \
1515  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1516  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1517  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1518  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1519  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1520  g-sercom.adb<libgnat/g-sercom__linux.adb \
1521  system.ads<libgnat/system-linux-mips.ads
1522
1523  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1524
1525  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1526  EH_MECHANISM=-gcc
1527  THREADSLIB = -lpthread
1528  GNATLIB_SHARED = gnatlib-shared-dual
1529  GMEM_LIB = gmemlib
1530  LIBRARY_VERSION := $(LIB_VERSION)
1531endif
1532
1533# PowerPC and e500v2 Linux
1534ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
1535  LIBGNAT_TARGET_PAIRS_COMMON = \
1536  a-exetim.adb<libgnarl/a-exetim__posix.adb \
1537  a-exetim.ads<libgnarl/a-exetim__default.ads \
1538  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1539  a-synbar.adb<libgnarl/a-synbar__posix.adb \
1540  a-synbar.ads<libgnarl/a-synbar__posix.ads \
1541  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1542  s-intman.adb<libgnarl/s-intman__posix.adb \
1543  s-linux.ads<libgnarl/s-linux.ads \
1544  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1545  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1546  g-sercom.adb<libgnat/g-sercom__linux.adb \
1547  $(TRASYM_DWARF_UNIX_PAIRS) \
1548  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
1549  $(ATOMICS_TARGET_PAIRS) \
1550  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1551  system.ads<libgnat/system-linux-ppc.ads
1552
1553  LIBGNAT_TARGET_PAIRS = \
1554    $(LIBGNAT_TARGET_PAIRS_COMMON) \
1555    s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1556    s-osinte.ads<libgnarl/s-osinte__linux.ads \
1557    s-osprim.adb<libgnat/s-osprim__posix.adb \
1558    s-taprop.adb<libgnarl/s-taprop__linux.adb \
1559    s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1560    s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1561    s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads
1562
1563  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1564
1565  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1566  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
1567
1568  EH_MECHANISM=-gcc
1569  THREADSLIB = -lpthread -lrt
1570  GNATLIB_SHARED = gnatlib-shared-dual
1571  MISCLIB = -ldl
1572  GMEM_LIB = gmemlib
1573  LIBRARY_VERSION := $(LIB_VERSION)
1574endif
1575
1576# ARM linux, GNU eabi
1577ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
1578  LIBGNAT_TARGET_PAIRS = \
1579  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1580  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1581  s-intman.adb<libgnarl/s-intman__posix.adb \
1582  s-linux.ads<libgnarl/s-linux.ads \
1583  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1584  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1585  s-osprim.adb<libgnat/s-osprim__posix.adb \
1586  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1587  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1588  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1589  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1590  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1591  $(ATOMICS_TARGET_PAIRS) \
1592  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1593  system.ads<libgnat/system-linux-arm.ads
1594
1595  ifeq ($(strip $(filter-out arm%b,$(target_cpu))),)
1596    EH_MECHANISM=
1597  else
1598    EH_MECHANISM=-arm
1599  endif
1600
1601  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1602
1603  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1604  THREADSLIB = -lpthread
1605  GNATLIB_SHARED = gnatlib-shared-dual
1606  GMEM_LIB = gmemlib
1607  LIBRARY_VERSION := $(LIB_VERSION)
1608endif
1609
1610# AArch64 Linux
1611ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
1612  LIBGNAT_TARGET_PAIRS = \
1613  a-exetim.adb<libgnarl/a-exetim__posix.adb \
1614  a-exetim.ads<libgnarl/a-exetim__default.ads \
1615  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1616  a-synbar.adb<libgnarl/a-synbar__posix.adb \
1617  a-synbar.ads<libgnarl/a-synbar__posix.ads \
1618  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1619  s-intman.adb<libgnarl/s-intman__posix.adb \
1620  s-linux.ads<libgnarl/s-linux.ads \
1621  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1622  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1623  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1624  s-osprim.adb<libgnat/s-osprim__posix.adb \
1625  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1626  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1627  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1628  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1629  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1630  g-sercom.adb<libgnat/g-sercom__linux.adb \
1631  $(ATOMICS_TARGET_PAIRS) \
1632  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1633  system.ads<libgnat/system-linux-arm.ads
1634
1635  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1636
1637  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
1638  EH_MECHANISM=-gcc
1639  THREADSLIB=-lpthread -lrt
1640  GNATLIB_SHARED=gnatlib-shared-dual
1641  GMEM_LIB = gmemlib
1642  LIBRARY_VERSION := $(LIB_VERSION)
1643endif
1644
1645# Sparc Linux
1646ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
1647  LIBGNAT_TARGET_PAIRS = \
1648  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1649  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1650  s-intman.adb<libgnarl/s-intman__posix.adb \
1651  s-linux.ads<libgnarl/s-linux__sparc.ads \
1652  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1653  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1654  s-osprim.adb<libgnat/s-osprim__posix.adb \
1655  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1656  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1657  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1658  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1659  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1660  system.ads<libgnat/system-linux-sparc.ads
1661
1662  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1663
1664  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1665  EH_MECHANISM=-gcc
1666  THREADSLIB = -lpthread
1667  GNATLIB_SHARED = gnatlib-shared-dual
1668  GMEM_LIB = gmemlib
1669  LIBRARY_VERSION := $(LIB_VERSION)
1670endif
1671
1672# HP/PA Linux
1673ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
1674  LIBGNAT_TARGET_PAIRS = \
1675  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1676  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1677  s-intman.adb<libgnarl/s-intman__posix.adb \
1678  s-linux.ads<libgnarl/s-linux__hppa.ads \
1679  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1680  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1681  s-osprim.adb<libgnat/s-osprim__posix.adb \
1682  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1683  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1684  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1685  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1686  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1687  system.ads<libgnat/system-linux-hppa.ads
1688
1689  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1690
1691  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1692  EH_MECHANISM=-gcc
1693  THREADSLIB = -lpthread
1694  GNATLIB_SHARED = gnatlib-shared-dual
1695  GMEM_LIB = gmemlib
1696  LIBRARY_VERSION := $(LIB_VERSION)
1697endif
1698
1699# M68K Linux
1700ifeq ($(strip $(filter-out m68k% linux%,$(target_cpu) $(target_os))),)
1701  LIBGNAT_TARGET_PAIRS = \
1702  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1703  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1704  s-intman.adb<libgnarl/s-intman__posix.adb \
1705  s-linux.ads<libgnarl/s-linux.ads \
1706  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1707  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1708  s-osprim.adb<libgnat/s-osprim__posix.adb \
1709  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1710  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1711  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1712  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1713  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1714  system.ads<libgnat/system-linux-m68k.ads
1715
1716  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1717
1718  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1719  EH_MECHANISM=-gcc
1720  THREADSLIB = -lpthread
1721  GNATLIB_SHARED = gnatlib-shared-dual
1722  GMEM_LIB = gmemlib
1723  LIBRARY_VERSION := $(LIB_VERSION)
1724endif
1725
1726# SH4 Linux
1727ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
1728  LIBGNAT_TARGET_PAIRS = \
1729  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1730  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1731  s-intman.adb<libgnarl/s-intman__posix.adb \
1732  s-linux.ads<libgnarl/s-linux.ads \
1733  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1734  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1735  s-osprim.adb<libgnat/s-osprim__posix.adb \
1736  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1737  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1738  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1739  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1740  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1741  system.ads<libgnat/system-linux-sh4.ads
1742
1743  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-linux.adb
1744
1745  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1746  EH_MECHANISM=-gcc
1747  MISCLIB=
1748  THREADSLIB = -lpthread
1749  GNATLIB_SHARED = gnatlib-shared-dual
1750  GMEM_LIB = gmemlib
1751  LIBRARY_VERSION := $(LIB_VERSION)
1752endif
1753
1754# IA64 Linux
1755ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
1756  LIBGNAT_TARGET_PAIRS = \
1757  a-exetim.adb<libgnarl/a-exetim__posix.adb \
1758  a-exetim.ads<libgnarl/a-exetim__default.ads \
1759  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1760  a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
1761  a-synbar.adb<libgnarl/a-synbar__posix.adb \
1762  a-synbar.ads<libgnarl/a-synbar__posix.ads \
1763  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1764  s-intman.adb<libgnarl/s-intman__posix.adb \
1765  s-linux.ads<libgnarl/s-linux.ads \
1766  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1767  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1768  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1769  s-osprim.adb<libgnat/s-osprim__posix.adb \
1770  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1771  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1772  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1773  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1774  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1775  g-sercom.adb<libgnat/g-sercom__linux.adb \
1776  $(TRASYM_DWARF_UNIX_PAIRS) \
1777  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
1778  $(ATOMICS_TARGET_PAIRS) \
1779  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1780  system.ads<libgnat/system-linux-ia64.ads
1781
1782  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1783
1784  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1785  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
1786  EH_MECHANISM=-gcc
1787  THREADSLIB=-lpthread -lrt
1788  GNATLIB_SHARED=gnatlib-shared-dual
1789  MISCLIB = -ldl
1790  GMEM_LIB = gmemlib
1791  LIBRARY_VERSION := $(LIB_VERSION)
1792endif
1793
1794# IA64 HP-UX
1795ifeq ($(strip $(filter-out ia64% hp hpux%,$(target_cpu) $(target_vendor) $(target_os))),)
1796  LIBGNAT_TARGET_PAIRS = \
1797  a-intnam.ads<libgnarl/a-intnam__hpux.ads \
1798  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1799  s-intman.adb<libgnarl/s-intman__posix.adb \
1800  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1801  s-osinte.ads<libgnarl/s-osinte__hpux.ads \
1802  s-osprim.adb<libgnat/s-osprim__posix.adb \
1803  s-taprop.adb<libgnarl/s-taprop__posix.adb \
1804  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1805  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1806  $(TRASYM_DWARF_UNIX_PAIRS) \
1807  $(ATOMICS_TARGET_PAIRS) \
1808  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1809  system.ads<libgnat/system-hpux-ia64.ads
1810
1811  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1812
1813  MISCLIB=
1814  EH_MECHANISM=-gcc
1815  THREADSLIB=-lpthread
1816  GNATLIB_SHARED=gnatlib-shared-dual
1817  GMEM_LIB = gmemlib
1818  soext = .so
1819  SO_OPTS = -Wl,+h,
1820  LIBRARY_VERSION := $(LIB_VERSION)
1821endif
1822
1823# Alpha Linux
1824ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
1825  LIBGNAT_TARGET_PAIRS = \
1826  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1827  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1828  s-intman.adb<libgnarl/s-intman__posix.adb \
1829  s-linux.ads<libgnarl/s-linux__alpha.ads \
1830  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1831  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1832  s-osprim.adb<libgnat/s-osprim__posix.adb \
1833  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1834  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1835  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1836  s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
1837  s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
1838  $(ATOMICS_TARGET_PAIRS) \
1839  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1840  system.ads<libgnat/system-linux-alpha.ads
1841
1842  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1843
1844  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1845  EH_MECHANISM=-gcc
1846  MISCLIB=
1847  THREADSLIB=-lpthread
1848  GNATLIB_SHARED=gnatlib-shared-dual
1849  LIBRARY_VERSION := $(LIB_VERSION)
1850endif
1851
1852# x86-64 Linux
1853ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
1854  LIBGNAT_TARGET_PAIRS = \
1855  a-exetim.adb<libgnarl/a-exetim__posix.adb \
1856  a-exetim.ads<libgnarl/a-exetim__default.ads \
1857  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1858  a-synbar.adb<libgnarl/a-synbar__posix.adb \
1859  a-synbar.ads<libgnarl/a-synbar__posix.ads \
1860  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1861  s-intman.adb<libgnarl/s-intman__posix.adb \
1862  s-linux.ads<libgnarl/s-linux.ads \
1863  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1864  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1865  s-osinte.adb<libgnarl/s-osinte__posix.adb \
1866  s-osprim.adb<libgnat/s-osprim__posix.adb \
1867  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1868  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1869  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1870  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1871  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1872  g-sercom.adb<libgnat/g-sercom__linux.adb \
1873  $(TRASYM_DWARF_UNIX_PAIRS) \
1874  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
1875  $(ATOMICS_TARGET_PAIRS) \
1876  $(X86_64_TARGET_PAIRS) \
1877  system.ads<libgnat/system-linux-x86.ads
1878
1879  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1880
1881  EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1882  EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
1883  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
1884
1885  EH_MECHANISM=-gcc
1886  THREADSLIB=-lpthread -lrt
1887  MISCLIB = -ldl
1888  GNATLIB_SHARED=gnatlib-shared-dual
1889  GMEM_LIB = gmemlib
1890  LIBRARY_VERSION := $(LIB_VERSION)
1891endif
1892
1893ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
1894  LIBGNAT_TARGET_PAIRS = \
1895  a-exetim.adb<libgnarl/a-exetim__posix.adb \
1896  a-exetim.ads<libgnarl/a-exetim__default.ads \
1897  a-intnam.ads<libgnarl/a-intnam__linux.ads \
1898  a-synbar.adb<libgnarl/a-synbar__posix.adb \
1899  a-synbar.ads<libgnarl/a-synbar__posix.ads \
1900  s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1901  s-intman.adb<libgnarl/s-intman__posix.adb \
1902  s-linux.ads<libgnarl/s-linux__x32.ads \
1903  s-mudido.adb<libgnarl/s-mudido__affinity.adb \
1904  s-osinte.ads<libgnarl/s-osinte__linux.ads \
1905  s-osinte.adb<libgnarl/s-osinte__x32.adb \
1906  s-osprim.adb<libgnat/s-osprim__x32.adb \
1907  s-taprop.adb<libgnarl/s-taprop__linux.adb \
1908  s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
1909  s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
1910  s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
1911  s-taspri.ads<libgnarl/s-taspri__posix.ads \
1912  g-sercom.adb<libgnat/g-sercom__linux.adb \
1913  $(ATOMICS_TARGET_PAIRS) \
1914  $(X86_64_TARGET_PAIRS) \
1915  system.ads<libgnat/system-linux-x86.ads
1916
1917  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
1918
1919  EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
1920  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
1921  EH_MECHANISM=-gcc
1922  THREADSLIB=-lpthread -lrt
1923  GNATLIB_SHARED=gnatlib-shared-dual
1924  GMEM_LIB = gmemlib
1925  LIBRARY_VERSION := $(LIB_VERSION)
1926endif
1927
1928# Darwin (Mac OS X)
1929ifeq ($(strip $(filter-out darwin%,$(target_os))),)
1930  SO_OPTS = -shared-libgcc
1931  LIBGNAT_TARGET_PAIRS = \
1932    a-intnam.ads<libgnarl/a-intnam__darwin.ads \
1933    s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
1934    s-osinte.adb<libgnarl/s-osinte__darwin.adb \
1935    s-osinte.ads<libgnarl/s-osinte__darwin.ads \
1936    s-taprop.adb<libgnarl/s-taprop__posix.adb \
1937    s-taspri.ads<libgnarl/s-taspri__posix.ads \
1938    g-sercom.adb<libgnat/g-sercom__linux.adb \
1939    s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb
1940
1941  ifeq ($(strip $(filter-out %86,$(target_cpu))),)
1942    LIBGNAT_TARGET_PAIRS += \
1943      s-intman.adb<libgnarl/s-intman__susv3.adb \
1944      s-osprim.adb<libgnat/s-osprim__darwin.adb \
1945      $(ATOMICS_TARGET_PAIRS) \
1946      system.ads<libgnat/system-darwin-x86.ads
1947
1948    ifeq ($(strip $(MULTISUBDIR)),/x86_64)
1949      SO_OPTS += -m64
1950      LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
1951    else
1952      LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
1953    endif
1954
1955    EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
1956  endif
1957
1958  ifeq ($(strip $(filter-out %x86_64,$(target_cpu))),)
1959    LIBGNAT_TARGET_PAIRS += \
1960      s-intman.adb<libgnarl/s-intman__susv3.adb \
1961      s-osprim.adb<libgnat/s-osprim__darwin.adb \
1962      a-exetim.ads<libgnarl/a-exetim__default.ads \
1963      a-exetim.adb<libgnarl/a-exetim__darwin.adb \
1964      $(ATOMICS_TARGET_PAIRS) \
1965      system.ads<libgnat/system-darwin-x86.ads
1966
1967    ifeq ($(strip $(MULTISUBDIR)),/i386)
1968      SO_OPTS += -m32
1969      LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
1970    else
1971      LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
1972    endif
1973
1974    EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
1975    EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o
1976  endif
1977
1978  ifeq ($(strip $(filter-out powerpc%,$(target_cpu))),)
1979    LIBGNAT_TARGET_PAIRS += \
1980      s-intman.adb<libgnarl/s-intman__posix.adb \
1981      s-osprim.adb<libgnat/s-osprim__posix.adb \
1982      a-numaux.ads<libgnat/a-numaux__darwin.ads \
1983      a-numaux.adb<libgnat/a-numaux__darwin.adb \
1984      $(ATOMICS_TARGET_PAIRS) \
1985      $(ATOMICS_BUILTINS_TARGET_PAIRS) \
1986      system.ads<libgnat/system-darwin-ppc.ads
1987
1988    ifeq ($(strip $(MULTISUBDIR)),/ppc64)
1989        SO_OPTS += -m64
1990    endif
1991  endif
1992
1993  ifeq ($(strip $(filter-out arm,$(target_cpu))),)
1994    LIBGNAT_TARGET_PAIRS += \
1995      s-intman.adb<libgnarl/s-intman__susv3.adb \
1996      s-osprim.adb<libgnat/s-osprim__darwin.adb \
1997      $(ATOMICS_TARGET_PAIRS) \
1998      $(ATOMICS_BUILTINS_TARGET_PAIRS)
1999
2000    LIBGNAT_TARGET_PAIRS += \
2001      system.ads<libgnat/system-darwin-arm.ads
2002  endif
2003
2004  ifeq ($(strip $(filter-out arm64 aarch64,$(target_cpu))),)
2005    LIBGNAT_TARGET_PAIRS += \
2006      s-intman.adb<libgnarl/s-intman__susv3.adb \
2007      s-osprim.adb<libgnat/s-osprim__darwin.adb \
2008      $(ATOMICS_TARGET_PAIRS) \
2009      $(ATOMICS_BUILTINS_TARGET_PAIRS)
2010
2011    EXTRA_LIBGNAT_OBJS+=sigtramp-ios.o
2012    EXTRA_LIBGNAT_SRCS+=sigtramp.h
2013    LIBGNAT_TARGET_PAIRS += \
2014      system.ads<libgnat/system-darwin-arm.ads
2015  endif
2016
2017  TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-darwin.adb
2018
2019  EH_MECHANISM=-gcc
2020  GNATLIB_SHARED = gnatlib-shared-darwin
2021  GMEM_LIB = gmemlib
2022  LIBRARY_VERSION := $(LIB_VERSION)
2023  soext = .dylib
2024  GCC_LINK_FLAGS=-static-libstdc++
2025endif
2026
2027ifeq ($(EH_MECHANISM),-gcc)
2028  LIBGNAT_TARGET_PAIRS += \
2029    s-excmac.ads<libgnat/s-excmac__gcc.ads \
2030    s-excmac.adb<libgnat/s-excmac__gcc.adb
2031  EXTRA_LIBGNAT_OBJS+=raise-gcc.o
2032  EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o
2033endif
2034
2035ifeq ($(EH_MECHANISM),-arm)
2036  LIBGNAT_TARGET_PAIRS += \
2037    s-excmac.ads<libgnat/s-excmac__arm.ads \
2038    s-excmac.adb<libgnat/s-excmac__arm.adb
2039  EXTRA_LIBGNAT_OBJS+=raise-gcc.o
2040  EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o
2041endif
2042
2043# Configuration of host tools
2044
2045# Under linux, host tools need to be linked with -ldl
2046
2047ifeq ($(strip $(filter-out linux%,$(host_os))),)
2048   TOOLS1_LIBS=-ldl
2049endif
2050
2051# LIBGNAT_SRCS is the list of all C files (including headers) of the runtime
2052# library.  LIBGNAT_OBJS is the list of object files for libgnat.
2053# thread.c is special as put into GNATRTL_TASKING_OBJS by Makefile.rtl
2054LIBGNAT_OBJS = adadecode.o adaint.o argv.o aux-io.o 			\
2055  cal.o cio.o cstreams.o ctrl_c.o					\
2056  env.o errno.o exit.o expect.o final.o rtfinal.o rtinit.o		\
2057  init.o initialize.o locales.o mkdir.o					\
2058  raise.o seh_init.o socket.o sysdep.o					\
2059  targext.o terminals.o tracebak.o 					\
2060  $(EXTRA_LIBGNAT_OBJS)
2061
2062# NOTE ??? - when the -I option for compiling Ada code is made to work,
2063#  the library installation will change and there will be a
2064#  GNAT_RTL_SRCS.  Right now we count on being able to build GNATRTL_OBJS
2065#  from ADA_INCLUDE_SRCS.
2066
2067LIBGNAT_SRCS = $(patsubst %.o,%.c,$(LIBGNAT_OBJS))			\
2068  adadecode.h adaint.h env.h gsocket.h raise.h standard.ads.h		\
2069  tb-gcc.c libgnarl/thread.c $(EXTRA_LIBGNAT_SRCS)
2070
2071# GNATRTL_NONTASKING_OBJS and GNATRTL_TASKING_OBJS can be found in
2072# the following include file:
2073
2074include $(fsrcdir)/ada/Makefile.rtl
2075
2076# memtrack.o is special as not put into libgnat.
2077GNATRTL_OBJS = $(GNATRTL_NONTASKING_OBJS) $(GNATRTL_TASKING_OBJS) \
2078  memtrack.o
2079
2080# Run time source files
2081# Note that libgnat contains a significant number of files. In orde to avoid
2082# command line length limitations the source regexp has been split for that
2083# directory.
2084ADA_INCLUDE_SRCS =\
2085 libgnat/ada.ads libgnat/calendar.ads libgnat/directio.ads libgnat/gnat.ads libgnat/interfac.ads libgnat/ioexcept.ads \
2086 libgnat/machcode.ads libgnat/text_io.ads libgnat/unchconv.ads libgnat/unchdeal.ads \
2087 libgnat/sequenio.ads libgnat/system.ads libgnat/memtrack.adb \
2088 libgnat/a-[a-o]*.adb libgnat/a-[a-o]*.ads \
2089 libgnat/a-[p-z]*.adb libgnat/a-[p-z]*.ads \
2090 libgnat/g-[a-o]*.adb libgnat/g-[a-o]*.ads \
2091 libgnat/g-[p-z]*.adb libgnat/g-[p-z]*.ads \
2092 libgnat/s-[a-o]*.adb libgnat/s-[a-o]*.ads \
2093 libgnat/s-[p-z]*.adb libgnat/s-[p-z]*.ads \
2094 libgnat/i-[a-o]*.adb libgnat/i-[a-o]*.ads \
2095 libgnat/i-[p-z]*.adb libgnat/i-[p-z]*.ads \
2096 libgnarl/[agis]-[a-z]*.ad[sb]
2097
2098# Files that are in ADA_INCLUDE_SRCS but not in all configurations.
2099# They will be removed from the run time if not used.
2100ADA_EXCLUDE_SRCS =\
2101  g-allein.ads g-alleve.adb g-alleve.ads g-altcon.adb g-altcon.ads \
2102  g-altive.ads g-alveop.adb g-alveop.ads g-alvety.ads g-alvevi.ads \
2103  g-intpri.ads g-regist.adb g-regist.ads g-sse.ads    g-ssvety.ads \
2104  i-vxinco.adb i-vxinco.ads i-vxwoio.adb i-vxwoio.ads i-vxwork.ads \
2105  s-bb.ads     s-bbbosu.ads s-bbcaco.ads s-bbcppr.ads s-bbexti.adb \
2106  s-bbexti.ads s-bbinte.adb s-bbinte.ads s-bbprot.adb s-bbprot.ads \
2107  s-bbsle3.ads s-bbsuer.ads s-bbsule.ads s-bbthqu.adb s-bbthqu.ads \
2108  s-bbthre.adb s-bbthre.ads s-bbtiev.adb s-bbtiev.ads s-bbtime.adb \
2109  s-bbtime.ads s-bcprmu.adb s-bcprmu.ads s-btstch.adb s-btstch.ads \
2110  s-gcc.adb    s-gcc.ads    s-gccdiv.adb s-gccdiv.ads \
2111  s-gccshi.adb s-gccshi.ads \
2112  s-init.ads   s-init.adb   s-linux.ads  s-macres.ads \
2113  s-memcom.adb s-memcom.ads s-memmov.adb s-memmov.ads s-memset.adb \
2114  s-memset.ads s-mufalo.adb s-mufalo.ads s-musplo.adb s-musplo.ads \
2115  s-sam4.ads   s-sopco3.adb s-sopco3.ads s-sopco4.adb s-sopco4.ads \
2116  s-sopco5.adb s-sopco5.ads s-stchop.ads s-stchop.adb s-stm32.ads \
2117  s-strcom.adb s-strcom.ads s-thread.ads \
2118  s-vxwext.adb s-vxwext.ads \
2119  s-win32.ads  s-winext.ads
2120
2121# ADA_EXCLUDE_SRCS without the sources used by the target
2122ADA_EXCLUDE_FILES=$(filter-out \
2123  $(patsubst %$(objext),%.ads,$(GNATRTL_OBJS)) \
2124  $(patsubst %$(objext),%.adb,$(GNATRTL_OBJS)), \
2125  $(ADA_EXCLUDE_SRCS))
2126
2127LIBGNAT=../$(RTSDIR)/libgnat.a
2128
2129TOOLS_FLAGS_TO_PASS=		\
2130	"CC=$(CC)" 		\
2131	"CFLAGS=$(CFLAGS)"	\
2132	"LDFLAGS=$(LDFLAGS)"	\
2133	"ADAFLAGS=$(ADAFLAGS)"	\
2134	"INCLUDES=$(INCLUDES_FOR_SUBDIR)"\
2135	"ADA_INCLUDES=$(ADA_INCLUDES) $(ADA_INCLUDES_FOR_SUBDIR)"\
2136	"libsubdir=$(libsubdir)"	\
2137	"exeext=$(exeext)"	\
2138	"fsrcdir=$(fsrcdir)"	\
2139	"srcdir=$(fsrcdir)"	\
2140	"TOOLS_LIBS=$(TOOLS_LIBS) $(TGT_LIB)"	\
2141	"GNATMAKE=$(GNATMAKE)"	\
2142	"GNATLINK=$(GNATLINK)"	\
2143	"GNATBIND=$(GNATBIND)"
2144
2145GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(LDFLAGS)
2146
2147# Build directory for the tools. Let's copy the target-dependent
2148# sources using the same mechanism as for gnatlib. The other sources are
2149# accessed using the vpath directive below
2150
2151../stamp-tools:
2152	-$(RM) tools/*
2153	-$(RMDIR) tools
2154	-$(MKDIR) tools
2155	-(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
2156	-$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
2157	          $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\
2158	          $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
2159	                tools/$(word 1,$(subst <, ,$(PAIR)));)
2160	touch ../stamp-tools
2161
2162# when compiling the tools, the runtime has to be first on the path so that
2163# it hides the runtime files lying with the rest of the sources
2164ifeq ($(TOOLSCASE),native)
2165  vpath %.ads ../$(RTSDIR) ../
2166  vpath %.adb ../$(RTSDIR) ../
2167  vpath %.c   ../$(RTSDIR) ../
2168  vpath %.h   ../$(RTSDIR) ../
2169endif
2170
2171# in the cross tools case, everything is compiled with the native
2172# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES
2173ifeq ($(TOOLSCASE),cross)
2174  vpath %.ads ../
2175  vpath %.adb ../
2176  vpath %.c   ../
2177  vpath %.h   ../
2178endif
2179
2180# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
2181# reasons: gnatmake should be built with a recent compiler, a recent compiler
2182# may not generate ALI files compatible with an old gnatmake so it is important
2183# to be able to build gnatmake without a version of gnatmake around. Once
2184# everything has been compiled once, gnatmake can be recompiled with itself
2185# (see target gnattools1-re)
2186gnattools1: ../stamp-tools ../stamp-gnatlib-$(RTSDIR)
2187	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
2188	  TOOLSCASE=native \
2189	  ../../gnatmake$(exeext) ../../gnatlink$(exeext)
2190
2191# gnatmake/link can be built with recent gnatmake/link if they are available.
2192# This is especially convenient for building cross tools or for rebuilding
2193# the tools when the original bootstrap has already be done.
2194gnattools1-re: ../stamp-tools
2195	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
2196	  TOOLSCASE=cross INCLUDES="" gnatmake-re gnatlink-re
2197
2198# these tools are built with gnatmake & are common to native and cross
2199gnattools2: ../stamp-tools
2200	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
2201	  TOOLSCASE=native common-tools $(EXTRA_GNATTOOLS)
2202
2203# those tools are only built for the cross version
2204gnattools4: ../stamp-tools
2205ifeq ($(ENABLE_VXADDR2LINE),true)
2206	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
2207	  TOOLSCASE=cross top_buildir=../../.. \
2208	  ../../vxaddr2line$(exeext)
2209endif
2210
2211common-tools: ../stamp-tools
2212	$(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \
2213	  --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \
2214	  gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
2215	  gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
2216	$(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
2217	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2218	$(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
2219	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2220	$(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
2221	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2222	$(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
2223	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2224	$(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
2225	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2226	$(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
2227	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2228	$(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
2229	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2230	$(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
2231	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2232	$(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
2233	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2234
2235../../gnatdll$(exeext): ../stamp-tools
2236	$(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)"
2237	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll
2238	$(GNATLINK) -v gnatdll -o $@ \
2239	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2240
2241../../vxaddr2line$(exeext): ../stamp-tools
2242	$(GNATMAKE) -c  $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)"
2243	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line
2244	$(GNATLINK) -v vxaddr2line -o $@ \
2245	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" ../targext.o $(CLIB)
2246
2247gnatmake-re: ../stamp-tools
2248	$(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
2249	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
2250	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
2251	$(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
2252	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2253
2254# Note the use of the "mv" command in order to allow gnatlink to be linked with
2255# with the former version of gnatlink itself which cannot override itself.
2256# gnatlink-re cannot be run at the same time as gnatmake-re, hence the
2257# dependency
2258gnatlink-re: ../stamp-tools gnatmake-re
2259	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
2260	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
2261	$(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
2262	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
2263	$(MV)  ../../gnatlinknew$(exeext)  ../../gnatlink$(exeext)
2264
2265# Needs to be built with CC=gcc
2266# Since the RTL should be built with the latest compiler, remove the
2267#  stamp target in the parent directory whenever gnat1 is rebuilt
2268
2269# Likewise for the tools
2270../../gnatmake$(exeext): b_gnatm.o $(GNATMAKE_OBJS)
2271	+$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS)
2272
2273../../gnatlink$(exeext): b_gnatl.o $(GNATLINK_OBJS)
2274	+$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS)
2275
2276../stamp-gnatlib-$(RTSDIR):
2277	@if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \
2278	then \
2279	  $(ECHO) You must first build the GNAT library: make gnatlib; \
2280	  false; \
2281	else \
2282	  true; \
2283	fi
2284
2285install-gcc-specs:
2286#	Install all the requested GCC spec files.
2287
2288	$(foreach f,$(GCC_SPEC_FILES), \
2289	    $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) $(DESTDIR)$(libsubdir)/;)
2290
2291install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs
2292	$(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
2293	$(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
2294	-$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
2295	-$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
2296	for file in $(RTSDIR)/*.ali; do \
2297	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
2298	done
2299	-cd $(RTSDIR); for file in *$(arext);do \
2300	    $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
2301	    $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
2302	done
2303	-$(foreach file, $(EXTRA_ADALIB_OBJS), \
2304	    $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
2305	) true
2306#     Install the shared libraries, if any, using $(INSTALL) instead
2307#     of $(INSTALL_DATA). The latter may force a mode inappropriate
2308#     for shared libraries on some targets, e.g. on HP-UX where the x
2309#     permission is required.
2310#     Also install the .dSYM directories if they exist (these directories
2311#     contain the debug information for the shared libraries on darwin)
2312	for file in gnat gnarl; do \
2313	   if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
2314	      $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
2315			 $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
2316	   fi; \
2317	   if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \
2318	      $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
2319	      $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
2320	   fi; \
2321	   if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \
2322	      $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \
2323	        $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
2324	   fi; \
2325	done
2326# This copy must be done preserving the date on the original file.
2327	for file in $(RTSDIR)/*.ad[sb]*; do \
2328	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
2329	done
2330	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
2331	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
2332
2333../stamp-gnatlib2-$(RTSDIR):
2334	$(RM) $(RTSDIR)/s-*.ali
2335	$(RM) $(RTSDIR)/s-*$(objext)
2336	$(RM) $(RTSDIR)/a-*.ali
2337	$(RM) $(RTSDIR)/a-*$(objext)
2338	$(RM) $(RTSDIR)/*.ali
2339	$(RM) $(RTSDIR)/*$(objext)
2340	$(RM) $(RTSDIR)/*$(arext)
2341	$(RM) $(RTSDIR)/*$(soext)
2342	touch ../stamp-gnatlib2-$(RTSDIR)
2343	$(RM) ../stamp-gnatlib-$(RTSDIR)
2344
2345../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR)
2346	$(RMDIR) $(RTSDIR)
2347	$(MKDIR) $(RTSDIR)
2348	$(CHMOD) u+w $(RTSDIR)
2349# Copy target independent sources
2350	$(foreach f,$(ADA_INCLUDE_SRCS) $(LIBGNAT_SRCS), \
2351	  $(LN_S) $(fsrcpfx)ada/$(f) $(RTSDIR) ;) true
2352# Remove files not used
2353	$(RM) $(patsubst %,$(RTSDIR)/%,$(ADA_EXCLUDE_FILES))
2354# Remove files to be replaced by target dependent sources
2355	$(RM) $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
2356	                $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR))))
2357	for f in $(RTSDIR)/*-*__*.ads $(RTSDIR)/*-*__*.adb; do \
2358	  case "$$f" in \
2359	    $(RTSDIR)/s-stratt__*) ;; \
2360	    *) $(RM) $$f ;; \
2361	  esac; \
2362	done
2363# Copy new target dependent sources
2364	$(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \
2365	          $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
2366	                $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
2367# Copy tsystem.h
2368	$(CP) $(srcdir)/tsystem.h $(RTSDIR)
2369	$(RM) ../stamp-gnatlib-$(RTSDIR)
2370	touch ../stamp-gnatlib1-$(RTSDIR)
2371
2372# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
2373# for running it from ada/rts
2374
2375OSCONS_CC=$(subst ./xgcc,../../xgcc,$(subst -B./, -B../../,$(GCC_FOR_TARGET)))
2376
2377# The main ada source directory must be on the include path for #include "..."
2378# because s-oscons-tmplt.c requires adaint.h, gsocket.h, and any file included
2379# by these headers. However note that we must use -iquote, not -I, so that
2380# ada/types.h does not conflict with a same-named system header (VxWorks
2381# has a <types.h> header).
2382
2383OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS_FOR_C) -E -C \
2384  -DTARGET=\"$(target)\" -iquote $(fsrcpfx)ada $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
2385OSCONS_EXTRACT=$(OSCONS_CC) $(GNATLIBCFLAGS_FOR_C) -S s-oscons-tmplt.i
2386
2387# Note: if you need to build with a non-GNU compiler, you could adapt the
2388# following definitions (written for VMS DEC-C)
2389#OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
2390#             -DTARGET='""$(target)""' -I$(OSCONS_SRCDIR) s-oscons-tmplt.c
2391#
2392#OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
2393#                 -DTARGET='""$(target)""' -I$(OSCONS_SRCDIR) s-oscons-tmplt.c ; \
2394#  ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
2395#  ./s-oscons-tmplt.exe > s-oscons-tmplt.s
2396
2397./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb
2398	-$(MKDIR) ./bldtools/oscons
2399	$(RM) $(addprefix ./bldtools/oscons/,$(notdir $^))
2400	$(CP) $^ ./bldtools/oscons
2401	(cd ./bldtools/oscons ; gnatmake -q xoscons)
2402
2403$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
2404	$(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
2405	(cd $(RTSDIR) ; \
2406	    $(OSCONS_CPP) ; \
2407	    $(OSCONS_EXTRACT) ; \
2408	    ../bldtools/oscons/xoscons s-oscons)
2409
2410gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads
2411	test -f $(RTSDIR)/s-oscons.ads || exit 1
2412# C files
2413	$(MAKE) -C $(RTSDIR) \
2414		CC="`echo \"$(GCC_FOR_TARGET)\" \
2415		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
2416	        INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
2417                CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
2418	        FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
2419		srcdir=$(fsrcdir) \
2420	        -f ../Makefile $(LIBGNAT_OBJS) $(EXTRA_ADALIB_OBJS)
2421# Ada files
2422	$(MAKE) -C $(RTSDIR) \
2423		CC="`echo \"$(GCC_FOR_TARGET)\" \
2424		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
2425	        ADA_INCLUDES="" \
2426                CFLAGS="$(GNATLIBCFLAGS)" \
2427	        ADAFLAGS="$(GNATLIBFLAGS)" \
2428	        FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
2429		srcdir=$(fsrcdir) \
2430	        -f ../Makefile $(GNATRTL_OBJS)
2431	$(RM) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnarl$(arext)
2432	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat$(arext) \
2433	   $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
2434	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat$(arext)
2435	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \
2436	   $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
2437	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext)
2438        ifeq ($(GMEM_LIB),gmemlib)
2439		$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \
2440		  $(RTSDIR)/memtrack.o
2441		$(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext)
2442        endif
2443	$(CHMOD) a-wx $(RTSDIR)/*.ali
2444	touch ../stamp-gnatlib-$(RTSDIR)
2445
2446# Warning: this target assumes that LIBRARY_VERSION has been set correctly.
2447gnatlib-shared-default:
2448	$(MAKE) $(FLAGS_TO_PASS) \
2449             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2450	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
2451	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
2452	     MULTISUBDIR="$(MULTISUBDIR)" \
2453	     THREAD_KIND="$(THREAD_KIND)" \
2454             gnatlib
2455	$(RM) $(RTSDIR)/libgna*$(soext)
2456	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
2457                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
2458		$(PICFLAG_FOR_TARGET) \
2459		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2460		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
2461		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2462		$(MISCLIB) -lm
2463	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
2464                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
2465		$(PICFLAG_FOR_TARGET) \
2466		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2467		$(GNATRTL_TASKING_OBJS) \
2468		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2469		$(THREADSLIB)
2470	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2471		libgnat$(soext)
2472	cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2473		libgnarl$(soext)
2474
2475	# Create static libgnat and libgnarl compiled with -fPIC
2476	$(RM) $(RTSDIR)/libgnat_pic$(arext) $(RTSDIR)/libgnarl_pic$(arext)
2477	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat_pic$(arext) \
2478	   $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
2479	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat_pic$(arext)
2480	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl_pic$(arext) \
2481	   $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
2482	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl_pic$(arext)
2483
2484
2485gnatlib-shared-dual:
2486	$(MAKE) $(FLAGS_TO_PASS) \
2487             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2488	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2489	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2490	     MULTISUBDIR="$(MULTISUBDIR)" \
2491	     THREAD_KIND="$(THREAD_KIND)" \
2492             gnatlib-shared-default
2493	$(MV) $(RTSDIR)/libgna*$(soext) .
2494	$(MV) $(RTSDIR)/libgnat_pic$(arext) .
2495	$(MV) $(RTSDIR)/libgnarl_pic$(arext) .
2496	$(RM) ../stamp-gnatlib2-$(RTSDIR)
2497	$(MAKE) $(FLAGS_TO_PASS) \
2498             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2499	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2500	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2501	     MULTISUBDIR="$(MULTISUBDIR)" \
2502	     THREAD_KIND="$(THREAD_KIND)" \
2503             gnatlib
2504	$(MV) libgna*$(soext) $(RTSDIR)
2505	$(MV) libgnat_pic$(arext) $(RTSDIR)
2506	$(MV) libgnarl_pic$(arext) $(RTSDIR)
2507
2508gnatlib-shared-dual-win32:
2509	$(MAKE) $(FLAGS_TO_PASS) \
2510             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2511	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2512	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2513	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
2514	     MULTISUBDIR="$(MULTISUBDIR)" \
2515	     THREAD_KIND="$(THREAD_KIND)" \
2516             gnatlib-shared-win32
2517	$(MV) $(RTSDIR)/libgna*$(soext) .
2518	$(RM) ../stamp-gnatlib2-$(RTSDIR)
2519	$(MAKE) $(FLAGS_TO_PASS) \
2520             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2521	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2522	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2523	     MULTISUBDIR="$(MULTISUBDIR)" \
2524	     THREAD_KIND="$(THREAD_KIND)" \
2525             gnatlib
2526	$(MV) libgna*$(soext) $(RTSDIR)
2527
2528# ??? we need to add the option to support auto-import of arrays/records to
2529# the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
2530# use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on
2531# Windows.
2532gnatlib-shared-win32:
2533	$(MAKE) $(FLAGS_TO_PASS) \
2534             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2535	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
2536	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
2537	     MULTISUBDIR="$(MULTISUBDIR)" \
2538	     THREAD_KIND="$(THREAD_KIND)" \
2539             gnatlib
2540	$(RM) $(RTSDIR)/libgna*$(soext)
2541	$(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext)
2542	$(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext)
2543	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
2544                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
2545		$(PICFLAG_FOR_TARGET) \
2546		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2547		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
2548		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
2549	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
2550                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
2551		$(PICFLAG_FOR_TARGET) \
2552		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2553		$(GNATRTL_TASKING_OBJS) \
2554		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2555		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
2556
2557gnatlib-shared-darwin:
2558	$(MAKE) $(FLAGS_TO_PASS) \
2559	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2560	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
2561	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-common" \
2562	     MULTISUBDIR="$(MULTISUBDIR)" \
2563	     THREAD_KIND="$(THREAD_KIND)" \
2564	     gnatlib
2565	$(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
2566	$(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext)
2567	$(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext)
2568	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
2569                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
2570		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2571		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
2572		$(SO_OPTS) \
2573		-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2574		$(MISCLIB)
2575	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
2576                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
2577		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2578		$(GNATRTL_TASKING_OBJS) \
2579		$(SO_OPTS) \
2580		-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2581		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
2582	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
2583		libgnat$(soext)
2584	cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
2585		libgnarl$(soext)
2586	cd $(RTSDIR); dsymutil libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
2587	cd $(RTSDIR); dsymutil libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext)
2588
2589gnatlib-shared:
2590	$(MAKE) $(FLAGS_TO_PASS) \
2591             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2592	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2593	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2594	     MULTISUBDIR="$(MULTISUBDIR)" \
2595	     THREAD_KIND="$(THREAD_KIND)" \
2596	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
2597             $(GNATLIB_SHARED)
2598
2599# When building a SJLJ runtime for VxWorks, we need to ensure that the extra
2600# linker options needed for ZCX are not passed to prevent the inclusion of
2601# useless objects and potential troubles from the presence of extra symbols
2602# and references in some configurations.  The inhibition is performed by
2603# commenting the pragma instead of deleting the line, as the latter might
2604# result in getting multiple blank lines, hence possible style check errors.
2605gnatlib-sjlj:
2606	$(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" \
2607	THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
2608	sed \
2609	  -e 's/Frontend_Exceptions.*/Frontend_Exceptions       : constant Boolean := True;/' \
2610	  -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := False;/' \
2611	  -e 's/\(pragma Linker.*crtbe.*\)/--  \1/' \
2612	  $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
2613	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
2614	$(MAKE) $(FLAGS_TO_PASS) \
2615	     EH_MECHANISM="" \
2616	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2617	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2618	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2619	     FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
2620	     MULTISUBDIR="$(MULTISUBDIR)" \
2621	     THREAD_KIND="$(THREAD_KIND)" \
2622	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
2623
2624gnatlib-zcx:
2625	$(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" \
2626	  THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
2627	sed \
2628	  -e 's/Frontend_Exceptions.*/Frontend_Exceptions       : constant Boolean := False;/' \
2629	  -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := True;/' \
2630	  $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
2631	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
2632	$(MAKE) $(FLAGS_TO_PASS) \
2633	     EH_MECHANISM="-gcc" \
2634	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
2635	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
2636	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
2637	     FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
2638	     MULTISUBDIR="$(MULTISUBDIR)" \
2639	     THREAD_KIND="$(THREAD_KIND)" \
2640	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
2641
2642# Compiling object files from source files.
2643
2644# Note that dependencies on obstack.h are not written
2645# because that file is not part of GCC.
2646# Dependencies on gvarargs.h are not written
2647# because all that file does, when not compiling with GCC,
2648# is include the system varargs.h.
2649
2650b_gnatl.adb : $(GNATLINK_OBJS)
2651	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali
2652
2653b_gnatl.o : b_gnatl.adb
2654	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
2655	    $< $(OUTPUT_OPTION)
2656
2657b_gnatm.adb : $(GNATMAKE_OBJS)
2658	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatm.adb gnatmake.ali
2659
2660b_gnatm.o : b_gnatm.adb
2661	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
2662	    $< $(OUTPUT_OPTION)
2663
2664ADA_INCLUDE_DIR = $(libsubdir)/adainclude
2665ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
2666
2667# Special flags
2668
2669# force no sibling call optimization on s-traceb.o so the number of stack
2670# frames to be skipped when computing a call chain is not modified by
2671# optimization. We don't want inlining, either.
2672
2673s-traceb.o  : s-traceb.adb s-traceb.ads
2674	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(NO_INLINE_ADAFLAGS) \
2675	      $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
2676
2677# compile s-tasdeb.o without optimization and with debug info so that it is
2678# always possible to set conditional breakpoints on tasks.
2679
2680s-tasdeb.o  : s-tasdeb.adb s-tasdeb.ads
2681	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
2682	      $< $(OUTPUT_OPTION)
2683
2684# force no function reordering on a-except.o because of the exclusion bounds
2685# mechanism (see the source file for more detailed information).
2686# force debugging information on a-except.o so that it is always
2687# possible to set conditional breakpoints on exceptions.
2688# use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
2689
2690a-except.o  : a-except.adb a-except.ads
2691	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(NO_INLINE_ADAFLAGS) \
2692	      $(NO_REORDER_ADAFLAGS) -O1 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
2693
2694# compile s-excdeb.o without optimization and with debug info to let the
2695# debugger set breakpoints and inspect subprogram parameters on exception
2696# related events.
2697
2698s-excdeb.o  : s-excdeb.adb s-excdeb.ads s-except.ads
2699	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 $(ADA_INCLUDES) \
2700	      $< $(OUTPUT_OPTION)
2701
2702# force debugging information on s-assert.o so that it is always
2703# possible to set breakpoint on assert failures.
2704
2705s-assert.o  : s-assert.adb s-assert.ads
2706	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
2707	      $< $(OUTPUT_OPTION)
2708
2709# force debugging information on a-tags.o so that the debugger can find
2710# the description of Ada.Tags.Type_Specific_Data.
2711
2712a-tags.o  : a-tags.adb a-tags.ads
2713	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
2714	      $< $(OUTPUT_OPTION)
2715
2716# force no sibling call optimization on s-memory.o to avoid turning the
2717# tail recursion in Alloc into a loop that confuses branch prediction.
2718
2719s-memory.o  : s-memory.adb s-memory.ads
2720	$(CC) -c $(ALL_ADAFLAGS) $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) \
2721	      $< $(OUTPUT_OPTION)
2722
2723# need to keep the frame pointer in tracebak.o to pop the stack properly on
2724# some targets.
2725
2726tracebak.o  : tracebak.c tb-gcc.c
2727	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
2728	      $(INCLUDES) $(NO_OMIT_ADAFLAGS) $< $(OUTPUT_OPTION)
2729
2730adadecode.o : adadecode.c adadecode.h
2731aux-io.o  : aux-io.c
2732argv.o    : argv.c
2733cal.o     : cal.c
2734deftarg.o : deftarg.c
2735errno.o   : errno.c
2736exit.o    : adaint.h exit.c
2737expect.o  : expect.c
2738final.o   : final.c
2739rtfinal.o : rtfinal.c
2740rtinit.o  : rtinit.c
2741locales.o : locales.c
2742mkdir.o   : mkdir.c
2743socket.o  : socket.c gsocket.h
2744sysdep.o  : sysdep.c
2745raise.o   : raise.c raise.h
2746sigtramp-armdroid.o      : sigtramp-armdroid.c sigtramp.h
2747sigtramp-armvxworks.o    : sigtramp-armvxworks.c sigtramp.h
2748sigtramp-ios.o           : sigtramp-ios.c sigtramp.h
2749sigtramp-vxworks.o       : sigtramp-vxworks.c $(VX_SIGTRAMP_EXTRA_SRCS)
2750sigtramp-vxworks-vxsim.o : sigtramp-vxworks-vxsim.c $(VX_SIGTRAMP_EXTRA_SRCS)
2751terminals.o : terminals.c
2752vx_stack_info.o : vx_stack_info.c
2753
2754raise-gcc.o : raise-gcc.c raise.h
2755	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2756		-iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \
2757		$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2758
2759cio.o     : cio.c
2760	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2761	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2762
2763init.o    : init.c adaint.h raise.h
2764	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2765	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2766
2767vx_crtbegin.o : vx_crtbegin.c vx_crtbegin.inc
2768	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2769		 -iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \
2770	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2771
2772vx_crtbegin_auto.o : vx_crtbegin_auto.c vx_crtbegin.inc
2773	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2774		 -iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \
2775	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2776
2777vx_crtend.o : vx_crtend.c
2778	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2779		 -iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \
2780	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2781
2782init-vxsim.o : init-vxsim.c
2783	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2784	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2785
2786initialize.o : initialize.c raise.h
2787	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2788	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
2789
2790link.o : link.c
2791	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2792		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
2793		$< $(OUTPUT_OPTION)
2794
2795targext.o : targext.c
2796	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
2797		-iquote $(srcdir) \
2798		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
2799		$< $(OUTPUT_OPTION)
2800
2801# In GNU Make, ignore whether `stage*' exists.
2802.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
2803.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2804
2805force:
2806