1# Makefile for GNU Ada Compiler (GNAT).
2#   Copyright (C) 1994-2018 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# main GNAT source directory
192GNAT_SRC=$(fsrcpfx)ada
193
194# Multilib handling
195MULTISUBDIR =
196RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
197
198# Link flags used to build gnat tools.  By default we prefer to statically
199# link with libgcc to avoid a dependency on shared libgcc (which is tricky
200# to deal with as it may conflict with the libgcc provided by the system).
201GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc
202
203# End of variables for you to override.
204
205all: all.indirect
206
207# This tells GNU Make version 3 not to put all variables in the environment.
208.NOEXPORT:
209
210# target overrides
211ifneq ($(tmake_file),)
212include $(tmake_file)
213endif
214
215# host overrides
216ifneq ($(xmake_file),)
217include $(xmake_file)
218endif
219
220# Now figure out from those variables how to compile and link.
221
222all.indirect: Makefile ../gnat1$(exeext)
223
224# IN_GCC is meant to distinguish between code compiled into GCC itself, i.e.
225# for the host, and the rest.  But we also use it for the tools (link.c) and
226# even break the host/target wall by using it for the library (targext.c).
227# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross
228# compiler which does not use the native libraries and headers.
229INTERNAL_CFLAGS = @CROSS@ -DIN_GCC
230
231# This is the variable actually used when we compile.
232ALL_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS)
233
234# Likewise.
235ALL_CPPFLAGS = $(CPPFLAGS)
236
237# Used with $(COMPILER).
238ALL_COMPILERFLAGS = $(ALL_CFLAGS)
239
240# This is where we get libiberty.a from.
241LIBIBERTY = ../../libiberty/libiberty.a
242
243# We need to link against libbacktrace because diagnostic.c in
244# libcommon.a uses it.
245LIBBACKTRACE = ../../libbacktrace/.libs/libbacktrace.a
246
247# How to link with both our special library facilities
248# and the system's installed libraries.
249LIBS = $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) $(LIBIBERTY) $(SYSLIBS)
250LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBBACKTRACE) $(LIBIBERTY)
251# Default is no TGT_LIB; one might be passed down or something
252TGT_LIB =
253TOOLS_LIBS = ../link.o ../targext.o ../../ggc-none.o ../../libcommon-target.a \
254  ../../libcommon.a ../../../libcpp/libcpp.a $(LIBGNAT) $(LIBINTL) $(LIBICONV) \
255  ../$(LIBBACKTRACE) ../$(LIBIBERTY) $(SYSLIBS) $(TGT_LIB)
256
257# Add -no-pie to TOOLS_LIBS since some of them are compiled with -fno-PIE.
258TOOLS_LIBS += @NO_PIE_FLAG@
259
260# Specify the directories to be searched for header files.
261# Both . and srcdir are used, in that order,
262# so that tm.h and config.h will be found in the compilation
263# subdirectory rather than in the source directory.
264INCLUDES = -iquote . -iquote .. -iquote $(srcdir)/ada -iquote $(srcdir) \
265	   -I $(ftop_srcdir)/include $(GMPINC)
266
267ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
268
269# Likewise, but valid for subdirectories of the current dir.
270# FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in
271# that directory conflicts with a system header file.
272ifneq ($(findstring vxworks,$(target_os)),)
273  INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
274			-iquote $(fsrcdir)/ada \
275			-I$(ftop_srcdir)/include $(GMPINC)
276else
277  INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
278			-iquote $(fsrcdir)/ada -iquote $(fsrcdir) \
279			-I$(ftop_srcdir)/include $(GMPINC)
280endif
281
282ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
283
284# Avoid a lot of time thinking about remaking Makefile.in and *.def.
285.SUFFIXES: .in .def
286
287# Say how to compile Ada programs.
288.SUFFIXES: .ada .adb .ads .asm
289
290# Always use -I$(srcdir)/config when compiling.
291.asm.o:
292	$(CC) -c -x assembler $< $(OUTPUT_OPTION)
293
294.c.o:
295	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
296	  $(INCLUDES) $< $(OUTPUT_OPTION)
297
298.adb.o:
299	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
300
301.ads.o:
302	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
303
304# how to regenerate this file
305Makefile: ../config.status $(srcdir)/ada/gcc-interface/Makefile.in $(srcdir)/ada/Makefile.in $(srcdir)/version.c
306	cd ..; \
307	LANGUAGES="$(CONFIG_LANGUAGES)" \
308	CONFIG_HEADERS= \
309	CONFIG_FILES="ada/gcc-interface/Makefile ada/Makefile" $(SHELL) config.status
310
311# This tells GNU make version 3 not to export all the variables
312# defined in this file into the environment.
313.NOEXPORT:
314
315# Lists of files for various purposes.
316
317GNATLINK_OBJS = gnatlink.o \
318 a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \
319 gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \
320 osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
321 sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
322 types.o validsw.o widechar.o
323
324GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
325 atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o errout.o \
326 erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
327 gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
328 make.o makeusg.o make_util.o namet.o nlists.o opt.o osint.o osint-m.o \
329 output.o restrict.o rident.o s-exctab.o \
330 s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \
331 s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \
332 snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \
333 switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o uintp.o \
334 uname.o urealp.o usage.o widechar.o \
335 $(EXTRA_GNATMAKE_OBJS)
336
337# Make arch match the current multilib so that the RTS selection code
338# picks up the right files. For a given target this must be coherent
339# with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
340
341ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
342  ifeq ($(strip $(MULTISUBDIR)),/32)
343    target_cpu:=i686
344  else
345    ifeq ($(strip $(MULTISUBDIR)),/x32)
346      target_cpu:=x32
347    endif
348  endif
349endif
350
351# Configuration of host tools
352
353# Under linux, host tools need to be linked with -ldl
354
355ifeq ($(strip $(filter-out linux%,$(host_os))),)
356   TOOLS1_LIBS=-ldl
357endif
358
359include $(fsrcdir)/ada/Makefile.rtl
360
361LIBGNAT=../$(RTSDIR)/libgnat.a
362
363TOOLS_FLAGS_TO_PASS=		\
364	"CC=$(CC)" 		\
365	"CFLAGS=$(CFLAGS)"	\
366	"LDFLAGS=$(LDFLAGS)"	\
367	"ADAFLAGS=$(ADAFLAGS)"	\
368	"INCLUDES=$(INCLUDES_FOR_SUBDIR)"\
369	"ADA_INCLUDES=$(ADA_INCLUDES) $(ADA_INCLUDES_FOR_SUBDIR)"\
370	"libsubdir=$(libsubdir)"	\
371	"exeext=$(exeext)"	\
372	"fsrcdir=$(fsrcdir)"	\
373	"srcdir=$(fsrcdir)"	\
374	"TOOLS_LIBS=$(TOOLS_LIBS) $(TGT_LIB)"	\
375	"GNATMAKE=$(GNATMAKE)"	\
376	"GNATLINK=$(GNATLINK)"	\
377	"GNATBIND=$(GNATBIND)"
378
379GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(LDFLAGS)
380
381# Build directory for the tools. Let's copy the target-dependent
382# sources using the same mechanism as for gnatlib. The other sources are
383# accessed using the vpath directive below
384
385../stamp-tools:
386	-$(RM) tools/*
387	-$(RMDIR) tools
388	-$(MKDIR) tools
389	-(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
390	-$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
391	          $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\
392	          $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
393	                tools/$(word 1,$(subst <, ,$(PAIR)));)
394	touch ../stamp-tools
395
396# when compiling the tools, the runtime has to be first on the path so that
397# it hides the runtime files lying with the rest of the sources
398ifeq ($(TOOLSCASE),native)
399  vpath %.ads ../$(RTSDIR) ../
400  vpath %.adb ../$(RTSDIR) ../
401  vpath %.c   ../$(RTSDIR) ../
402  vpath %.h   ../$(RTSDIR) ../
403endif
404
405# in the cross tools case, everything is compiled with the native
406# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES
407ifeq ($(TOOLSCASE),cross)
408  vpath %.ads ../
409  vpath %.adb ../
410  vpath %.c   ../
411  vpath %.h   ../
412endif
413
414# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
415# reasons: gnatmake should be built with a recent compiler, a recent compiler
416# may not generate ALI files compatible with an old gnatmake so it is important
417# to be able to build gnatmake without a version of gnatmake around. Once
418# everything has been compiled once, gnatmake can be recompiled with itself
419# (see target gnattools1-re)
420gnattools1: ../stamp-tools ../stamp-gnatlib-$(RTSDIR)
421	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
422	  TOOLSCASE=native \
423	  ../../gnatmake$(exeext) ../../gnatlink$(exeext)
424
425# gnatmake/link can be built with recent gnatmake/link if they are available.
426# This is especially convenient for building cross tools or for rebuilding
427# the tools when the original bootstrap has already be done.
428gnattools1-re: ../stamp-tools
429	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
430	  TOOLSCASE=cross INCLUDES="" gnatmake-re gnatlink-re
431
432# these tools are built with gnatmake & are common to native and cross
433gnattools2: ../stamp-tools
434	$(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \
435	  TOOLSCASE=native common-tools $(EXTRA_GNATTOOLS)
436
437common-tools: ../stamp-tools
438	$(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \
439	  --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \
440	  gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
441	  gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
442	$(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
443	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
444	$(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
445	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
446	$(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
447	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
448	$(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
449	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
450	$(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
451	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
452	$(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
453	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
454	$(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
455	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
456	$(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
457	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
458	$(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
459	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
460
461../../gnatdll$(exeext): ../stamp-tools
462	$(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)"
463	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll
464	$(GNATLINK) -v gnatdll -o $@ \
465	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
466
467gnatmake-re: ../stamp-tools
468	$(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
469	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
470	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
471	$(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
472	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
473
474# Note the use of the "mv" command in order to allow gnatlink to be linked with
475# with the former version of gnatlink itself which cannot override itself.
476# gnatlink-re cannot be run at the same time as gnatmake-re, hence the
477# dependency
478gnatlink-re: ../stamp-tools gnatmake-re
479	$(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
480	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
481	$(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
482	  --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
483	$(MV)  ../../gnatlinknew$(exeext)  ../../gnatlink$(exeext)
484
485# Needs to be built with CC=gcc
486# Since the RTL should be built with the latest compiler, remove the
487#  stamp target in the parent directory whenever gnat1 is rebuilt
488
489# Likewise for the tools
490../../gnatmake$(exeext): b_gnatm.o $(GNATMAKE_OBJS)
491	+$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS)
492
493../../gnatlink$(exeext): b_gnatl.o $(GNATLINK_OBJS)
494	+$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS)
495
496../stamp-gnatlib-$(RTSDIR):
497	@if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \
498	then \
499	  $(ECHO) You must first build the GNAT library: make gnatlib; \
500	  false; \
501	else \
502	  true; \
503	fi
504
505install-gcc-specs:
506#	Install all the requested GCC spec files.
507
508	$(foreach f,$(GCC_SPEC_FILES), \
509	    $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) $(DESTDIR)$(libsubdir)/;)
510
511install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs
512	$(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
513	$(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
514	-$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
515	-$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR)
516	for file in $(RTSDIR)/*.ali; do \
517	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
518	done
519	-cd $(RTSDIR); for file in *$(arext);do \
520	    $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
521	    $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
522	done
523	-$(foreach file, $(EXTRA_ADALIB_OBJS), \
524	    $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
525	) true
526#     Install the shared libraries, if any, using $(INSTALL) instead
527#     of $(INSTALL_DATA). The latter may force a mode inappropriate
528#     for shared libraries on some targets, e.g. on HP-UX where the x
529#     permission is required.
530#     Also install the .dSYM directories if they exist (these directories
531#     contain the debug information for the shared libraries on darwin)
532	for file in gnat gnarl; do \
533	   if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
534	      $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
535			 $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
536	   fi; \
537	   if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \
538	      $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
539	      $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
540	   fi; \
541	   if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \
542	      $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \
543	        $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
544	   fi; \
545	done
546# This copy must be done preserving the date on the original file.
547	for file in $(RTSDIR)/*.ad[sb]*; do \
548	    $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \
549	done
550	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
551	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
552
553../stamp-gnatlib2-$(RTSDIR):
554	$(RM) $(RTSDIR)/s-*.ali
555	$(RM) $(RTSDIR)/s-*$(objext)
556	$(RM) $(RTSDIR)/a-*.ali
557	$(RM) $(RTSDIR)/a-*$(objext)
558	$(RM) $(RTSDIR)/*.ali
559	$(RM) $(RTSDIR)/*$(objext)
560	$(RM) $(RTSDIR)/*$(arext)
561	$(RM) $(RTSDIR)/*$(soext)
562	touch ../stamp-gnatlib2-$(RTSDIR)
563	$(RM) ../stamp-gnatlib-$(RTSDIR)
564
565../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR)
566	$(MAKE) MULTISUBDIR="$(MULTISUBDIR)" THREAD_KIND="$(THREAD_KIND)" setup-rts
567# Copy tsystem.h
568	$(CP) $(srcdir)/tsystem.h $(RTSDIR)
569	$(RM) ../stamp-gnatlib-$(RTSDIR)
570	touch ../stamp-gnatlib1-$(RTSDIR)
571
572# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
573# for running it from ada/rts
574
575OSCONS_CC=$(subst ./xgcc,../../xgcc,$(subst -B./, -B../../,$(GCC_FOR_TARGET)))
576
577# The main ada source directory must be on the include path for #include "..."
578# because s-oscons-tmplt.c requires adaint.h, gsocket.h, and any file included
579# by these headers. However note that we must use -iquote, not -I, so that
580# ada/types.h does not conflict with a same-named system header (VxWorks
581# has a <types.h> header).
582
583OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS_FOR_C) -E -C \
584  -DTARGET=\"$(target)\" -iquote $(fsrcpfx)ada $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
585OSCONS_EXTRACT=$(OSCONS_CC) $(GNATLIBCFLAGS_FOR_C) -S s-oscons-tmplt.i
586
587# Note: if you need to build with a non-GNU compiler, you could adapt the
588# following definitions (written for VMS DEC-C)
589#OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
590#             -DTARGET='""$(target)""' -I$(OSCONS_SRCDIR) s-oscons-tmplt.c
591#
592#OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
593#                 -DTARGET='""$(target)""' -I$(OSCONS_SRCDIR) s-oscons-tmplt.c ; \
594#  ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
595#  ./s-oscons-tmplt.exe > s-oscons-tmplt.s
596
597./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb
598	-$(MKDIR) ./bldtools/oscons
599	$(RM) $(addprefix ./bldtools/oscons/,$(notdir $^))
600	$(CP) $^ ./bldtools/oscons
601	(cd ./bldtools/oscons ; gnatmake -q xoscons)
602
603$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
604	$(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
605	(cd $(RTSDIR) ; \
606	    $(OSCONS_CPP) ; \
607	    $(OSCONS_EXTRACT) ; \
608	    ../bldtools/oscons/xoscons s-oscons)
609
610gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads
611	test -f $(RTSDIR)/s-oscons.ads || exit 1
612# C files
613	$(MAKE) -C $(RTSDIR) \
614		CC="`echo \"$(GCC_FOR_TARGET)\" \
615		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
616	        INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
617                CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
618	        FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
619		srcdir=$(fsrcdir) \
620	        -f ../Makefile $(LIBGNAT_OBJS) $(EXTRA_ADALIB_OBJS)
621# Ada files
622	$(MAKE) -C $(RTSDIR) \
623		CC="`echo \"$(GCC_FOR_TARGET)\" \
624		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
625	        ADA_INCLUDES="" \
626                CFLAGS="$(GNATLIBCFLAGS)" \
627	        ADAFLAGS="$(GNATLIBFLAGS)" \
628	        FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
629		srcdir=$(fsrcdir) \
630	        -f ../Makefile $(GNATRTL_OBJS)
631	$(RM) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnarl$(arext)
632	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat$(arext) \
633	   $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
634	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat$(arext)
635	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \
636	   $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
637	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext)
638        ifeq ($(GMEM_LIB),gmemlib)
639		$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \
640		  $(RTSDIR)/memtrack.o
641		$(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext)
642        endif
643	$(CHMOD) a-wx $(RTSDIR)/*.ali
644	touch ../stamp-gnatlib-$(RTSDIR)
645
646# Warning: this target assumes that LIBRARY_VERSION has been set correctly.
647gnatlib-shared-default:
648	$(MAKE) $(FLAGS_TO_PASS) \
649             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
650	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
651	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
652	     MULTISUBDIR="$(MULTISUBDIR)" \
653	     THREAD_KIND="$(THREAD_KIND)" \
654             gnatlib
655	$(RM) $(RTSDIR)/libgna*$(soext)
656	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
657                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
658		$(PICFLAG_FOR_TARGET) \
659		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
660		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
661		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
662		$(MISCLIB) -lm
663	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
664                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
665		$(PICFLAG_FOR_TARGET) \
666		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
667		$(GNATRTL_TASKING_OBJS) \
668		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
669		$(THREADSLIB)
670	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
671		libgnat$(soext)
672	cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
673		libgnarl$(soext)
674
675	# Create static libgnat and libgnarl compiled with -fPIC
676	$(RM) $(RTSDIR)/libgnat_pic$(arext) $(RTSDIR)/libgnarl_pic$(arext)
677	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat_pic$(arext) \
678	   $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
679	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat_pic$(arext)
680	$(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl_pic$(arext) \
681	   $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS))
682	$(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl_pic$(arext)
683
684
685gnatlib-shared-dual:
686	$(MAKE) $(FLAGS_TO_PASS) \
687             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
688	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
689	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
690	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
691	     MULTISUBDIR="$(MULTISUBDIR)" \
692	     THREAD_KIND="$(THREAD_KIND)" \
693             gnatlib-shared-default
694	$(MV) $(RTSDIR)/libgna*$(soext) .
695	$(MV) $(RTSDIR)/libgnat_pic$(arext) .
696	$(MV) $(RTSDIR)/libgnarl_pic$(arext) .
697	$(RM) ../stamp-gnatlib2-$(RTSDIR)
698	$(MAKE) $(FLAGS_TO_PASS) \
699             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
700	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
701	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
702	     MULTISUBDIR="$(MULTISUBDIR)" \
703	     THREAD_KIND="$(THREAD_KIND)" \
704             gnatlib
705	$(MV) libgna*$(soext) $(RTSDIR)
706	$(MV) libgnat_pic$(arext) $(RTSDIR)
707	$(MV) libgnarl_pic$(arext) $(RTSDIR)
708
709gnatlib-shared-dual-win32:
710	$(MAKE) $(FLAGS_TO_PASS) \
711             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
712	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
713	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
714	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
715	     MULTISUBDIR="$(MULTISUBDIR)" \
716	     THREAD_KIND="$(THREAD_KIND)" \
717             gnatlib-shared-win32
718	$(MV) $(RTSDIR)/libgna*$(soext) .
719	$(RM) ../stamp-gnatlib2-$(RTSDIR)
720	$(MAKE) $(FLAGS_TO_PASS) \
721             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
722	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
723	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
724	     MULTISUBDIR="$(MULTISUBDIR)" \
725	     THREAD_KIND="$(THREAD_KIND)" \
726             gnatlib
727	$(MV) libgna*$(soext) $(RTSDIR)
728
729# ??? we need to add the option to support auto-import of arrays/records to
730# the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
731# use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on
732# Windows.
733gnatlib-shared-win32:
734	$(MAKE) $(FLAGS_TO_PASS) \
735             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
736	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
737	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
738	     MULTISUBDIR="$(MULTISUBDIR)" \
739	     THREAD_KIND="$(THREAD_KIND)" \
740             gnatlib
741	$(RM) $(RTSDIR)/libgna*$(soext)
742	$(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext)
743	$(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext)
744	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
745                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
746		$(PICFLAG_FOR_TARGET) \
747		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
748		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
749		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
750	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
751                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
752		$(PICFLAG_FOR_TARGET) \
753		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
754		$(GNATRTL_TASKING_OBJS) \
755		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
756		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
757
758gnatlib-shared-darwin:
759	$(MAKE) $(FLAGS_TO_PASS) \
760	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
761	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
762	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-common" \
763	     MULTISUBDIR="$(MULTISUBDIR)" \
764	     THREAD_KIND="$(THREAD_KIND)" \
765	     gnatlib
766	$(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
767	$(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext)
768	$(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext)
769	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
770                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
771		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
772		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
773		$(SO_OPTS) \
774		-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
775		$(MISCLIB)
776	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
777                | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
778		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
779		$(GNATRTL_TASKING_OBJS) \
780		$(SO_OPTS) \
781		-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
782		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
783	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
784		libgnat$(soext)
785	cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
786		libgnarl$(soext)
787	cd $(RTSDIR); dsymutil libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
788	cd $(RTSDIR); dsymutil libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext)
789
790gnatlib-shared:
791	$(MAKE) $(FLAGS_TO_PASS) \
792             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
793	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
794	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
795	     MULTISUBDIR="$(MULTISUBDIR)" \
796	     THREAD_KIND="$(THREAD_KIND)" \
797	     PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
798             $(GNATLIB_SHARED)
799
800# When building a SJLJ runtime for VxWorks, we need to ensure that the extra
801# linker options needed for ZCX are not passed to prevent the inclusion of
802# useless objects and potential troubles from the presence of extra symbols
803# and references in some configurations.  The inhibition is performed by
804# commenting the pragma instead of deleting the line, as the latter might
805# result in getting multiple blank lines, hence possible style check errors.
806gnatlib-sjlj:
807	$(MAKE) $(FLAGS_TO_PASS) \
808	     EH_MECHANISM="" \
809	     MULTISUBDIR="$(MULTISUBDIR)" \
810	     THREAD_KIND="$(THREAD_KIND)" \
811	     ../stamp-gnatlib1-$(RTSDIR)
812	sed \
813	  -e 's/Frontend_Exceptions.*/Frontend_Exceptions       : constant Boolean := True;/' \
814	  -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := False;/' \
815	  $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
816	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
817	$(MAKE) $(FLAGS_TO_PASS) \
818	     EH_MECHANISM="" \
819	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
820	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
821	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
822	     FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
823	     MULTISUBDIR="$(MULTISUBDIR)" \
824	     THREAD_KIND="$(THREAD_KIND)" \
825	     gnatlib
826
827gnatlib-zcx:
828	$(MAKE) $(FLAGS_TO_PASS) \
829	     EH_MECHANISM="-gcc" \
830	     MULTISUBDIR="$(MULTISUBDIR)" \
831	     THREAD_KIND="$(THREAD_KIND)" \
832	     ../stamp-gnatlib1-$(RTSDIR)
833	sed \
834	  -e 's/Frontend_Exceptions.*/Frontend_Exceptions       : constant Boolean := False;/' \
835	  -e 's/ZCX_By_Default.*/ZCX_By_Default            : constant Boolean := True;/' \
836	  $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
837	$(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
838	$(MAKE) $(FLAGS_TO_PASS) \
839	     EH_MECHANISM="-gcc" \
840	     GNATLIBFLAGS="$(GNATLIBFLAGS)" \
841	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
842	     GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
843	     FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
844	     MULTISUBDIR="$(MULTISUBDIR)" \
845	     THREAD_KIND="$(THREAD_KIND)" \
846	     gnatlib
847
848# Compiling object files from source files.
849
850# Note that dependencies on obstack.h are not written
851# because that file is not part of GCC.
852# Dependencies on gvarargs.h are not written
853# because all that file does, when not compiling with GCC,
854# is include the system varargs.h.
855
856b_gnatl.adb : $(GNATLINK_OBJS)
857	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali
858
859b_gnatl.o : b_gnatl.adb
860	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
861	    $< $(OUTPUT_OPTION)
862
863b_gnatm.adb : $(GNATMAKE_OBJS)
864	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatm.adb gnatmake.ali
865
866b_gnatm.o : b_gnatm.adb
867	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
868	    $< $(OUTPUT_OPTION)
869
870ADA_INCLUDE_DIR = $(libsubdir)/adainclude
871ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
872
873# Special flags
874
875# need to keep the frame pointer in tracebak.o to pop the stack properly on
876# some targets.
877
878tracebak.o  : tracebak.c tb-gcc.c
879	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
880	      $(INCLUDES) $(NO_OMIT_ADAFLAGS) $< $(OUTPUT_OPTION)
881
882adadecode.o : adadecode.c adadecode.h
883aux-io.o  : aux-io.c
884argv.o    : argv.c
885cal.o     : cal.c
886deftarg.o : deftarg.c
887errno.o   : errno.c
888exit.o    : adaint.h exit.c
889expect.o  : expect.c
890final.o   : final.c
891rtfinal.o : rtfinal.c
892rtinit.o  : rtinit.c
893locales.o : locales.c
894mkdir.o   : mkdir.c
895socket.o  : socket.c gsocket.h
896sysdep.o  : sysdep.c
897raise.o   : raise.c raise.h
898sigtramp-armdroid.o      : sigtramp-armdroid.c sigtramp.h
899sigtramp-armvxworks.o    : sigtramp-armvxworks.c sigtramp.h
900sigtramp-ios.o           : sigtramp-ios.c sigtramp.h
901sigtramp-vxworks.o       : sigtramp-vxworks.c $(VX_SIGTRAMP_EXTRA_SRCS)
902sigtramp-vxworks-vxsim.o : sigtramp-vxworks-vxsim.c $(VX_SIGTRAMP_EXTRA_SRCS)
903terminals.o : terminals.c
904vx_stack_info.o : vx_stack_info.c
905
906raise-gcc.o : raise-gcc.c raise.h
907	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
908		-iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \
909		$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
910
911cio.o     : cio.c
912	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
913	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
914
915init.o    : init.c adaint.h raise.h
916	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
917	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
918
919init-vxsim.o : init-vxsim.c
920	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
921	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
922
923initialize.o : initialize.c raise.h
924	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
925	         $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
926
927link.o : link.c
928	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
929		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
930		$< $(OUTPUT_OPTION)
931
932targext.o : targext.c
933	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
934		-iquote $(srcdir) \
935		$(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \
936		$< $(OUTPUT_OPTION)
937
938# In GNU Make, ignore whether `stage*' exists.
939.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
940.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
941
942force:
943