]>
Commit | Line | Data |
---|---|---|
a1ab4c31 | 1 | # Makefile for GNU Ada Compiler (GNAT). |
0c28cf56 | 2 | # Copyright (C) 1994-2025 Free Software Foundation, Inc. |
a1ab4c31 AC |
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 | |
a1ab4c31 AC |
69 | CFLAGS = -g |
70 | BOOT_CFLAGS = -O $(CFLAGS) | |
00afcaa0 | 71 | # These exists to be overridden by the t-* files, respectively. |
a1ab4c31 AC |
72 | T_CFLAGS = |
73 | ||
a1ab4c31 AC |
74 | CC = cc |
75 | BISON = bison | |
76 | BISONFLAGS = | |
77 | ECHO = echo | |
78 | LEX = flex | |
79 | LEXFLAGS = | |
80 | CHMOD = chmod | |
81 | LN = ln | |
82 | LN_S = ln -s | |
83 | CP = cp -p | |
84 | MV = mv -f | |
85 | RM = rm -f | |
86 | RMDIR = rm -rf | |
87 | MKDIR = mkdir -p | |
88 | AR = ar | |
89 | AR_FLAGS = rc | |
90 | LS = ls | |
91 | RANLIB = @RANLIB@ | |
92 | RANLIB_FLAGS = @ranlib_flags@ | |
a760c977 | 93 | AWK = @AWK@ |
a1ab4c31 | 94 | |
7bec4570 EB |
95 | # Should we build position-independent host code? |
96 | enable_host_pie = @enable_host_pie@ | |
97 | PICFLAG = @PICFLAG@ | |
98 | LD_PICFLAG = @LD_PICFLAG@ | |
7980bfb8 | 99 | |
a1ab4c31 AC |
100 | SHELL = @SHELL@ |
101 | PWD_COMMAND = $${PWDCMD-pwd} | |
102 | # How to copy preserving the date | |
103 | INSTALL_DATA_DATE = cp -p | |
104 | MAKEINFO = makeinfo | |
105 | TEXI2DVI = texi2dvi | |
106 | TEXI2PDF = texi2pdf | |
bab1b248 NB |
107 | |
108 | GNATMAKE_FOR_BUILD = gnatmake | |
a1ab4c31 AC |
109 | GNATBIND_FLAGS = -static -x |
110 | ADA_CFLAGS = | |
76f9c7f4 | 111 | ADAFLAGS = -W -Wall -gnatpg -gnata -gnatU |
a1ab4c31 | 112 | FORCE_DEBUG_ADAFLAGS = -g |
9697805c | 113 | NO_INLINE_ADAFLAGS = -fno-inline |
854c00dd | 114 | NO_OMIT_ADAFLAGS = -fno-omit-frame-pointer |
0cfaf83f EB |
115 | NO_SIBLING_ADAFLAGS = -fno-optimize-sibling-calls |
116 | NO_REORDER_ADAFLAGS = -fno-toplevel-reorder | |
b6017072 | 117 | GNATLIBFLAGS = -W -Wall -gnatg -nostdinc |
a1ab4c31 | 118 | GNATLIBCFLAGS = -g -O2 |
2f18d9af EB |
119 | # Pretend that _Unwind_GetIPInfo is available for the target by default. This |
120 | # should be autodetected during the configuration of libada and passed down to | |
121 | # here, but we need something for --disable-libada and hope for the best. | |
14ecca2e EB |
122 | GNATLIBCFLAGS_FOR_C = \ |
123 | -W -Wall $(GNATLIBCFLAGS) -fexceptions -DIN_RTS -DHAVE_GETIPINFO | |
124 | PICFLAG_FOR_TARGET = @PICFLAG_FOR_TARGET@ | |
a1ab4c31 AC |
125 | THREAD_KIND = native |
126 | THREADSLIB = | |
127 | GMEM_LIB = | |
128 | MISCLIB = | |
c11c795e | 129 | OUTPUT_OPTION = -o $@ |
a1ab4c31 AC |
130 | |
131 | objext = .o | |
132 | exeext = | |
133 | arext = .a | |
134 | soext = .so | |
135 | shext = | |
136 | hyphen = - | |
137 | ||
16f19962 | 138 | # program_transform_name and objdir are set by configure.ac. |
a1ab4c31 AC |
139 | program_transform_name = |
140 | objdir = . | |
141 | ||
142 | target_alias=@target_alias@ | |
143 | target=@target@ | |
9467e733 | 144 | target_noncanonical=@target_noncanonical@ |
69d9ba63 TS |
145 | target_cpu=@target_cpu@ |
146 | target_vendor=@target_vendor@ | |
147 | target_os=@target_os@ | |
148 | host_cpu=@host_cpu@ | |
149 | host_vendor=@host_vendor@ | |
150 | host_os=@host_os@ | |
ab684dae | 151 | target_cpu_default = @target_cpu_default@ |
a1ab4c31 | 152 | xmake_file = @xmake_file@ |
903e8465 ML |
153 | #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c` |
154 | #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` | |
a1ab4c31 AC |
155 | |
156 | # Directory where sources are, from where we are. | |
a760c977 | 157 | VPATH = $(srcdir)/ada |
a1ab4c31 | 158 | |
322cb62a TQ |
159 | # Full path to top source directory |
160 | # In particular this is used to access libgcc headers, so that references to | |
161 | # these headers from GNAT runtime objects have path names in debugging info | |
162 | # that are consistent with libgcc objects. Also used for other references to | |
163 | # the top source directory for consistency. | |
164 | ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND}) | |
165 | ||
a1ab4c31 AC |
166 | fsrcdir := $(shell cd $(srcdir);${PWD_COMMAND}) |
167 | fsrcpfx := $(shell cd $(srcdir);${PWD_COMMAND})/ | |
168 | fcurdir := $(shell ${PWD_COMMAND}) | |
169 | fcurpfx := $(shell ${PWD_COMMAND})/ | |
170 | ||
171 | # Top build directory, relative to here. | |
172 | top_builddir = ../.. | |
173 | ||
174 | # Internationalization library. | |
175 | LIBINTL = @LIBINTL@ | |
176 | LIBINTL_DEP = @LIBINTL_DEP@ | |
177 | ||
0de82be5 EB |
178 | # Character encoding conversion library. |
179 | LIBICONV = @LIBICONV@ | |
180 | LIBICONV_DEP = @LIBICONV_DEP@ | |
181 | ||
a1ab4c31 AC |
182 | # Any system libraries needed just for GNAT. |
183 | SYSLIBS = @GNAT_LIBEXC@ | |
184 | ||
e1876cac EB |
185 | # List extra gnattools |
186 | EXTRA_GNATTOOLS = | |
187 | ||
a1ab4c31 AC |
188 | # List of target dependent sources, overridden below as necessary |
189 | TARGET_ADA_SRCS = | |
190 | ||
191 | # Type of tools build we are doing; default is not compiling tools. | |
192 | TOOLSCASE = | |
193 | ||
c667752e AC |
194 | # main GNAT source directory |
195 | GNAT_SRC=$(fsrcpfx)ada | |
196 | ||
a7dafa20 | 197 | # Multilib handling |
d88a51b1 | 198 | MULTISUBDIR = |
a7dafa20 LG |
199 | RTSDIR = rts$(subst /,_,$(MULTISUBDIR)) |
200 | ||
207b1744 TG |
201 | # Link flags used to build gnat tools. By default we prefer to statically |
202 | # link with libgcc to avoid a dependency on shared libgcc (which is tricky | |
203 | # to deal with as it may conflict with the libgcc provided by the system). | |
d775b5ea | 204 | GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc |
207b1744 | 205 | |
a1ab4c31 AC |
206 | # End of variables for you to override. |
207 | ||
208 | all: all.indirect | |
209 | ||
210 | # This tells GNU Make version 3 not to put all variables in the environment. | |
211 | .NOEXPORT: | |
212 | ||
a1ab4c31 AC |
213 | # host overrides |
214 | ifneq ($(xmake_file),) | |
a760c977 | 215 | include $(xmake_file) |
a1ab4c31 | 216 | endif |
e76a8cac | 217 | |
a1ab4c31 AC |
218 | # Now figure out from those variables how to compile and link. |
219 | ||
220 | all.indirect: Makefile ../gnat1$(exeext) | |
221 | ||
f2991b48 | 222 | # IN_GCC is meant to distinguish between code compiled into GCC itself, i.e. |
903e8465 | 223 | # for the host, and the rest. But we also use it for the tools (link.c) and |
f2991b48 | 224 | # even break the host/target wall by using it for the library (targext.c). |
a1ab4c31 AC |
225 | # autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a cross |
226 | # compiler which does not use the native libraries and headers. | |
227 | INTERNAL_CFLAGS = @CROSS@ -DIN_GCC | |
228 | ||
229 | # This is the variable actually used when we compile. | |
0cfaf83f | 230 | ALL_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) |
a1ab4c31 AC |
231 | |
232 | # Likewise. | |
00afcaa0 | 233 | ALL_CPPFLAGS = $(CPPFLAGS) |
a1ab4c31 | 234 | |
7bec4570 | 235 | ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) |
7980bfb8 | 236 | |
7bec4570 | 237 | ifneq ($(enable_host_pie),) |
b6cb10af | 238 | LIBIBERTY = ../../libiberty/pic/libiberty.a |
4a48a38f EB |
239 | else |
240 | LIBIBERTY = ../../libiberty/libiberty.a | |
b6cb10af | 241 | endif |
a1ab4c31 | 242 | |
903e8465 | 243 | # We need to link against libbacktrace because diagnostic.c in |
e75d8ec9 ILT |
244 | # libcommon.a uses it. |
245 | LIBBACKTRACE = ../../libbacktrace/.libs/libbacktrace.a | |
246 | ||
a1ab4c31 AC |
247 | # How to link with both our special library facilities |
248 | # and the system's installed libraries. | |
e75d8ec9 ILT |
249 | LIBS = $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) $(LIBIBERTY) $(SYSLIBS) |
250 | LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBBACKTRACE) $(LIBIBERTY) | |
a1ab4c31 AC |
251 | # Default is no TGT_LIB; one might be passed down or something |
252 | TGT_LIB = | |
0c54d25a ML |
253 | TOOLS_LIBS = ../version.o ../link.o ../targext.o ../../ggc-none.o \ |
254 | ../../libcommon-target.a ../../libcommon.a ../../../libcpp/libcpp.a \ | |
255 | $(LIBGNAT) $(LIBINTL) $(LIBICONV) ../$(LIBBACKTRACE) ../$(LIBIBERTY) \ | |
256 | $(SYSLIBS) $(TGT_LIB) | |
a1ab4c31 AC |
257 | |
258 | # Specify the directories to be searched for header files. | |
259 | # Both . and srcdir are used, in that order, | |
260 | # so that tm.h and config.h will be found in the compilation | |
261 | # subdirectory rather than in the source directory. | |
e4b2093f EB |
262 | INCLUDES = -iquote . -iquote .. -iquote $(srcdir)/ada -iquote $(srcdir) \ |
263 | -I $(ftop_srcdir)/include $(GMPINC) | |
a1ab4c31 | 264 | |
a760c977 | 265 | ADA_INCLUDES = -I- -I. -I$(srcdir)/ada |
a1ab4c31 | 266 | |
ce8d58a2 EB |
267 | # Likewise, but valid for subdirectories of the current dir. |
268 | # FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in | |
269 | # that directory conflicts with a system header file. | |
69d9ba63 | 270 | ifneq ($(findstring vxworks,$(target_os)),) |
ce8d58a2 EB |
271 | INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ |
272 | -iquote $(fsrcdir)/ada \ | |
322cb62a | 273 | -I$(ftop_srcdir)/include $(GMPINC) |
ce8d58a2 EB |
274 | else |
275 | INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ | |
276 | -iquote $(fsrcdir)/ada -iquote $(fsrcdir) \ | |
322cb62a | 277 | -I$(ftop_srcdir)/include $(GMPINC) |
ce8d58a2 | 278 | endif |
c5ecd6b7 | 279 | |
a760c977 | 280 | ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada |
a1ab4c31 AC |
281 | |
282 | # Avoid a lot of time thinking about remaking Makefile.in and *.def. | |
283 | .SUFFIXES: .in .def | |
284 | ||
285 | # Say how to compile Ada programs. | |
286 | .SUFFIXES: .ada .adb .ads .asm | |
287 | ||
288 | # Always use -I$(srcdir)/config when compiling. | |
289 | .asm.o: | |
290 | $(CC) -c -x assembler $< $(OUTPUT_OPTION) | |
291 | ||
292 | .c.o: | |
7bec4570 | 293 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) |
a1ab4c31 AC |
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 | |
903e8465 | 302 | Makefile: ../config.status $(srcdir)/ada/gcc-interface/Makefile.in $(srcdir)/ada/Makefile.in $(srcdir)/ada/version.c |
a1ab4c31 AC |
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: | |
e76a8cac | 311 | |
a1ab4c31 AC |
312 | # Lists of files for various purposes. |
313 | ||
314 | GNATLINK_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 \ | |
ba203461 | 318 | sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o \ |
a1ab4c31 AC |
319 | types.o validsw.o widechar.o |
320 | ||
9beddc4c AC |
321 | GNATMAKE_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 \ | |
a1ab4c31 AC |
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 \ | |
8a139da0 | 325 | make.o makeusg.o make_util.o namet.o nlists.o opt.o osint.o osint-m.o \ |
d089300e | 326 | output.o restrict.o rident.o s-exctab.o s-cautns.o \ |
9beddc4c AC |
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 \ | |
8a139da0 | 329 | snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \ |
ba203461 | 330 | switch.o switch-m.o table.o targparm.o tempdir.o types.o uintp.o \ |
7a08b939 | 331 | uname.o urealp.o usage.o widechar.o warnsw.o \ |
76f9c7f4 | 332 | seinfo.o einfo-entities.o einfo-utils.o sinfo-nodes.o sinfo-utils.o \ |
9ee9534c VI |
333 | errid.o \ |
334 | errsw.o \ | |
335 | erroutc-pretty_emitter.o \ | |
336 | erroutc-sarif_emitter.o \ | |
337 | json_utils.o | |
a1ab4c31 AC |
338 | $(EXTRA_GNATMAKE_OBJS) |
339 | ||
7193e639 LG |
340 | # Make arch match the current multilib so that the RTS selection code |
341 | # picks up the right files. For a given target this must be coherent | |
342 | # with MULTILIB_DIRNAMES defined in gcc/config/target/t-*. | |
343 | ||
df784801 | 344 | ifeq ($(strip $(filter-out x86_64, $(target_cpu))),) |
7193e639 | 345 | ifeq ($(strip $(MULTISUBDIR)),/32) |
69d9ba63 | 346 | target_cpu:=i686 |
8b1106fb L |
347 | else |
348 | ifeq ($(strip $(MULTISUBDIR)),/x32) | |
69d9ba63 | 349 | target_cpu:=x32 |
8b1106fb | 350 | endif |
7193e639 LG |
351 | endif |
352 | endif | |
353 | ||
2cef9917 L |
354 | # The x86_64-linux-gnux32 compiler is actually an x32 compiler |
355 | ifeq ($(strip $(filter-out x86_64 linux-gnux32%, $(target_cpu) $(target_os))),) | |
356 | ifneq ($(strip $(MULTISUBDIR)),/64) | |
357 | target_cpu:=x32 | |
358 | endif | |
359 | endif | |
360 | ||
df784801 EB |
361 | # The SuSE PowerPC64/Linux compiler is actually a 32-bit PowerPC compiler |
362 | ifeq ($(strip $(filter-out powerpc64 suse linux%, $(target_cpu) $(target_vendor) $(target_os))),) | |
363 | target_cpu:=powerpc | |
364 | endif | |
365 | ||
04b32ed7 AC |
366 | # Configuration of host tools |
367 | ||
368 | # Under linux, host tools need to be linked with -ldl | |
369 | ||
370 | ifeq ($(strip $(filter-out linux%,$(host_os))),) | |
371 | TOOLS1_LIBS=-ldl | |
372 | endif | |
373 | ||
a760c977 | 374 | include $(fsrcdir)/ada/Makefile.rtl |
a1ab4c31 | 375 | |
7bec4570 EB |
376 | ifneq ($(enable_host_pie),) |
377 | LIBGNAT=../$(RTSDIR)/libgnat_pic.a | |
378 | else | |
a7dafa20 | 379 | LIBGNAT=../$(RTSDIR)/libgnat.a |
7bec4570 | 380 | endif |
a1ab4c31 | 381 | |
e972fd52 AC |
382 | TOOLS_FLAGS_TO_PASS= \ |
383 | "CC=$(CC)" \ | |
7bec4570 EB |
384 | "CFLAGS=$(CFLAGS) $(PICFLAG)" \ |
385 | "LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ | |
e972fd52 | 386 | "ADAFLAGS=$(ADAFLAGS)" \ |
7bec4570 | 387 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
e972fd52 AC |
388 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)"\ |
389 | "ADA_INCLUDES=$(ADA_INCLUDES) $(ADA_INCLUDES_FOR_SUBDIR)"\ | |
390 | "libsubdir=$(libsubdir)" \ | |
391 | "exeext=$(exeext)" \ | |
392 | "fsrcdir=$(fsrcdir)" \ | |
393 | "srcdir=$(fsrcdir)" \ | |
394 | "TOOLS_LIBS=$(TOOLS_LIBS) $(TGT_LIB)" \ | |
395 | "GNATMAKE=$(GNATMAKE)" \ | |
396 | "GNATLINK=$(GNATLINK)" \ | |
397 | "GNATBIND=$(GNATBIND)" | |
398 | ||
3b36246b | 399 | GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(LDFLAGS) |
a1ab4c31 | 400 | |
76f9c7f4 BD |
401 | # Build directory for the tools. We first need to copy the generated files, |
402 | # then the target-dependent sources using the same mechanism as for gnatlib. | |
403 | # The other sources are accessed using the vpath directive below | |
404 | ||
405 | GENERATED_FILES_FOR_TOOLS = \ | |
406 | einfo-entities.ads einfo-entities.adb sdefault.adb seinfo.ads \ | |
407 | sinfo-nodes.ads sinfo-nodes.adb snames.ads snames.adb | |
e972fd52 AC |
408 | |
409 | ../stamp-tools: | |
ef3a7cca EB |
410 | -$(RM) tools/* |
411 | -$(RMDIR) tools | |
412 | -$(MKDIR) tools | |
76f9c7f4 BD |
413 | -(cd tools; $(foreach FILE,$(GENERATED_FILES_FOR_TOOLS), \ |
414 | $(LN_S) ../$(FILE) $(FILE);)) | |
ef3a7cca EB |
415 | -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ |
416 | $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\ | |
417 | $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \ | |
418 | tools/$(word 1,$(subst <, ,$(PAIR)));) | |
e972fd52 AC |
419 | touch ../stamp-tools |
420 | ||
a1ab4c31 AC |
421 | # when compiling the tools, the runtime has to be first on the path so that |
422 | # it hides the runtime files lying with the rest of the sources | |
423 | ifeq ($(TOOLSCASE),native) | |
a7dafa20 LG |
424 | vpath %.ads ../$(RTSDIR) ../ |
425 | vpath %.adb ../$(RTSDIR) ../ | |
426 | vpath %.c ../$(RTSDIR) ../ | |
427 | vpath %.h ../$(RTSDIR) ../ | |
a1ab4c31 AC |
428 | endif |
429 | ||
430 | # in the cross tools case, everything is compiled with the native | |
431 | # gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES | |
432 | ifeq ($(TOOLSCASE),cross) | |
433 | vpath %.ads ../ | |
434 | vpath %.adb ../ | |
435 | vpath %.c ../ | |
436 | vpath %.h ../ | |
437 | endif | |
438 | ||
e972fd52 AC |
439 | # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap |
440 | # reasons: gnatmake should be built with a recent compiler, a recent compiler | |
441 | # may not generate ALI files compatible with an old gnatmake so it is important | |
442 | # to be able to build gnatmake without a version of gnatmake around. Once | |
443 | # everything has been compiled once, gnatmake can be recompiled with itself | |
444 | # (see target gnattools1-re) | |
445 | gnattools1: ../stamp-tools ../stamp-gnatlib-$(RTSDIR) | |
446 | $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ | |
447 | TOOLSCASE=native \ | |
448 | ../../gnatmake$(exeext) ../../gnatlink$(exeext) | |
449 | ||
450 | # gnatmake/link can be built with recent gnatmake/link if they are available. | |
451 | # This is especially convenient for building cross tools or for rebuilding | |
452 | # the tools when the original bootstrap has already be done. | |
453 | gnattools1-re: ../stamp-tools | |
454 | $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ | |
455 | TOOLSCASE=cross INCLUDES="" gnatmake-re gnatlink-re | |
456 | ||
457 | # these tools are built with gnatmake & are common to native and cross | |
458 | gnattools2: ../stamp-tools | |
459 | $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ | |
460 | TOOLSCASE=native common-tools $(EXTRA_GNATTOOLS) | |
461 | ||
e972fd52 | 462 | common-tools: ../stamp-tools |
e8e38f35 | 463 | $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ |
a1ab4c31 | 464 | --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \ |
5b0e0158 | 465 | gnatchop gnatcmd gnatkr gnatls gnatprep gnatname \ |
a1ab4c31 AC |
466 | gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS) |
467 | $(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \ | |
7bec4570 EB |
468 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
469 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 470 | $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \ |
7bec4570 EB |
471 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
472 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 473 | $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \ |
7bec4570 EB |
474 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
475 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 476 | $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \ |
7bec4570 EB |
477 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
478 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 479 | $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \ |
7bec4570 EB |
480 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
481 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 482 | $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \ |
7bec4570 EB |
483 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
484 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 485 | $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \ |
7bec4570 EB |
486 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
487 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 488 | |
e972fd52 | 489 | ../../gnatdll$(exeext): ../stamp-tools |
a1ab4c31 AC |
490 | $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)" |
491 | $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll | |
3b36246b | 492 | $(GNATLINK) -v gnatdll -o $@ \ |
7bec4570 EB |
493 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
494 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 495 | |
07efff25 | 496 | gnatmake-re: ../stamp-tools |
7bec4570 | 497 | $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(ALL_ADAFLAGS)" |
e8e38f35 | 498 | $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)" |
a1ab4c31 AC |
499 | $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake |
500 | $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \ | |
7bec4570 EB |
501 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
502 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 | 503 | |
de6fe618 | 504 | # Note the use of the "mv" command in order to allow gnatlink to be linked |
a1ab4c31 | 505 | # with the former version of gnatlink itself which cannot override itself. |
e8e38f35 AC |
506 | # gnatlink-re cannot be run at the same time as gnatmake-re, hence the |
507 | # dependency | |
07efff25 | 508 | gnatlink-re: ../stamp-tools gnatmake-re |
e8e38f35 | 509 | $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)" |
a1ab4c31 AC |
510 | $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink |
511 | $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ | |
7bec4570 EB |
512 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ |
513 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
a1ab4c31 AC |
514 | $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext) |
515 | ||
516 | # Needs to be built with CC=gcc | |
517 | # Since the RTL should be built with the latest compiler, remove the | |
518 | # stamp target in the parent directory whenever gnat1 is rebuilt | |
519 | ||
520 | # Likewise for the tools | |
b34a929a | 521 | ../../gnatmake$(exeext): b_gnatm.o $(GNATMAKE_OBJS) |
04b32ed7 | 522 | +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS) |
a1ab4c31 | 523 | |
b34a929a | 524 | ../../gnatlink$(exeext): b_gnatl.o $(GNATLINK_OBJS) |
04b32ed7 | 525 | +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS) |
a1ab4c31 | 526 | |
a7dafa20 LG |
527 | ../stamp-gnatlib-$(RTSDIR): |
528 | @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \ | |
a1ab4c31 AC |
529 | then \ |
530 | $(ECHO) You must first build the GNAT library: make gnatlib; \ | |
531 | false; \ | |
532 | else \ | |
533 | true; \ | |
534 | fi | |
535 | ||
93a87598 AC |
536 | install-gcc-specs: |
537 | # Install all the requested GCC spec files. | |
538 | ||
339197c7 RO |
539 | $(foreach f,$(GCC_SPEC_FILES), \ |
540 | $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) $(DESTDIR)$(libsubdir)/;) | |
93a87598 AC |
541 | |
542 | install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs | |
a1ab4c31 AC |
543 | $(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR) |
544 | $(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR) | |
545 | -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR) | |
546 | -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR) | |
a7dafa20 | 547 | for file in $(RTSDIR)/*.ali; do \ |
a1ab4c31 AC |
548 | $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ |
549 | done | |
bd0feb3c JG |
550 | $(INSTALL_DATA_DATE) $(RTSDIR)/ada_target_properties \ |
551 | $(DESTDIR)$(ADA_RTL_OBJ_DIR)/../ | |
a7dafa20 | 552 | -cd $(RTSDIR); for file in *$(arext);do \ |
a1ab4c31 AC |
553 | $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ |
554 | $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \ | |
555 | done | |
cbe91164 | 556 | -$(foreach file, $(EXTRA_ADALIB_OBJS), \ |
a7dafa20 | 557 | $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \ |
a1ab4c31 AC |
558 | ) true |
559 | # Install the shared libraries, if any, using $(INSTALL) instead | |
560 | # of $(INSTALL_DATA). The latter may force a mode inappropriate | |
561 | # for shared libraries on some targets, e.g. on HP-UX where the x | |
562 | # permission is required. | |
059caa3e | 563 | # Also install the .dSYM directories if they exist (these directories |
69416e98 | 564 | # contain the debug information for the shared libraries on darwin) |
a1ab4c31 | 565 | for file in gnat gnarl; do \ |
69416e98 AC |
566 | if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \ |
567 | $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
13681906 | 568 | $(DESTDIR)$(ADA_RTL_DSO_DIR); \ |
a1ab4c31 | 569 | fi; \ |
a7dafa20 | 570 | if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \ |
a1ab4c31 | 571 | $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
13681906 | 572 | $(DESTDIR)$(ADA_RTL_DSO_DIR)/lib$${file}$(soext); \ |
a1ab4c31 | 573 | fi; \ |
d88a51b1 AC |
574 | if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \ |
575 | $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \ | |
13681906 | 576 | $(DESTDIR)$(ADA_RTL_DSO_DIR); \ |
059caa3e | 577 | fi; \ |
a1ab4c31 AC |
578 | done |
579 | # This copy must be done preserving the date on the original file. | |
767cd81c | 580 | for file in $(RTSDIR)/*.ad[sb]*; do \ |
a1ab4c31 AC |
581 | $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \ |
582 | done | |
583 | cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb | |
584 | cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads | |
585 | ||
a7dafa20 LG |
586 | ../stamp-gnatlib2-$(RTSDIR): |
587 | $(RM) $(RTSDIR)/s-*.ali | |
588 | $(RM) $(RTSDIR)/s-*$(objext) | |
589 | $(RM) $(RTSDIR)/a-*.ali | |
590 | $(RM) $(RTSDIR)/a-*$(objext) | |
591 | $(RM) $(RTSDIR)/*.ali | |
592 | $(RM) $(RTSDIR)/*$(objext) | |
593 | $(RM) $(RTSDIR)/*$(arext) | |
594 | $(RM) $(RTSDIR)/*$(soext) | |
595 | touch ../stamp-gnatlib2-$(RTSDIR) | |
596 | $(RM) ../stamp-gnatlib-$(RTSDIR) | |
a1ab4c31 | 597 | |
a7dafa20 | 598 | ../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR) |
07c6ed01 | 599 | $(MAKE) MULTISUBDIR="$(MULTISUBDIR)" THREAD_KIND="$(THREAD_KIND)" LN_S="$(LN_S)" setup-rts |
e1876cac | 600 | # Copy tsystem.h |
cdc4cc65 | 601 | $(CP) $(srcdir)/tsystem.h $(RTSDIR) |
a7dafa20 LG |
602 | $(RM) ../stamp-gnatlib-$(RTSDIR) |
603 | touch ../stamp-gnatlib1-$(RTSDIR) | |
a1ab4c31 | 604 | |
93a87598 | 605 | # GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust |
163fa9a6 | 606 | # for running it from ada/rts. |
015bee83 | 607 | |
163fa9a6 | 608 | GCC_FOR_ADA_RTS=$(subst ./xgcc,../../xgcc,$(subst -B./, -B../../,$(GCC_FOR_TARGET))) |
4c166488 | 609 | |
93a87598 AC |
610 | # The main ada source directory must be on the include path for #include "..." |
611 | # because s-oscons-tmplt.c requires adaint.h, gsocket.h, and any file included | |
612 | # by these headers. However note that we must use -iquote, not -I, so that | |
613 | # ada/types.h does not conflict with a same-named system header (VxWorks | |
614 | # has a <types.h> header). | |
615 | ||
163fa9a6 | 616 | OSCONS_CPP=$(GCC_FOR_ADA_RTS) $(GNATLIBCFLAGS_FOR_C) -E -C \ |
9467e733 | 617 | -DTARGET=\"$(target_noncanonical)\" -iquote $(fsrcpfx)ada $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i |
163fa9a6 | 618 | OSCONS_EXTRACT=$(GCC_FOR_ADA_RTS) $(GNATLIBCFLAGS_FOR_C) -S s-oscons-tmplt.i |
93a87598 AC |
619 | |
620 | # Note: if you need to build with a non-GNU compiler, you could adapt the | |
621 | # following definitions (written for VMS DEC-C) | |
622 | #OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \ | |
623 | # -DTARGET='""$(target)""' -I$(OSCONS_SRCDIR) s-oscons-tmplt.c | |
624 | # | |
625 | #OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \ | |
626 | # -DTARGET='""$(target)""' -I$(OSCONS_SRCDIR) s-oscons-tmplt.c ; \ | |
627 | # ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \ | |
628 | # ./s-oscons-tmplt.exe > s-oscons-tmplt.s | |
4c166488 EB |
629 | |
630 | ./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb | |
631 | -$(MKDIR) ./bldtools/oscons | |
632 | $(RM) $(addprefix ./bldtools/oscons/,$(notdir $^)) | |
633 | $(CP) $^ ./bldtools/oscons | |
bab1b248 | 634 | (cd ./bldtools/oscons ; $(GNATMAKE_FOR_BUILD) xoscons) |
4c166488 EB |
635 | |
636 | $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons | |
637 | $(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s | |
638 | (cd $(RTSDIR) ; \ | |
639 | $(OSCONS_CPP) ; \ | |
640 | $(OSCONS_EXTRACT) ; \ | |
641 | ../bldtools/oscons/xoscons s-oscons) | |
642 | ||
015bee83 | 643 | gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads |
93a87598 | 644 | test -f $(RTSDIR)/s-oscons.ads || exit 1 |
ce40d1ce | 645 | # C files |
a7dafa20 | 646 | $(MAKE) -C $(RTSDIR) \ |
163fa9a6 | 647 | CC="$(GCC_FOR_ADA_RTS)" \ |
a1ab4c31 AC |
648 | INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \ |
649 | CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \ | |
650 | FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ | |
651 | srcdir=$(fsrcdir) \ | |
cbe91164 | 652 | -f ../Makefile $(LIBGNAT_OBJS) $(EXTRA_ADALIB_OBJS) |
ce40d1ce | 653 | # Ada files |
a7dafa20 | 654 | $(MAKE) -C $(RTSDIR) \ |
163fa9a6 | 655 | CC="$(GCC_FOR_ADA_RTS)" \ |
a1ab4c31 AC |
656 | ADA_INCLUDES="" \ |
657 | CFLAGS="$(GNATLIBCFLAGS)" \ | |
658 | ADAFLAGS="$(GNATLIBFLAGS)" \ | |
659 | FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ | |
660 | srcdir=$(fsrcdir) \ | |
ce40d1ce | 661 | -f ../Makefile $(GNATRTL_OBJS) |
a7dafa20 LG |
662 | $(RM) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnarl$(arext) |
663 | $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat$(arext) \ | |
664 | $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS)) | |
a7dafa20 LG |
665 | $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat$(arext) |
666 | $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl$(arext) \ | |
667 | $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS)) | |
668 | $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl$(arext) | |
a1ab4c31 | 669 | ifeq ($(GMEM_LIB),gmemlib) |
a7dafa20 LG |
670 | $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \ |
671 | $(RTSDIR)/memtrack.o | |
672 | $(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext) | |
a1ab4c31 | 673 | endif |
a7dafa20 LG |
674 | $(CHMOD) a-wx $(RTSDIR)/*.ali |
675 | touch ../stamp-gnatlib-$(RTSDIR) | |
a1ab4c31 AC |
676 | |
677 | # Warning: this target assumes that LIBRARY_VERSION has been set correctly. | |
678 | gnatlib-shared-default: | |
679 | $(MAKE) $(FLAGS_TO_PASS) \ | |
680 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
dee55c12 AC |
681 | GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET) -fno-lto" \ |
682 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-lto" \ | |
a7dafa20 | 683 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 684 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 | 685 | LN_S="$(LN_S)" \ |
a1ab4c31 | 686 | gnatlib |
a7dafa20 | 687 | $(RM) $(RTSDIR)/libgna*$(soext) |
163fa9a6 | 688 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared $(GNATLIBCFLAGS) \ |
e3aa9eba | 689 | $(PICFLAG_FOR_TARGET) \ |
a1ab4c31 AC |
690 | -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
691 | $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ | |
692 | $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
693 | $(MISCLIB) -lm | |
163fa9a6 | 694 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared $(GNATLIBCFLAGS) \ |
e3aa9eba | 695 | $(PICFLAG_FOR_TARGET) \ |
a1ab4c31 AC |
696 | -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
697 | $(GNATRTL_TASKING_OBJS) \ | |
698 | $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
699 | $(THREADSLIB) | |
a7dafa20 | 700 | cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
a1ab4c31 | 701 | libgnat$(soext) |
a7dafa20 | 702 | cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
a1ab4c31 AC |
703 | libgnarl$(soext) |
704 | ||
cbe91164 AC |
705 | # Create static libgnat and libgnarl compiled with -fPIC |
706 | $(RM) $(RTSDIR)/libgnat_pic$(arext) $(RTSDIR)/libgnarl_pic$(arext) | |
707 | $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnat_pic$(arext) \ | |
708 | $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS)) | |
709 | $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnat_pic$(arext) | |
710 | $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgnarl_pic$(arext) \ | |
711 | $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS)) | |
712 | $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl_pic$(arext) | |
713 | ||
a1ab4c31 AC |
714 | gnatlib-shared-dual: |
715 | $(MAKE) $(FLAGS_TO_PASS) \ | |
716 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
717 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
2f18d9af | 718 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ |
3b31a906 | 719 | PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ |
a7dafa20 | 720 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 721 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 | 722 | LN_S="$(LN_S)" \ |
a1ab4c31 | 723 | gnatlib-shared-default |
a7dafa20 | 724 | $(MV) $(RTSDIR)/libgna*$(soext) . |
cbe91164 AC |
725 | $(MV) $(RTSDIR)/libgnat_pic$(arext) . |
726 | $(MV) $(RTSDIR)/libgnarl_pic$(arext) . | |
a7dafa20 | 727 | $(RM) ../stamp-gnatlib2-$(RTSDIR) |
a1ab4c31 AC |
728 | $(MAKE) $(FLAGS_TO_PASS) \ |
729 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
730 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
2f18d9af | 731 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ |
a7dafa20 | 732 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 733 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 AC |
734 | LN_S="$(LN_S)" \ |
735 | gnatlib | |
a7dafa20 | 736 | $(MV) libgna*$(soext) $(RTSDIR) |
cbe91164 AC |
737 | $(MV) libgnat_pic$(arext) $(RTSDIR) |
738 | $(MV) libgnarl_pic$(arext) $(RTSDIR) | |
a1ab4c31 | 739 | |
7bec4570 EB |
740 | # Remove all the object files. They cannot be reused because they have |
741 | # been generated for the static library and the shared library will be | |
742 | # the first to be rebuilt. Moreover, this will prevent gnatmake to pick | |
743 | # them instead of the prescribed version of the library when the tools | |
744 | # are built for a native compiler. | |
745 | $(RM) $(addprefix $(RTSDIR)/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS)) | |
746 | $(RM) $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS)) | |
747 | ||
a1ab4c31 AC |
748 | gnatlib-shared-dual-win32: |
749 | $(MAKE) $(FLAGS_TO_PASS) \ | |
750 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
f35aed49 | 751 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ |
2f18d9af | 752 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ |
f35aed49 | 753 | PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ |
a7dafa20 | 754 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 755 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 AC |
756 | LN_S="$(LN_S)" \ |
757 | gnatlib-shared-win32 | |
a7dafa20 LG |
758 | $(MV) $(RTSDIR)/libgna*$(soext) . |
759 | $(RM) ../stamp-gnatlib2-$(RTSDIR) | |
a1ab4c31 AC |
760 | $(MAKE) $(FLAGS_TO_PASS) \ |
761 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
762 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
2f18d9af | 763 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ |
a7dafa20 | 764 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 765 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 AC |
766 | LN_S="$(LN_S)" \ |
767 | gnatlib | |
a7dafa20 | 768 | $(MV) libgna*$(soext) $(RTSDIR) |
a1ab4c31 AC |
769 | |
770 | # ??? we need to add the option to support auto-import of arrays/records to | |
771 | # the GNATLIBFLAGS when this will be supported by GNAT. At this point we will | |
772 | # use the gnatlib-shared-dual-win32 target to build the GNAT runtimes on | |
773 | # Windows. | |
774 | gnatlib-shared-win32: | |
775 | $(MAKE) $(FLAGS_TO_PASS) \ | |
776 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
e3aa9eba | 777 | GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \ |
f35aed49 | 778 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \ |
a7dafa20 | 779 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 780 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 AC |
781 | LN_S="$(LN_S)" \ |
782 | gnatlib | |
a7dafa20 | 783 | $(RM) $(RTSDIR)/libgna*$(soext) |
cbe91164 AC |
784 | $(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext) |
785 | $(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext) | |
163fa9a6 | 786 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared -shared-libgcc \ |
e3aa9eba | 787 | $(PICFLAG_FOR_TARGET) \ |
69416e98 | 788 | -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
a1ab4c31 | 789 | $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ |
69416e98 | 790 | $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB) |
163fa9a6 | 791 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared -shared-libgcc \ |
e3aa9eba | 792 | $(PICFLAG_FOR_TARGET) \ |
69416e98 | 793 | -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
a1ab4c31 | 794 | $(GNATRTL_TASKING_OBJS) \ |
69416e98 AC |
795 | $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
796 | $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) | |
a1ab4c31 AC |
797 | |
798 | gnatlib-shared-darwin: | |
799 | $(MAKE) $(FLAGS_TO_PASS) \ | |
800 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
e3aa9eba | 801 | GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \ |
f35aed49 | 802 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-common" \ |
a7dafa20 | 803 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 804 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 | 805 | LN_S="$(LN_S)" \ |
a1ab4c31 | 806 | gnatlib |
a7dafa20 | 807 | $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext) |
4e41b0e6 AC |
808 | $(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext) |
809 | $(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext) | |
163fa9a6 | 810 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \ |
a1ab4c31 AC |
811 | -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
812 | $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ | |
813 | $(SO_OPTS) \ | |
5c6a4559 | 814 | -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
6a6d3817 IS |
815 | -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \ |
816 | -Wl,-rpath,@loader_path/../../../../ $(MISCLIB) | |
163fa9a6 | 817 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \ |
a1ab4c31 AC |
818 | -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
819 | $(GNATRTL_TASKING_OBJS) \ | |
820 | $(SO_OPTS) \ | |
5c6a4559 | 821 | -Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
6a6d3817 IS |
822 | -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \ |
823 | -Wl,-rpath,@loader_path/../../../../ \ | |
a1ab4c31 | 824 | $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) |
a7dafa20 | 825 | cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
a1ab4c31 | 826 | libgnat$(soext) |
a7dafa20 | 827 | cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ |
a1ab4c31 | 828 | libgnarl$(soext) |
b7f01478 IS |
829 | cd $(RTSDIR); $(DSYMUTIL_FOR_TARGET) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) |
830 | cd $(RTSDIR); $(DSYMUTIL_FOR_TARGET) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) | |
a1ab4c31 | 831 | |
a1ab4c31 AC |
832 | gnatlib-shared: |
833 | $(MAKE) $(FLAGS_TO_PASS) \ | |
834 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
835 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
2f18d9af | 836 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ |
a7dafa20 | 837 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 838 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 | 839 | LN_S="$(LN_S)" \ |
e3aa9eba | 840 | PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ |
07c6ed01 | 841 | $(GNATLIB_SHARED) |
a1ab4c31 | 842 | |
a1ab4c31 | 843 | gnatlib-zcx: |
3b31a906 EB |
844 | $(MAKE) $(FLAGS_TO_PASS) \ |
845 | EH_MECHANISM="-gcc" \ | |
846 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
847 | THREAD_KIND="$(THREAD_KIND)" \ | |
07c6ed01 | 848 | LN_S="$(LN_S)" \ |
3b31a906 | 849 | ../stamp-gnatlib1-$(RTSDIR) |
0ab0bf95 | 850 | sed \ |
0ab0bf95 OH |
851 | -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' \ |
852 | $(RTSDIR)/system.ads > $(RTSDIR)/s.ads | |
a7dafa20 | 853 | $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads |
a1ab4c31 AC |
854 | $(MAKE) $(FLAGS_TO_PASS) \ |
855 | EH_MECHANISM="-gcc" \ | |
856 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
857 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
2f18d9af | 858 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ |
f45ccc7c | 859 | FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ |
a7dafa20 | 860 | MULTISUBDIR="$(MULTISUBDIR)" \ |
a1ab4c31 | 861 | THREAD_KIND="$(THREAD_KIND)" \ |
07c6ed01 | 862 | LN_S="$(LN_S)" \ |
3b31a906 | 863 | gnatlib |
a1ab4c31 | 864 | |
a1ab4c31 AC |
865 | # Compiling object files from source files. |
866 | ||
867 | # Note that dependencies on obstack.h are not written | |
868 | # because that file is not part of GCC. | |
869 | # Dependencies on gvarargs.h are not written | |
870 | # because all that file does, when not compiling with GCC, | |
871 | # is include the system varargs.h. | |
872 | ||
8ad150f6 TG |
873 | b_gnatl.adb : $(GNATLINK_OBJS) |
874 | $(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali | |
a1ab4c31 | 875 | |
8ad150f6 | 876 | b_gnatl.o : b_gnatl.adb |
7bec4570 | 877 | $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN $< $(OUTPUT_OPTION) |
8ad150f6 TG |
878 | |
879 | b_gnatm.adb : $(GNATMAKE_OBJS) | |
880 | $(GNATBIND) $(ADA_INCLUDES) -o b_gnatm.adb gnatmake.ali | |
881 | ||
882 | b_gnatm.o : b_gnatm.adb | |
7bec4570 | 883 | $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN $< $(OUTPUT_OPTION) |
a1ab4c31 | 884 | |
5cb34da7 MR |
885 | # Provide a `toolexeclibdir' definition for when `gnat-install-lib' is |
886 | # wired through gcc/ in a configuration with top-level libada disabled. | |
887 | # It will be overridden with the value configured when `gnat-install-lib' | |
888 | # is invoked through libada/. | |
889 | toolexeclibdir = $(ADA_RTL_OBJ_DIR) | |
890 | ||
a1ab4c31 AC |
891 | ADA_INCLUDE_DIR = $(libsubdir)/adainclude |
892 | ADA_RTL_OBJ_DIR = $(libsubdir)/adalib | |
13681906 | 893 | ADA_RTL_DSO_DIR = $(toolexeclibdir) |
a1ab4c31 | 894 | |
e1876cac EB |
895 | # Special flags |
896 | ||
854c00dd | 897 | # need to keep the frame pointer in tracebak.o to pop the stack properly on |
e1876cac | 898 | # some targets. |
854c00dd | 899 | |
903e8465 | 900 | tracebak.o : tracebak.c |
7bec4570 | 901 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \ |
854c00dd | 902 | $(INCLUDES) $(NO_OMIT_ADAFLAGS) $< $(OUTPUT_OPTION) |
e1876cac | 903 | |
903e8465 ML |
904 | adadecode.o : adadecode.c adadecode.h |
905 | aux-io.o : aux-io.c | |
906 | argv.o : argv.c | |
a1ab4c31 AC |
907 | cal.o : cal.c |
908 | deftarg.o : deftarg.c | |
909 | errno.o : errno.c | |
903e8465 ML |
910 | exit.o : adaint.h exit.c |
911 | expect.o : expect.c | |
912 | final.o : final.c | |
913 | rtfinal.o : rtfinal.c | |
914 | rtinit.o : rtinit.c | |
915 | locales.o : locales.c | |
916 | mkdir.o : mkdir.c | |
917 | socket.o : socket.c gsocket.h | |
a1ab4c31 | 918 | sysdep.o : sysdep.c |
903e8465 ML |
919 | raise.o : raise.c raise.h |
920 | sigtramp-armdroid.o : sigtramp-armdroid.c sigtramp.h | |
cbe91164 | 921 | sigtramp-armvxworks.o : sigtramp-armvxworks.c sigtramp.h |
903e8465 ML |
922 | sigtramp-ios.o : sigtramp-ios.c sigtramp.h |
923 | sigtramp-vxworks.o : sigtramp-vxworks.c $(VX_SIGTRAMP_EXTRA_SRCS) | |
cbe91164 | 924 | sigtramp-vxworks-vxsim.o : sigtramp-vxworks-vxsim.c $(VX_SIGTRAMP_EXTRA_SRCS) |
95160516 | 925 | terminals.o : terminals.c |
903e8465 | 926 | vx_stack_info.o : vx_stack_info.c |
a1ab4c31 | 927 | |
e1876cac | 928 | raise-gcc.o : raise-gcc.c raise.h |
7bec4570 | 929 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
322cb62a | 930 | -iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \ |
e1876cac EB |
931 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) |
932 | ||
903e8465 | 933 | cio.o : cio.c |
7bec4570 | 934 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
d88a51b1 | 935 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) |
a1ab4c31 | 936 | |
903e8465 | 937 | init.o : init.c adaint.h raise.h |
7bec4570 | 938 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
d88a51b1 | 939 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) |
a1ab4c31 | 940 | |
04b32ed7 | 941 | init-vxsim.o : init-vxsim.c |
7bec4570 | 942 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
04b32ed7 AC |
943 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) |
944 | ||
903e8465 | 945 | initialize.o : initialize.c raise.h |
7bec4570 | 946 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
d88a51b1 | 947 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) |
a1ab4c31 | 948 | |
903e8465 | 949 | link.o : link.c |
7bec4570 | 950 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
a1ab4c31 AC |
951 | $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \ |
952 | $< $(OUTPUT_OPTION) | |
953 | ||
e1876cac | 954 | targext.o : targext.c |
7bec4570 | 955 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ |
e1876cac EB |
956 | -iquote $(srcdir) \ |
957 | $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \ | |
958 | $< $(OUTPUT_OPTION) | |
a1ab4c31 AC |
959 | |
960 | # In GNU Make, ignore whether `stage*' exists. | |
961 | .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap | |
962 | .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 | |
963 | ||
964 | force: |