1# Top level -*- makefile -*- fragment for GNU Ada (GNAT).
2#   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
4#   Free Software Foundation, Inc.
5
6#This file is part of GCC.
7
8#GCC is free software; you can redistribute it and/or modify
9#it under the terms of the GNU General Public License as published by
10#the Free Software Foundation; either version 3, or (at your option)
11#any later version.
12
13#GCC is distributed in the hope that it will be useful,
14#but WITHOUT ANY WARRANTY; without even the implied warranty of
15#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#GNU General Public License for more details.
17
18#You should have received a copy of the GNU General Public License
19#along with GCC; see the file COPYING3.  If not see
20#<http://www.gnu.org/licenses/>.
21
22# This file provides the language dependent support in the main Makefile.
23# Each language makefile fragment must provide the following targets:
24#
25# foo.all.cross, foo.start.encap, foo.rest.encap,
26# foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
27# foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
28# foo.mostlyclean, foo.clean, foo.distclean,
29# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
30#
31# where `foo' is the name of the language.
32#
33# It should also provide rules for:
34#
35# - making any compiler driver (eg: g++)
36# - the compiler proper (eg: cc1plus)
37# - define the names for selecting the language in LANGUAGES.
38# tool definitions
39CP = cp -p
40ECHO = echo
41MV = mv
42MKDIR = mkdir -p
43RM = rm -f
44RMDIR = rm -rf
45
46
47# Extra flags to pass to recursive makes.
48COMMON_ADAFLAGS= -gnatpg
49ifeq ($(TREECHECKING),)
50CHECKING_ADAFLAGS=
51else
52CHECKING_ADAFLAGS= -gnata
53endif
54WARN_ADAFLAGS= -W -Wall
55
56# For native builds, the base compiler might be old and we need to arrange for
57# style warnings not to be flagged as errors during stage1.  Cross compilers
58# need to be built by a recent/matching native so we might as well leave the
59# checks fully active.
60
61ifeq ($(CROSS),)
62ADAFLAGS= $(COMMON_ADAFLAGS) -gnatwns
63else
64ADAFLAGS= $(COMMON_ADAFLAGS)
65endif
66
67ALL_ADAFLAGS = \
68  $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) $(CHECKING_ADAFLAGS) $(WARN_ADAFLAGS)
69FORCE_DEBUG_ADAFLAGS = -g
70ADA_CFLAGS =
71ADA_INCLUDES = -nostdinc -I- -I. -Iada/generated -Iada -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface -Iada/libgnat -I$(srcdir)/ada/libgnat
72GNATLIBFLAGS= -W -Wall -gnatpg -nostdinc
73GNATLIBCFLAGS= -g -O2 $(TCFLAGS)
74ADA_INCLUDE_DIR = $(libsubdir)/adainclude
75ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
76THREAD_KIND=native
77TRACE=no
78# We do not want the WARN_CFLAGS of the compiler in Ada as it is for C/C++.
79COMMON_FLAGS_TO_PASS = $(filter-out $(WARN_CFLAGS), $(FLAGS_TO_PASS))
80ADA_FLAGS_TO_PASS = \
81	"ADA_FOR_BUILD=$(ADA_FOR_BUILD)"	\
82	"ADA_INCLUDE_DIR=$(ADA_INCLUDE_DIR)"	\
83	"ADA_RTL_OBJ_DIR=$(ADA_RTL_OBJ_DIR)"	\
84	"ADAFLAGS=$(ADAFLAGS) $(WARN_ADAFLAGS)"	\
85	"ADA_FOR_TARGET=$(ADA_FOR_TARGET)"	\
86	"INSTALL=$(INSTALL)" 			\
87	"INSTALL_DATA=$(INSTALL_DATA)"		\
88	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
89
90# List of Ada tools to build and install
91ADA_TOOLS=gnatbind gnatchop gnat gnatkr gnatlink gnatls gnatmake \
92          gnatname gnatprep gnatxref gnatfind gnatclean
93
94# Say how to compile Ada programs.
95.SUFFIXES: .ada .adb .ads
96
97# FIXME: need to add $(ADA_CFLAGS) to .c.o suffix rule
98# Use mildly strict warnings for this front end and add special flags.
99ada-warn = $(ADA_CFLAGS) $(filter-out -pedantic, $(STRICT_WARN))
100# Unresolved warnings in specific files.
101ada/adaint.o-warn = -Wno-error
102
103ada/%.o: ada/gcc-interface/%.c
104	$(COMPILE) $<
105	$(POSTCOMPILE)
106
107# Function that dumps the dependencies of an Ada object. Dependency only work
108# fully if the compiler support -gnatd.n. Otherwise a fallback mechanism is
109# used. The fallback mechanism parse the ali files to get the list of
110# dependencies and try to guess their location. If the location cannot be found
111# then the dependency is ignored.
112ifeq ($(findstring -gnatd.n,$(ALL_ADAFLAGS)),)
113ADA_DEPS=\
114   mkdir -p $(dir $@)/$(DEPDIR); \
115   (o="$@: $<"; \
116    a="`echo $@ | sed -e 's/.o$$/.ali/'`"; \
117    for d in `cat $$a | sed -ne 's;^D \([a-z0-9_\.-]*\).*;\1;gp'`; do \
118       for l in ada $(srcdir)/ada ada/libgnat $(srcdir)/ada/libgnat; do \
119          if test -f $$l/$$d; then \
120             o="$$o $$l/$$d"; \
121          fi; \
122       done; \
123    done; \
124    echo "$$o"; echo) \
125    >$(dir $@)/$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $@))
126ADA_OUTPUT_OPTION = $(OUTPUT_OPTION)
127else
128ADA_DEPS=\
129   mkdir -p $(dir $@)/$(DEPDIR); \
130   (echo "$@: $< " | tr -d '\015' | tr -d '\n'; \
131    cat $@.gnatd.n | tr -d '\015' | tr '\n' ' '; \
132    echo; echo) \
133   >$(dir $@)/$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $@))
134ADA_OUTPUT_OPTION = $(OUTPUT_OPTION) > $@.gnatd.n
135endif
136
137
138.adb.o:
139	mkdir -p $(dir $@)
140	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
141	@$(ADA_DEPS)
142
143.ads.o:
144	mkdir -p $(dir $@)
145	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
146	@$(ADA_DEPS)
147
148# Define the names for selecting Ada in LANGUAGES.
149ada: gnat1$(exeext) gnatbind$(exeext)
150
151# Tell GNU Make to ignore these, if they exist.
152.PHONY: ada
153
154# Compute the FLAGS to pass for gnattools, now linked with a C++ driver as
155# we're linking against at least libcommon which contains C++ compiled code.
156# We need to use the same driver to link as the one that was used to produce
157# the objects, which depends on whether we're bootstrapping or not.  The CXX
158# variable conveys what we need for this, set to "g++" if not bootstrapping,
159# ".../xg++" otherwise.
160
161# There are too many Ada sources to check against here.  Let's
162# always force the recursive make.
163ifeq ($(build), $(host))
164  ifeq ($(host), $(target))
165    # This is a regular native. So use the compiler from our current build
166    # tree.
167    ADA_TOOLS_FLAGS_TO_PASS=\
168        CC="../../xgcc -B../../" \
169        CXX="$(CXX)" \
170        $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
171        ADA_INCLUDES="-I- -I../generated -I../rts" \
172        GNATMAKE="../../gnatmake" \
173        GNATLINK="../../gnatlink" \
174        GNATBIND="../../gnatbind"
175  else
176    # This is a regular cross compiler. Use the native compiler to compile
177    # the tools.
178
179    # put the host RTS dir first in the PATH to hide the default runtime
180    # files that are among the sources
181    ifneq ($(findstring ada,$(LANGUAGES)),)
182      RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
183    endif
184
185    ADA_TOOLS_FLAGS_TO_PASS=\
186        CC="$(CC)" \
187        CXX="$(CXX)" \
188        $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
189        ADA_INCLUDES="-I../generated -I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \
190        GNATMAKE="gnatmake" \
191        GNATBIND="gnatbind" \
192        GNATLINK="gnatlink" \
193        LIBGNAT=""
194  endif
195else
196  # Build is different from host so we are either building a canadian cross
197  # or a cross-native compiler. We provide defaults for tools targeting the
198  # host platform, but they can be overriden by just setting <tool>_FOR_HOST
199  # variables.
200  GNATMAKE_FOR_HOST=$(host_noncanonical)-gnatmake
201  GNATBIND_FOR_HOST=$(host_noncanonical)-gnatbind
202  GNATLINK_FOR_HOST=$(host_noncanonical)-gnatlink
203  GNATLS_FOR_HOST=$(host_noncanonical)-gnatls
204
205  ifeq ($(host), $(target))
206    # This is a cross native. All the sources are taken from the currently
207    # built runtime.
208    ADA_TOOLS_FLAGS_TO_PASS=\
209        CC="$(CC)" \
210        CXX="$(CXX)" \
211        $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS)  \
212        ADA_INCLUDES="-I../generated -I../rts"                \
213        GNATMAKE="$(GNATMAKE_FOR_HOST)"      \
214        GNATBIND="$(GNATBIND_FOR_HOST)"      \
215        GNATLINK="$(GNATLINK_FOR_HOST)"      \
216        LIBGNAT=""
217  else
218    # This is a canadian cross. We should use a toolchain running on the
219    # build platform and targeting the host platform.
220    ifneq ($(findstring ada,$(LANGUAGES)),)
221      RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))
222    endif
223    ADA_TOOLS_FLAGS_TO_PASS=\
224        CC="$(CC)" \
225        CXX="$(CXX)" \
226        $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS)  \
227        ADA_INCLUDES="-I../generated -I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \
228        GNATMAKE="$(GNATMAKE_FOR_HOST)"      \
229        GNATBIND="$(GNATBIND_FOR_HOST)"      \
230        GNATLINK="$(GNATLINK_FOR_HOST)"      \
231        LIBGNAT=""
232  endif
233endif
234
235# Strip -Werror during linking for the LTO bootstrap
236GCC_LINKERFLAGS = $(filter-out -Werror, $(ALL_LINKERFLAGS))
237
238GCC_LINK=$(LINKER) $(GCC_LINKERFLAGS) $(LDFLAGS)
239GCC_LLINK=$(LLINKER) $(GCC_LINKERFLAGS) $(LDFLAGS)
240
241# Lists of files for various purposes.
242
243# Languages-specific object files for Ada.
244
245# Object files for gnat1 from C sources.
246GNAT1_C_OBJS = ada/adadecode.o ada/adaint.o ada/argv.o ada/cio.o \
247 ada/cstreams.o ada/env.o ada/init.o ada/initialize.o ada/raise.o \
248 ada/raise-gcc.o \
249 ada/seh_init.o ada/targext.o ada/cuintp.o ada/decl.o ada/rtfinal.o \
250 ada/rtinit.o ada/misc.o ada/utils.o ada/utils2.o ada/trans.o ada/targtyps.o
251
252# Object files from Ada sources that are used by gnat1
253GNAT_ADA_OBJS =	\
254 ada/libgnat/a-charac.o	\
255 ada/libgnat/a-chlat1.o	\
256 ada/libgnat/a-elchha.o	\
257 ada/libgnat/a-except.o	\
258 ada/libgnat/a-exctra.o \
259 ada/libgnat/a-ioexce.o	\
260 ada/libgnat/ada.o	\
261 ada/spark_xrefs.o	\
262 ada/ali.o	\
263 ada/alloc.o	\
264 ada/aspects.o  \
265 ada/atree.o	\
266 ada/butil.o	\
267 ada/casing.o	\
268 ada/checks.o	\
269 ada/comperr.o	\
270 ada/contracts.o	\
271 ada/csets.o	\
272 ada/cstand.o	\
273 ada/debug.o	\
274 ada/debug_a.o	\
275 ada/einfo.o	\
276 ada/elists.o	\
277 ada/err_vars.o	\
278 ada/errout.o	\
279 ada/erroutc.o	\
280 ada/eval_fat.o	\
281 ada/exp_aggr.o	\
282 ada/exp_spark.o	\
283 ada/exp_atag.o	\
284 ada/exp_attr.o	\
285 ada/exp_cg.o \
286 ada/exp_ch11.o	\
287 ada/exp_ch12.o	\
288 ada/exp_ch13.o	\
289 ada/exp_ch2.o	\
290 ada/exp_ch3.o	\
291 ada/exp_ch4.o	\
292 ada/exp_ch5.o	\
293 ada/exp_ch6.o	\
294 ada/exp_ch7.o	\
295 ada/exp_ch8.o	\
296 ada/exp_ch9.o	\
297 ada/exp_code.o	\
298 ada/exp_dbug.o	\
299 ada/exp_disp.o	\
300 ada/exp_dist.o	\
301 ada/exp_fixd.o	\
302 ada/exp_imgv.o	\
303 ada/exp_intr.o	\
304 ada/exp_pakd.o	\
305 ada/exp_prag.o	\
306 ada/exp_sel.o	\
307 ada/exp_smem.o	\
308 ada/exp_strm.o	\
309 ada/exp_tss.o	\
310 ada/exp_unst.o \
311 ada/exp_util.o	\
312 ada/expander.o	\
313 ada/fmap.o	\
314 ada/fname-uf.o	\
315 ada/fname.o	\
316 ada/freeze.o	\
317 ada/frontend.o	\
318 ada/libgnat/g-byorma.o	\
319 ada/libgnat/g-dynhta.o	\
320 ada/libgnat/g-hesora.o	\
321 ada/libgnat/g-htable.o	\
322 ada/libgnat/g-lists.o \
323 ada/libgnat/g-sets.o \
324 ada/libgnat/g-spchge.o	\
325 ada/libgnat/g-speche.o	\
326 ada/libgnat/g-u3spch.o	\
327 ada/get_targ.o	\
328 ada/ghost.o	\
329 ada/libgnat/gnat.o	\
330 ada/gnatvsn.o	\
331 ada/hostparm.o	\
332 ada/impunit.o	\
333 ada/inline.o	\
334 ada/libgnat/interfac.o	\
335 ada/itypes.o	\
336 ada/krunch.o	\
337 ada/layout.o	\
338 ada/lib-load.o	\
339 ada/lib-util.o	\
340 ada/lib-writ.o	\
341 ada/lib-xref.o	\
342 ada/lib.o	\
343 ada/live.o	\
344 ada/namet-sp.o	\
345 ada/namet.o	\
346 ada/nlists.o	\
347 ada/nmake.o	\
348 ada/opt.o	\
349 ada/osint-c.o	\
350 ada/osint.o	\
351 ada/output.o	\
352 ada/par.o	\
353 ada/par_sco.o	\
354 ada/prep.o	\
355 ada/prepcomp.o	\
356 ada/put_scos.o	\
357 ada/repinfo.o	\
358 ada/restrict.o	\
359 ada/rident.o	\
360 ada/rtsfind.o	\
361 ada/libgnat/s-addope.o	\
362 ada/libgnat/s-addima.o \
363 ada/libgnat/s-assert.o	\
364 ada/libgnat/s-bitops.o	\
365 ada/libgnat/s-carun8.o	\
366 ada/libgnat/s-casuti.o	\
367 ada/libgnat/s-conca2.o	\
368 ada/libgnat/s-conca3.o	\
369 ada/libgnat/s-conca4.o	\
370 ada/libgnat/s-conca5.o	\
371 ada/libgnat/s-conca6.o	\
372 ada/libgnat/s-conca7.o	\
373 ada/libgnat/s-conca8.o	\
374 ada/libgnat/s-conca9.o	\
375 ada/libgnat/s-crc32.o	\
376 ada/libgnat/s-crtl.o	\
377 ada/libgnat/s-excdeb.o	\
378 ada/libgnat/s-except.o	\
379 ada/libgnat/s-exctab.o	\
380 ada/libgnat/s-excmac.o \
381 ada/libgnat/s-htable.o	\
382 ada/libgnat/s-imenne.o	\
383 ada/libgnat/s-imgenu.o	\
384 ada/libgnat/s-imgint.o \
385 ada/libgnat/s-mastop.o	\
386 ada/libgnat/s-memory.o	\
387 ada/libgnat/s-os_lib.o	\
388 ada/libgnat/s-parame.o	\
389 ada/libgnat/s-purexc.o	\
390 ada/libgnat/s-restri.o	\
391 ada/libgnat/s-secsta.o	\
392 ada/libgnat/s-soflin.o	\
393 ada/libgnat/s-soliin.o	\
394 ada/libgnat/s-sopco3.o	\
395 ada/libgnat/s-sopco4.o	\
396 ada/libgnat/s-sopco5.o	\
397 ada/libgnat/s-stache.o	\
398 ada/libgnat/s-stalib.o	\
399 ada/libgnat/s-stoele.o	\
400 ada/libgnat/s-strcom.o	\
401 ada/libgnat/s-strhas.o	\
402 ada/libgnat/s-string.o	\
403 ada/libgnat/s-strops.o	\
404 ada/libgnat/s-traceb.o \
405 ada/libgnat/s-traent.o	\
406 ada/libgnat/s-trasym.o \
407 ada/libgnat/s-unstyp.o	\
408 ada/libgnat/s-utf_32.o	\
409 ada/libgnat/s-valint.o	\
410 ada/libgnat/s-valuns.o	\
411 ada/libgnat/s-valuti.o	\
412 ada/libgnat/s-wchcnv.o	\
413 ada/libgnat/s-wchcon.o	\
414 ada/libgnat/s-wchjis.o	\
415 ada/libgnat/s-wchstw.o \
416 ada/scans.o	\
417 ada/scil_ll.o	\
418 ada/scn.o	\
419 ada/scng.o	\
420 ada/scos.o	\
421 ada/sdefault.o	\
422 ada/sem.o	\
423 ada/sem_aggr.o	\
424 ada/sem_attr.o	\
425 ada/sem_aux.o	\
426 ada/sem_case.o	\
427 ada/sem_cat.o	\
428 ada/sem_ch10.o	\
429 ada/sem_ch11.o	\
430 ada/sem_ch12.o	\
431 ada/sem_ch13.o	\
432 ada/sem_ch2.o	\
433 ada/sem_ch3.o	\
434 ada/sem_ch4.o	\
435 ada/sem_ch5.o	\
436 ada/sem_ch6.o	\
437 ada/sem_ch7.o	\
438 ada/sem_ch8.o	\
439 ada/sem_ch9.o	\
440 ada/sem_dim.o  \
441 ada/sem_disp.o	\
442 ada/sem_dist.o	\
443 ada/sem_elab.o	\
444 ada/sem_elim.o	\
445 ada/sem_eval.o	\
446 ada/sem_intr.o	\
447 ada/sem_mech.o	\
448 ada/sem_prag.o	\
449 ada/sem_res.o	\
450 ada/sem_scil.o	\
451 ada/sem_smem.o	\
452 ada/sem_spark.o	\
453 ada/sem_type.o	\
454 ada/sem_util.o	\
455 ada/sem_warn.o	\
456 ada/set_targ.o \
457 ada/sinfo-cn.o	\
458 ada/sinfo.o	\
459 ada/sinput-d.o	\
460 ada/sinput-l.o	\
461 ada/sinput.o	\
462 ada/snames.o	\
463 ada/sprint.o	\
464 ada/stand.o	\
465 ada/stringt.o	\
466 ada/style.o	\
467 ada/styleg.o	\
468 ada/stylesw.o	\
469 ada/switch-c.o	\
470 ada/switch.o	\
471 ada/libgnat/system.o	\
472 ada/table.o	\
473 ada/targparm.o	\
474 ada/tbuild.o	\
475 ada/tree_gen.o	\
476 ada/tree_in.o	\
477 ada/tree_io.o	\
478 ada/treepr.o	\
479 ada/treeprs.o	\
480 ada/ttypes.o	\
481 ada/types.o	\
482 ada/uintp.o	\
483 ada/uname.o	\
484 ada/urealp.o	\
485 ada/usage.o	\
486 ada/validsw.o	\
487 ada/warnsw.o	\
488 ada/widechar.o
489
490# Object files for gnat executables
491GNAT1_ADA_OBJS = $(GNAT_ADA_OBJS) ada/back_end.o ada/gnat1drv.o
492
493GNAT1_OBJS = $(GNAT1_C_OBJS) $(GNAT1_ADA_OBJS) ada/b_gnat1.o
494
495GNATBIND_OBJS = \
496 ada/libgnat/a-elchha.o   \
497 ada/libgnat/a-except.o   \
498 ada/libgnat/ada.o        \
499 ada/adaint.o     \
500 ada/ali-util.o   \
501 ada/ali.o        \
502 ada/alloc.o      \
503 ada/argv.o       \
504 ada/aspects.o    \
505 ada/atree.o      \
506 ada/bcheck.o     \
507 ada/binde.o      \
508 ada/binderr.o    \
509 ada/bindgen.o    \
510 ada/bindusg.o    \
511 ada/butil.o      \
512 ada/casing.o     \
513 ada/cio.o        \
514 ada/csets.o      \
515 ada/cstreams.o   \
516 ada/debug.o      \
517 ada/einfo.o      \
518 ada/elists.o     \
519 ada/env.o        \
520 ada/err_vars.o   \
521 ada/errout.o     \
522 ada/erroutc.o    \
523 ada/exit.o       \
524 ada/final.o      \
525 ada/fmap.o       \
526 ada/fname-uf.o   \
527 ada/fname.o      \
528 ada/libgnat/g-byorma.o   \
529 ada/libgnat/g-hesora.o   \
530 ada/libgnat/g-htable.o   \
531 ada/libgnat/gnat.o       \
532 ada/gnatbind.o   \
533 ada/gnatvsn.o    \
534 ada/hostparm.o   \
535 ada/init.o       \
536 ada/initialize.o \
537 ada/libgnat/interfac.o   \
538 ada/krunch.o     \
539 ada/lib.o        \
540 ada/link.o       \
541 ada/namet.o      \
542 ada/nlists.o     \
543 ada/opt.o        \
544 ada/osint-b.o    \
545 ada/osint.o      \
546 ada/output.o     \
547 ada/raise.o      \
548 ada/raise-gcc.o  \
549 ada/restrict.o   \
550 ada/rident.o     \
551 ada/rtfinal.o    \
552 ada/rtinit.o     \
553 ada/libgnat/s-addope.o   \
554 ada/libgnat/s-assert.o   \
555 ada/libgnat/s-carun8.o   \
556 ada/libgnat/s-casuti.o   \
557 ada/libgnat/s-conca2.o   \
558 ada/libgnat/s-conca3.o   \
559 ada/libgnat/s-conca4.o   \
560 ada/libgnat/s-conca5.o   \
561 ada/libgnat/s-conca6.o   \
562 ada/libgnat/s-conca7.o   \
563 ada/libgnat/s-conca8.o   \
564 ada/libgnat/s-conca9.o   \
565 ada/libgnat/s-crc32.o    \
566 ada/libgnat/s-crtl.o     \
567 ada/libgnat/s-excdeb.o   \
568 ada/libgnat/s-except.o   \
569 ada/libgnat/s-excmac.o   \
570 ada/libgnat/s-exctab.o   \
571 ada/libgnat/s-htable.o   \
572 ada/libgnat/s-imenne.o   \
573 ada/libgnat/s-imgenu.o   \
574 ada/libgnat/s-imgint.o   \
575 ada/libgnat/s-mastop.o   \
576 ada/libgnat/s-memory.o   \
577 ada/libgnat/s-os_lib.o   \
578 ada/libgnat/s-parame.o   \
579 ada/libgnat/s-resfil.o   \
580 ada/libgnat/s-restri.o   \
581 ada/libgnat/s-secsta.o   \
582 ada/libgnat/s-soflin.o   \
583 ada/libgnat/s-soliin.o   \
584 ada/libgnat/s-sopco3.o   \
585 ada/libgnat/s-sopco4.o   \
586 ada/libgnat/s-sopco5.o   \
587 ada/libgnat/s-stache.o   \
588 ada/libgnat/s-stalib.o   \
589 ada/libgnat/s-stoele.o   \
590 ada/libgnat/s-strhas.o   \
591 ada/libgnat/s-string.o   \
592 ada/libgnat/s-strops.o   \
593 ada/libgnat/s-traent.o   \
594 ada/libgnat/s-traceb.o   \
595 ada/libgnat/s-unstyp.o   \
596 ada/libgnat/s-utf_32.o   \
597 ada/libgnat/s-wchcnv.o   \
598 ada/libgnat/s-wchcon.o   \
599 ada/libgnat/s-wchjis.o   \
600 ada/libgnat/s-wchstw.o   \
601 ada/scans.o      \
602 ada/scil_ll.o    \
603 ada/scng.o       \
604 ada/sdefault.o   \
605 ada/seh_init.o   \
606 ada/sem_aux.o    \
607 ada/sinfo.o      \
608 ada/sinput-c.o   \
609 ada/sinput.o     \
610 ada/snames.o     \
611 ada/stand.o      \
612 ada/stringt.o    \
613 ada/style.o      \
614 ada/styleg.o     \
615 ada/stylesw.o    \
616 ada/switch-b.o   \
617 ada/switch.o     \
618 ada/libgnat/system.o     \
619 ada/table.o      \
620 ada/targext.o    \
621 ada/targparm.o   \
622 ada/tree_io.o    \
623 ada/types.o      \
624 ada/uintp.o      \
625 ada/uname.o      \
626 ada/urealp.o     \
627 ada/widechar.o
628
629# Language-independent object files.
630ADA_BACKEND = $(BACKEND2) attribs.o
631
632# List of target dependent sources, overridden below as necessary
633TARGET_ADA_SRCS =
634
635# Select the right s-excmac according to exception layout (Itanium or arm)
636host_cpu=$(word 1, $(subst -, ,$(host)))
637EH_MECHANISM=gcc
638ifeq ($(strip $(filter-out arm%,$(host_cpu))),)
639EH_MECHANISM=arm
640endif
641
642# For unwind-pe.h
643CFLAGS-ada/raise-gcc.o += -I$(srcdir)/../libgcc -DEH_MECHANISM_$(EH_MECHANISM)
644
645ada/libgnat/s-excmac.o: ada/libgnat/s-excmac.ads ada/libgnat/s-excmac.adb
646
647ada/libgnat/s-excmac.ads: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).ads
648	mkdir -p ada/libgnat
649	$(CP) $< $@
650
651ada/libgnat/s-excmac.adb: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).adb
652	mkdir -p ada/libgnat
653	$(CP) $< $@
654
655# Needs to be built with CC=gcc
656# Since the RTL should be built with the latest compiler, remove the
657#  stamp target in the parent directory whenever gnat1 is rebuilt
658gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) libcommon-target.a $(LIBDEPS)
659	+$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) \
660	  libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(CFLAGS)
661	$(RM) stamp-gnatlib2-rts stamp-tools
662
663gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS)
664	+$(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(CFLAGS)
665
666# use target-gcc target-gnatmake target-gnatbind target-gnatlink
667gnattools: $(GCC_PARTS) $(CONFIG_H) prefix.o force
668	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1
669	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
670
671regnattools:
672	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re
673	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
674
675cross-gnattools: force
676	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re
677	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
678
679canadian-gnattools: force
680	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re
681	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
682
683gnatlib gnatlib-sjlj gnatlib-zcx gnatlib-shared: force
684	$(MAKE) -C ada $(COMMON_FLAGS_TO_PASS)  \
685	   GNATLIBFLAGS="$(GNATLIBFLAGS)" \
686	   GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
687	   TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
688	   THREAD_KIND="$(THREAD_KIND)" \
689	   TRACE="$(TRACE)" \
690	   FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
691	   $@
692
693# use only for native compiler
694gnatlib_and_tools: gnatlib gnattools
695
696# Build hooks:
697
698ada.all.cross:
699	for tool in $(ADA_TOOLS) ; do \
700	  if [ -f $$tool$(exeext) ] ; \
701	  then \
702	    $(MV) $$tool$(exeext) $$tool-cross$(exeext); \
703	  fi; \
704	done
705
706ada.start.encap:
707ada.rest.encap:
708ada.man:
709ada.srcextra:
710ada.srcman:
711
712ada.tags: force
713	cd $(srcdir)/ada && etags -o TAGS.sub *.c *.h *.ads *.adb && \
714	etags --include TAGS.sub --include ../TAGS.sub
715
716
717# Generate documentation.
718
719doc/gnat_ugn.info: ada/gnat_ugn.texi \
720   $(gcc_docdir)/include/fdl.texi $(gcc_docdir)/include/gcc-common.texi	\
721   gcc-vers.texi
722	if [ x$(BUILD_INFO) = xinfo ]; then \
723	  rm -f $(@)*; \
724	  $(MAKEINFO) $(MAKEINFOFLAGS) -I$(gcc_docdir)/include \
725            -I$(srcdir)/ada -o $@ $<; \
726	else true; fi
727
728doc/gnat_rm.info: ada/gnat_rm.texi $(gcc_docdir)/include/fdl.texi	\
729   $(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
730	if [ x$(BUILD_INFO) = xinfo ]; then \
731	  rm -f $(@)*; \
732	  $(MAKEINFO) $(MAKEINFOFLAGS) -I$(gcc_docdir)/include \
733            -I$(srcdir)/ada -o $@ $<; \
734	else true; fi
735
736doc/gnat-style.info: ada/gnat-style.texi $(gcc_docdir)/include/fdl.texi	\
737   $(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
738	if [ x$(BUILD_INFO) = xinfo ]; then \
739	  rm -f $(@)*; \
740	  $(MAKEINFO) $(MAKEINFOFLAGS) -I$(gcc_docdir)/include \
741            -I$(srcdir)/ada -o $@ $<; \
742	else true; fi
743
744ADA_INFOFILES = doc/gnat_ugn.info doc/gnat_rm.info doc/gnat-style.info
745
746ada.info: $(ADA_INFOFILES)
747
748ada.srcinfo: $(ADA_INFOFILES)
749	-$(CP) $^ $(srcdir)/doc
750
751ada.install-info: $(DESTDIR)$(infodir)/gnat_ugn.info \
752	$(DESTDIR)$(infodir)/gnat_rm.info \
753	$(DESTDIR)$(infodir)/gnat-style.info
754
755ada.dvi: doc/gnat_ugn.dvi \
756      doc/gnat_rm.dvi doc/gnat-style.dvi
757
758ADA_PDFFILES = doc/gnat_ugn.pdf \
759               doc/gnat_rm.pdf doc/gnat-style.pdf
760
761ada.pdf: $(ADA_PDFFILES)
762
763ada.install-pdf: $(ADA_PDFFILES)
764	@$(NORMAL_INSTALL)
765	test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
766	@list='$(ADA_PDFFILES)'; for p in $$list; do \
767	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
768	  f=$(pdf__strip_dir) \
769	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
770	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
771	done
772
773ada.html:
774
775ada.install-html:
776
777doc/gnat_ugn.dvi: ada/gnat_ugn.texi \
778	$(gcc_docdir)/include/fdl.texi	\
779	$(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
780	$(TEXI2DVI) -c -I $(abs_docdir)/include -o $@ $<
781
782doc/gnat_rm.dvi: ada/gnat_rm.texi $(gcc_docdir)/include/fdl.texi	\
783	$(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
784	$(TEXI2DVI) -c -I $(abs_docdir)/include -o $@ $<
785
786doc/gnat-style.dvi: ada/gnat-style.texi $(gcc_docdir)/include/fdl.texi
787	$(TEXI2DVI) -c -I $(abs_docdir)/include -o $@ $<
788
789doc/gnat_ugn.pdf: ada/gnat_ugn.texi \
790	$(gcc_docdir)/include/fdl.texi	\
791	$(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
792	$(TEXI2PDF) -c -I $(abs_docdir)/include -o $@ $<
793
794doc/gnat_rm.pdf: ada/gnat_rm.texi $(gcc_docdir)/include/fdl.texi	\
795	$(gcc_docdir)/include/gcc-common.texi gcc-vers.texi
796	$(TEXI2PDF) -c -I $(abs_docdir)/include -o $@ $<
797
798doc/gnat-style.pdf: ada/gnat-style.texi $(gcc_docdir)/include/fdl.texi
799	$(TEXI2PDF) -c -I $(abs_docdir)/include -o $@ $<
800
801
802# Install hooks:
803# gnat1 is installed elsewhere as part of $(COMPILERS).
804
805# Install the binder program as gnatbind (native) or $(prefix)gnatbind
806# (cross). $(prefix) comes from the --program-prefix configure option,
807# or from the --target option if the former is not specified.
808# Do the same for the rest of the Ada tools (gnatchop, gnat, gnatkr,
809# gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref, gnatfind,
810# gnatclean).
811# gnatdll is only used on Windows.
812ada.install-common:
813	$(MKDIR) $(DESTDIR)$(bindir)
814	-if [ -f gnat1$(exeext) ] ; \
815	then \
816	  for tool in $(ADA_TOOLS) ; do \
817	    install_name=`echo $$tool|sed '$(program_transform_name)'`$(exeext); \
818	    $(RM) $(DESTDIR)$(bindir)/$$install_name; \
819	    if [ -f $$tool-cross$(exeext) ] ; \
820	    then \
821	      $(INSTALL_PROGRAM) $$tool-cross$(exeext) $(DESTDIR)$(bindir)/$$install_name; \
822	    else \
823	      $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$install_name; \
824	    fi ; \
825	  done; \
826	  $(RM) $(DESTDIR)$(bindir)/gnatdll$(exeext); \
827	  $(INSTALL_PROGRAM) gnatdll$(exeext) $(DESTDIR)$(bindir)/gnatdll$(exeext); \
828	fi
829
830#
831# Finally, install the library
832#
833	-if [ -f gnat1$(exeext) ] ; \
834	then \
835	  $(MAKE) $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) install-gnatlib; \
836	fi
837
838install-gnatlib:
839	$(MAKE) -C ada $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) install-gnatlib$(LIBGNAT_TARGET)
840
841install-gnatlib-obj:
842	$(MAKE) -C ada $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) install-gnatlib-obj
843
844ada.install-man:
845ada.install-plugin:
846
847ada.uninstall:
848	for tool in $(ADA_TOOLS) ; do \
849	  install_name=`echo $$tool|sed '$(program_transform_name)'`$(exeext); \
850	  -$(RM) $(DESTDIR)$(bindir)/$$install_name; \
851	done
852	-$(RM) $(DESTDIR)$(tooldir)/bin/gnatdll$(exeext)
853
854# Clean hooks:
855# A lot of the ancillary files are deleted by the main makefile.
856# We just have to delete files specific to us.
857
858ada.mostlyclean:
859	-$(RM) ada/*$(objext) ada/*.ali ada/b_gnat*.ads ada/b_gnat*.adb
860	-$(RM) ada/*$(objext).gnatd.n
861	-$(RM) ada/*$(coverageexts)
862	-$(RM) ada/sdefault.adb ada/stamp-sdefault ada/stamp-snames
863	-$(RMDIR) ada/tools
864	-$(RMDIR) ada/libgnat
865	-$(RM) gnatbind$(exeext) gnat1$(exeext)
866ada.clean:
867ada.distclean:
868	-$(RM) ada/Makefile
869	-$(RM) gnatchop$(exeext)
870	-$(RM) gnat$(exeext)
871	-$(RM) gnatdll$(exeext)
872	-$(RM) gnatkr$(exeext)
873	-$(RM) gnatlink$(exeext)
874	-$(RM) gnatls$(exeext)
875	-$(RM) gnatmake$(exeext)
876	-$(RM) gnatname$(exeext)
877	-$(RM) gnatprep$(exeext)
878	-$(RM) gnatfind$(exeext)
879	-$(RM) gnatxref$(exeext)
880	-$(RM) gnatclean$(exeext)
881	-$(RM) ada/rts/*
882	-$(RMDIR) ada/rts
883	-$(RM) ada/tools/*
884	-$(RMDIR) ada/tools
885ada.maintainer-clean:
886	-$(RM) ada/sinfo.h
887	-$(RM) ada/einfo.h
888	-$(RM) ada/nmake.adb
889	-$(RM) ada/nmake.ads
890	-$(RM) ada/treeprs.ads
891	-$(RM) ada/snames.ads ada/snames.adb ada/snames.h
892
893# Stage hooks:
894# The main makefile has already created stage?/ada
895
896ada.stage1: stage1-start
897	-$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage1/ada
898	-$(MV) ada/stamp-* stage1/ada
899ada.stage2: stage2-start
900	-$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage2/ada
901	-$(MV) ada/stamp-* stage2/ada
902ada.stage3: stage3-start
903	-$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage3/ada
904	-$(MV) ada/stamp-* stage3/ada
905ada.stage4: stage4-start
906	-$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage4/ada
907	-$(MV) ada/stamp-* stage4/ada
908ada.stageprofile: stageprofile-start
909	-$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stageprofile/ada
910	-$(MV) ada/stamp-* stageprofile/ada
911ada.stagefeedback: stagefeedback-start
912	-$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stagefeedback/ada
913	-$(MV) ada/stamp-* stagefeedback/ada
914
915lang_checks += check-gnat
916lang_checks_parallelized += check-gnat
917# For description see the check_$lang_parallelize comment in gcc/Makefile.in.
918check_gnat_parallelize = 1000
919
920check-ada: check-acats check-gnat
921check-ada-subtargets: check-acats-subtargets check-gnat-subtargets
922
923# No ada-specific selftests
924selftest-ada:
925
926ACATSDIR = $(TESTSUITEDIR)/ada/acats
927ACATSCMD = run_acats.sh
928
929check_acats_numbers0:=1 2 3 4 5 6 7 8 9
930check_acats_numbers1:=0 $(check_acats_numbers0)
931check_acats_numbers2:=$(foreach i,$(check_acats_numbers0),$(addprefix $(i),$(check_acats_numbers1)))
932check_acats_numbers3:=$(addprefix 0,$(check_acats_numbers1)) $(check_acats_numbers2)
933check_acats_numbers4:=$(foreach i,$(check_acats_numbers0),$(addprefix $(i),$(check_acats_numbers3)))
934check_acats_numbers5:=$(addprefix 0,$(check_acats_numbers3)) $(check_acats_numbers4)
935check_acats_numbers6:=$(foreach i,$(check_acats_numbers0),$(addprefix $(i),$(check_acats_numbers5)))
936check_acats_numbers:=$(check_acats_numbers0) $(check_acats_numbers2) $(check_acats_numbers4) $(check_acats_numbers6)
937check_acats_subdirs=$(wordlist 1, \
938		    $(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
939		    $(check_acats_numbers))
940check_acats_targets = $(addprefix check-acats, $(check_acats_subdirs))
941
942check-acats:
943	@test -d $(ACATSDIR) || mkdir -p $(ACATSDIR); \
944	rootme=`${PWD_COMMAND}`; export rootme; \
945	EXPECT=$(EXPECT); export EXPECT; \
946	if [ -z "$(CHAPTERS)" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; \
947	then \
948	  rm -rf $(ACATSDIR)-parallel; \
949	  mkdir $(ACATSDIR)-parallel; \
950	  ( testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
951	    export testdir; \
952	    cd $(ACATSDIR) && $(SHELL) $${testdir}/$(ACATSCMD) NONE ) \
953	    || exit 1; \
954	  GCC_RUNTEST_PARALLELIZE_DIR=$$rootme/$(ACATSDIR)-parallel; \
955	  export GCC_RUNTEST_PARALLELIZE_DIR; \
956	  $(MAKE) $(check_acats_targets); \
957	  rm -rf $(ACATSDIR)-parallel; \
958	  acats_sums= ; acats_logs= ; \
959	  for idx in "" $(check_acats_subdirs); do \
960	    [ -d $(ACATSDIR)$$idx ] || continue; \
961	    mv -f $(ACATSDIR)$$idx/acats.sum $(ACATSDIR)$$idx/acats.sum.sep; \
962	    mv -f $(ACATSDIR)$$idx/acats.log $(ACATSDIR)$$idx/acats.log.sep; \
963	    acats_sums="$$acats_sums $(ACATSDIR)$$idx/acats.sum.sep"; \
964	    acats_logs="$$acats_logs $(ACATSDIR)$$idx/acats.log.sep"; \
965	  done; \
966	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh \
967	    $$acats_sums > $(ACATSDIR)/acats.sum; \
968	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L \
969	    $$acats_logs > $(ACATSDIR)/acats.log; \
970	  exit 0; \
971	fi; \
972	testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
973	export testdir; cd $(ACATSDIR) && $(SHELL) $${testdir}/$(ACATSCMD) $(CHAPTERS)
974
975check-acats-subtargets:
976	@echo check-acats
977
978# Parallelized check-acats
979$(check_acats_targets): check-acats%:
980	if [ -f $$GCC_RUNTEST_PARALLELIZE_DIR/finished ]; then \
981	  rm -rf $(ACATSDIR)$*; exit 0; \
982	fi; \
983	test -d $(ACATSDIR)$* || mkdir -p $(ACATSDIR)$*; \
984	testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
985	export testdir; cd $(ACATSDIR)$* && $(SHELL) $${testdir}/$(ACATSCMD)
986	touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished
987
988.PHONY: check-acats $(check_acats_targets)
989
990# Compiling object files from source files.
991
992# Ada language specific files.
993
994ada/b_gnat1.adb : $(GNAT1_ADA_OBJS)
995        # Old gnatbind do not allow a path for -o.
996	$(GNATBIND) $(ADA_INCLUDES) -o b_gnat1.adb -n ada/gnat1drv.ali
997	$(MV) b_gnat1.adb b_gnat1.ads ada/
998
999ada/b_gnat1.o : ada/b_gnat1.adb
1000        # Do not use ADAFLAGS to get rid of -gnatg which generates a lot
1001        # of style messages.
1002	$(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \
1003	    $< $(ADA_OUTPUT_OPTION)
1004
1005ada/b_gnatb.adb : $(GNATBIND_OBJS) ada/gnatbind.o ada/libgnat/interfac.o
1006        # Old gnatbind do not allow a path for -o.
1007	$(GNATBIND) $(ADA_INCLUDES) -o b_gnatb.adb ada/gnatbind.ali
1008	$(MV) b_gnatb.adb b_gnatb.ads ada/
1009
1010ada/b_gnatb.o : ada/b_gnatb.adb
1011	$(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \
1012	    $< $(ADA_OUTPUT_OPTION)
1013
1014include $(srcdir)/ada/Make-generated.in
1015
1016update-sources : ada/treeprs.ads ada/einfo.h ada/sinfo.h ada/nmake.adb \
1017	ada/nmake.ads
1018	$(RM) $(addprefix $(srcdir)/ada/,$(notdir $^))
1019	$(CP) $^ $(srcdir)/ada
1020
1021ada/sdefault.o : ada/libgnat/ada.ads ada/libgnat/a-except.ads ada/libgnat/a-unccon.ads \
1022   ada/libgnat/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/hostparm.ads ada/namet.ads \
1023   ada/opt.ads ada/osint.ads ada/output.ads ada/sdefault.ads ada/sdefault.adb \
1024   ada/libgnat/s-exctab.ads ada/libgnat/s-memory.ads ada/libgnat/s-os_lib.ads ada/libgnat/s-parame.ads \
1025   ada/libgnat/s-stalib.ads ada/libgnat/s-strops.ads ada/libgnat/s-sopco3.ads ada/libgnat/s-sopco4.ads \
1026   ada/libgnat/s-sopco5.ads ada/libgnat/s-string.ads ada/libgnat/s-traent.ads ada/libgnat/s-unstyp.ads \
1027   ada/libgnat/s-wchcon.ads ada/libgnat/system.ads ada/table.adb ada/table.ads ada/tree_io.ads \
1028   ada/types.ads ada/libgnat/unchdeal.ads ada/libgnat/unchconv.ads
1029
1030# Special flags - see gcc-interface/Makefile.in for the template.
1031
1032ada/libgnat/a-except.o : ada/libgnat/a-except.adb ada/libgnat/a-except.ads ada/libgnat/s-excmac.ads ada/libgnat/s-excmac.adb
1033	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
1034	 $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
1035	@$(ADA_DEPS)
1036
1037ada/libgnat/s-excdeb.o : ada/libgnat/s-excdeb.adb ada/libgnat/s-excdeb.ads
1038	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O0 \
1039	 $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
1040	@$(ADA_DEPS)
1041
1042ada/libgnat/s-assert.o  : ada/libgnat/s-assert.adb ada/libgnat/s-assert.ads
1043	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
1044	  $< $(ADA_OUTPUT_OPTION)
1045	@$(ADA_DEPS)
1046
1047ada/libgnat/a-tags.o  : ada/libgnat/a-tags.adb ada/libgnat/a-tags.ads
1048	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
1049	  $< $(ADA_OUTPUT_OPTION)
1050	@$(ADA_DEPS)
1051
1052# Handling of gnatvsn version string
1053
1054# This ensure the build works even if there is no GNAT_DATE present in the
1055# sources
1056ada/GNAT_DATE:
1057	touch ada/GNAT_DATE
1058
1059ada/generated/gnatvsn.ads: ada/gnatvsn.ads BASE-VER ada/GNAT_DATE
1060	$(MKDIR) ada/generated
1061	s=`cat $(srcdir)/BASE-VER | sed -e "s/\([0-9]*\)\.\([0-9]*\)\..*/-\1\2/g"`; \
1062	d=`if test -f $(srcdir)/ada/GNAT_DATE; then \
1063           cat $(srcdir)/ada/GNAT_DATE; else date +%Y%m%d; fi`; \
1064	cat $< | sed -e "/Version/s/(\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*)/($$d$$s)/g" >$@
1065
1066ada/gnatvsn.o : ada/gnatvsn.adb ada/generated/gnatvsn.ads
1067	$(CC) -c $(ALL_ADAFLAGS) -Iada/generated -I../ada/generated $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
1068	@$(ADA_DEPS)
1069
1070# Dependencies for windows specific tool (mdll)
1071
1072ada/mdll.o : ada/mdll.adb ada/mdll.ads ada/mdll-fil.ads ada/mdll-utl.ads
1073	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
1074
1075ada/mdll-fil.o : ada/mdll-fil.adb ada/mdll.ads ada/mdll-fil.ads
1076	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
1077
1078ada/mdll-utl.o : ada/mdll-utl.adb ada/mdll.ads ada/mdll-utl.ads ada/sdefault.ads ada/types.ads
1079	$(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(ADA_OUTPUT_OPTION)
1080
1081ada_generated_files = ada/sinfo.h ada/einfo.h ada/nmake.adb ada/nmake.ads \
1082		      ada/treeprs.ads ada/snames.ads ada/snames.adb ada/snames.h \
1083		      ada/generated/gnatvsn.ads
1084
1085# When building from scratch we don't have dependency files, the only thing
1086# we need to ensure is that the generated files are created first.
1087$(GNAT1_OBJS) $(GNATBIND_OBJS): | $(ada_generated_files)
1088
1089# Manually include the auto-generated dependencies for the Ada host objects.
1090ADA_DEPFILES = $(foreach obj,$(GNAT1_ADA_OBJS) $(GNATBIND_OBJS),\
1091		 $(dir $(obj))/$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj))))
1092-include $(ADA_DEPFILES)
1093
1094# Automatically include the auto-generated dependencies for the C host objects.
1095ada_OBJS = $(GNAT1_C_OBJS)
1096