]>
Commit | Line | Data |
---|---|---|
1 | # Makefile for GNU Ada Compiler (GNAT). | |
2 | # Copyright (C) 1994-2025 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 | |
69 | CFLAGS = -g | |
70 | BOOT_CFLAGS = -O $(CFLAGS) | |
71 | # These exists to be overridden by the t-* files, respectively. | |
72 | T_CFLAGS = | |
73 | ||
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@ | |
93 | AWK = @AWK@ | |
94 | ||
95 | # Should we build position-independent host code? | |
96 | enable_host_pie = @enable_host_pie@ | |
97 | PICFLAG = @PICFLAG@ | |
98 | LD_PICFLAG = @LD_PICFLAG@ | |
99 | ||
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 | |
107 | ||
108 | GNATMAKE_FOR_BUILD = gnatmake | |
109 | GNATBIND_FLAGS = -static -x | |
110 | ADA_CFLAGS = | |
111 | ADAFLAGS = -W -Wall -gnatpg -gnata -gnatU | |
112 | FORCE_DEBUG_ADAFLAGS = -g | |
113 | NO_INLINE_ADAFLAGS = -fno-inline | |
114 | NO_OMIT_ADAFLAGS = -fno-omit-frame-pointer | |
115 | NO_SIBLING_ADAFLAGS = -fno-optimize-sibling-calls | |
116 | NO_REORDER_ADAFLAGS = -fno-toplevel-reorder | |
117 | GNATLIBFLAGS = -W -Wall -gnatg -nostdinc | |
118 | GNATLIBCFLAGS = -g -O2 | |
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. | |
122 | GNATLIBCFLAGS_FOR_C = \ | |
123 | -W -Wall $(GNATLIBCFLAGS) -fexceptions -DIN_RTS -DHAVE_GETIPINFO | |
124 | PICFLAG_FOR_TARGET = @PICFLAG_FOR_TARGET@ | |
125 | THREAD_KIND = native | |
126 | THREADSLIB = | |
127 | GMEM_LIB = | |
128 | MISCLIB = | |
129 | OUTPUT_OPTION = -o $@ | |
130 | ||
131 | objext = .o | |
132 | exeext = | |
133 | arext = .a | |
134 | soext = .so | |
135 | shext = | |
136 | hyphen = - | |
137 | ||
138 | # program_transform_name and objdir are set by configure.ac. | |
139 | program_transform_name = | |
140 | objdir = . | |
141 | ||
142 | target_alias=@target_alias@ | |
143 | target=@target@ | |
144 | target_noncanonical=@target_noncanonical@ | |
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@ | |
151 | target_cpu_default = @target_cpu_default@ | |
152 | xmake_file = @xmake_file@ | |
153 | #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c` | |
154 | #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` | |
155 | ||
156 | # Directory where sources are, from where we are. | |
157 | VPATH = $(srcdir)/ada | |
158 | ||
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 | ||
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 | ||
178 | # Character encoding conversion library. | |
179 | LIBICONV = @LIBICONV@ | |
180 | LIBICONV_DEP = @LIBICONV_DEP@ | |
181 | ||
182 | # Any system libraries needed just for GNAT. | |
183 | SYSLIBS = @GNAT_LIBEXC@ | |
184 | ||
185 | # List extra gnattools | |
186 | EXTRA_GNATTOOLS = | |
187 | ||
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 | ||
194 | # main GNAT source directory | |
195 | GNAT_SRC=$(fsrcpfx)ada | |
196 | ||
197 | # Multilib handling | |
198 | MULTISUBDIR = | |
199 | RTSDIR = rts$(subst /,_,$(MULTISUBDIR)) | |
200 | ||
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). | |
204 | GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc | |
205 | ||
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 | ||
213 | # host overrides | |
214 | ifneq ($(xmake_file),) | |
215 | include $(xmake_file) | |
216 | endif | |
217 | ||
218 | # Now figure out from those variables how to compile and link. | |
219 | ||
220 | all.indirect: Makefile ../gnat1$(exeext) | |
221 | ||
222 | # IN_GCC is meant to distinguish between code compiled into GCC itself, i.e. | |
223 | # for the host, and the rest. But we also use it for the tools (link.c) and | |
224 | # even break the host/target wall by using it for the library (targext.c). | |
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. | |
230 | ALL_CFLAGS = $(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) | |
231 | ||
232 | # Likewise. | |
233 | ALL_CPPFLAGS = $(CPPFLAGS) | |
234 | ||
235 | ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) | |
236 | ||
237 | ifneq ($(enable_host_pie),) | |
238 | LIBIBERTY = ../../libiberty/pic/libiberty.a | |
239 | else | |
240 | LIBIBERTY = ../../libiberty/libiberty.a | |
241 | endif | |
242 | ||
243 | # We need to link against libbacktrace because diagnostic.c in | |
244 | # libcommon.a uses it. | |
245 | LIBBACKTRACE = ../../libbacktrace/.libs/libbacktrace.a | |
246 | ||
247 | # How to link with both our special library facilities | |
248 | # and the system's installed libraries. | |
249 | LIBS = $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) $(LIBIBERTY) $(SYSLIBS) | |
250 | LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBBACKTRACE) $(LIBIBERTY) | |
251 | # Default is no TGT_LIB; one might be passed down or something | |
252 | TGT_LIB = | |
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) | |
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. | |
262 | INCLUDES = -iquote . -iquote .. -iquote $(srcdir)/ada -iquote $(srcdir) \ | |
263 | -I $(ftop_srcdir)/include $(GMPINC) | |
264 | ||
265 | ADA_INCLUDES = -I- -I. -I$(srcdir)/ada | |
266 | ||
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. | |
270 | ifneq ($(findstring vxworks,$(target_os)),) | |
271 | INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ | |
272 | -iquote $(fsrcdir)/ada \ | |
273 | -I$(ftop_srcdir)/include $(GMPINC) | |
274 | else | |
275 | INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ | |
276 | -iquote $(fsrcdir)/ada -iquote $(fsrcdir) \ | |
277 | -I$(ftop_srcdir)/include $(GMPINC) | |
278 | endif | |
279 | ||
280 | ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada | |
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: | |
293 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) | |
294 | ||
295 | .adb.o: | |
296 | $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION) | |
297 | ||
298 | .ads.o: | |
299 | $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION) | |
300 | ||
301 | # how to regenerate this file | |
302 | Makefile: ../config.status $(srcdir)/ada/gcc-interface/Makefile.in $(srcdir)/ada/Makefile.in $(srcdir)/ada/version.c | |
303 | cd ..; \ | |
304 | LANGUAGES="$(CONFIG_LANGUAGES)" \ | |
305 | CONFIG_HEADERS= \ | |
306 | CONFIG_FILES="ada/gcc-interface/Makefile ada/Makefile" $(SHELL) config.status | |
307 | ||
308 | # This tells GNU make version 3 not to export all the variables | |
309 | # defined in this file into the environment. | |
310 | .NOEXPORT: | |
311 | ||
312 | # Lists of files for various purposes. | |
313 | ||
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 \ | |
318 | sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o \ | |
319 | types.o validsw.o widechar.o | |
320 | ||
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 \ | |
323 | erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \ | |
324 | gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \ | |
325 | make.o makeusg.o make_util.o namet.o nlists.o opt.o osint.o osint-m.o \ | |
326 | output.o restrict.o rident.o s-exctab.o s-cautns.o \ | |
327 | s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \ | |
328 | s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \ | |
329 | snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \ | |
330 | switch.o switch-m.o table.o targparm.o tempdir.o types.o uintp.o \ | |
331 | uname.o urealp.o usage.o widechar.o warnsw.o \ | |
332 | seinfo.o einfo-entities.o einfo-utils.o sinfo-nodes.o sinfo-utils.o \ | |
333 | errid.o \ | |
334 | errsw.o \ | |
335 | erroutc-pretty_emitter.o \ | |
336 | erroutc-sarif_emitter.o \ | |
337 | json_utils.o | |
338 | $(EXTRA_GNATMAKE_OBJS) | |
339 | ||
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 | ||
344 | ifeq ($(strip $(filter-out x86_64, $(target_cpu))),) | |
345 | ifeq ($(strip $(MULTISUBDIR)),/32) | |
346 | target_cpu:=i686 | |
347 | else | |
348 | ifeq ($(strip $(MULTISUBDIR)),/x32) | |
349 | target_cpu:=x32 | |
350 | endif | |
351 | endif | |
352 | endif | |
353 | ||
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 | ||
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 | ||
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 | ||
374 | include $(fsrcdir)/ada/Makefile.rtl | |
375 | ||
376 | ifneq ($(enable_host_pie),) | |
377 | LIBGNAT=../$(RTSDIR)/libgnat_pic.a | |
378 | else | |
379 | LIBGNAT=../$(RTSDIR)/libgnat.a | |
380 | endif | |
381 | ||
382 | TOOLS_FLAGS_TO_PASS= \ | |
383 | "CC=$(CC)" \ | |
384 | "CFLAGS=$(CFLAGS) $(PICFLAG)" \ | |
385 | "LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ | |
386 | "ADAFLAGS=$(ADAFLAGS)" \ | |
387 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ | |
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 | ||
399 | GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(LDFLAGS) | |
400 | ||
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 | |
408 | ||
409 | ../stamp-tools: | |
410 | -$(RM) tools/* | |
411 | -$(RMDIR) tools | |
412 | -$(MKDIR) tools | |
413 | -(cd tools; $(foreach FILE,$(GENERATED_FILES_FOR_TOOLS), \ | |
414 | $(LN_S) ../$(FILE) $(FILE);)) | |
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)));) | |
419 | touch ../stamp-tools | |
420 | ||
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) | |
424 | vpath %.ads ../$(RTSDIR) ../ | |
425 | vpath %.adb ../$(RTSDIR) ../ | |
426 | vpath %.c ../$(RTSDIR) ../ | |
427 | vpath %.h ../$(RTSDIR) ../ | |
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 | ||
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 | ||
462 | common-tools: ../stamp-tools | |
463 | $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ | |
464 | --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \ | |
465 | gnatchop gnatcmd gnatkr gnatls gnatprep gnatname \ | |
466 | gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS) | |
467 | $(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \ | |
468 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
469 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
470 | $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \ | |
471 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
472 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
473 | $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \ | |
474 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
475 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
476 | $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \ | |
477 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
478 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
479 | $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \ | |
480 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
481 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
482 | $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \ | |
483 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
484 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
485 | $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \ | |
486 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
487 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
488 | ||
489 | ../../gnatdll$(exeext): ../stamp-tools | |
490 | $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)" | |
491 | $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll | |
492 | $(GNATLINK) -v gnatdll -o $@ \ | |
493 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
494 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
495 | ||
496 | gnatmake-re: ../stamp-tools | |
497 | $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(ALL_ADAFLAGS)" | |
498 | $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)" | |
499 | $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake | |
500 | $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \ | |
501 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
502 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
503 | ||
504 | # Note the use of the "mv" command in order to allow gnatlink to be linked | |
505 | # with the former version of gnatlink itself which cannot override itself. | |
506 | # gnatlink-re cannot be run at the same time as gnatmake-re, hence the | |
507 | # dependency | |
508 | gnatlink-re: ../stamp-tools gnatmake-re | |
509 | $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)" | |
510 | $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink | |
511 | $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ | |
512 | --GCC="$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ADA_INCLUDES)" \ | |
513 | --LINK="$(GCC_LINK)" $(TOOLS_LIBS) | |
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 | |
521 | ../../gnatmake$(exeext): b_gnatm.o $(GNATMAKE_OBJS) | |
522 | +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS) | |
523 | ||
524 | ../../gnatlink$(exeext): b_gnatl.o $(GNATLINK_OBJS) | |
525 | +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS) | |
526 | ||
527 | ../stamp-gnatlib-$(RTSDIR): | |
528 | @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \ | |
529 | then \ | |
530 | $(ECHO) You must first build the GNAT library: make gnatlib; \ | |
531 | false; \ | |
532 | else \ | |
533 | true; \ | |
534 | fi | |
535 | ||
536 | install-gcc-specs: | |
537 | # Install all the requested GCC spec files. | |
538 | ||
539 | $(foreach f,$(GCC_SPEC_FILES), \ | |
540 | $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) $(DESTDIR)$(libsubdir)/;) | |
541 | ||
542 | install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs | |
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) | |
547 | for file in $(RTSDIR)/*.ali; do \ | |
548 | $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ | |
549 | done | |
550 | $(INSTALL_DATA_DATE) $(RTSDIR)/ada_target_properties \ | |
551 | $(DESTDIR)$(ADA_RTL_OBJ_DIR)/../ | |
552 | -cd $(RTSDIR); for file in *$(arext);do \ | |
553 | $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ | |
554 | $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \ | |
555 | done | |
556 | -$(foreach file, $(EXTRA_ADALIB_OBJS), \ | |
557 | $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \ | |
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. | |
563 | # Also install the .dSYM directories if they exist (these directories | |
564 | # contain the debug information for the shared libraries on darwin) | |
565 | for file in gnat gnarl; do \ | |
566 | if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \ | |
567 | $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
568 | $(DESTDIR)$(ADA_RTL_DSO_DIR); \ | |
569 | fi; \ | |
570 | if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \ | |
571 | $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
572 | $(DESTDIR)$(ADA_RTL_DSO_DIR)/lib$${file}$(soext); \ | |
573 | fi; \ | |
574 | if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \ | |
575 | $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \ | |
576 | $(DESTDIR)$(ADA_RTL_DSO_DIR); \ | |
577 | fi; \ | |
578 | done | |
579 | # This copy must be done preserving the date on the original file. | |
580 | for file in $(RTSDIR)/*.ad[sb]*; do \ | |
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 | ||
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) | |
597 | ||
598 | ../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR) | |
599 | $(MAKE) MULTISUBDIR="$(MULTISUBDIR)" THREAD_KIND="$(THREAD_KIND)" LN_S="$(LN_S)" setup-rts | |
600 | # Copy tsystem.h | |
601 | $(CP) $(srcdir)/tsystem.h $(RTSDIR) | |
602 | $(RM) ../stamp-gnatlib-$(RTSDIR) | |
603 | touch ../stamp-gnatlib1-$(RTSDIR) | |
604 | ||
605 | # GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust | |
606 | # for running it from ada/rts. | |
607 | ||
608 | GCC_FOR_ADA_RTS=$(subst ./xgcc,../../xgcc,$(subst -B./, -B../../,$(GCC_FOR_TARGET))) | |
609 | ||
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 | ||
616 | OSCONS_CPP=$(GCC_FOR_ADA_RTS) $(GNATLIBCFLAGS_FOR_C) -E -C \ | |
617 | -DTARGET=\"$(target_noncanonical)\" -iquote $(fsrcpfx)ada $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i | |
618 | OSCONS_EXTRACT=$(GCC_FOR_ADA_RTS) $(GNATLIBCFLAGS_FOR_C) -S s-oscons-tmplt.i | |
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 | |
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 | |
634 | (cd ./bldtools/oscons ; $(GNATMAKE_FOR_BUILD) xoscons) | |
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 | ||
643 | gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads | |
644 | test -f $(RTSDIR)/s-oscons.ads || exit 1 | |
645 | # C files | |
646 | $(MAKE) -C $(RTSDIR) \ | |
647 | CC="$(GCC_FOR_ADA_RTS)" \ | |
648 | INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \ | |
649 | CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \ | |
650 | FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ | |
651 | srcdir=$(fsrcdir) \ | |
652 | -f ../Makefile $(LIBGNAT_OBJS) $(EXTRA_ADALIB_OBJS) | |
653 | # Ada files | |
654 | $(MAKE) -C $(RTSDIR) \ | |
655 | CC="$(GCC_FOR_ADA_RTS)" \ | |
656 | ADA_INCLUDES="" \ | |
657 | CFLAGS="$(GNATLIBCFLAGS)" \ | |
658 | ADAFLAGS="$(GNATLIBFLAGS)" \ | |
659 | FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ | |
660 | srcdir=$(fsrcdir) \ | |
661 | -f ../Makefile $(GNATRTL_OBJS) | |
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)) | |
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) | |
669 | ifeq ($(GMEM_LIB),gmemlib) | |
670 | $(AR_FOR_TARGET) $(AR_FLAGS) $(RTSDIR)/libgmem$(arext) \ | |
671 | $(RTSDIR)/memtrack.o | |
672 | $(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext) | |
673 | endif | |
674 | $(CHMOD) a-wx $(RTSDIR)/*.ali | |
675 | touch ../stamp-gnatlib-$(RTSDIR) | |
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)" \ | |
681 | GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET) -fno-lto" \ | |
682 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-lto" \ | |
683 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
684 | THREAD_KIND="$(THREAD_KIND)" \ | |
685 | LN_S="$(LN_S)" \ | |
686 | gnatlib | |
687 | $(RM) $(RTSDIR)/libgna*$(soext) | |
688 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared $(GNATLIBCFLAGS) \ | |
689 | $(PICFLAG_FOR_TARGET) \ | |
690 | -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
691 | $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ | |
692 | $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
693 | $(MISCLIB) -lm | |
694 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared $(GNATLIBCFLAGS) \ | |
695 | $(PICFLAG_FOR_TARGET) \ | |
696 | -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
697 | $(GNATRTL_TASKING_OBJS) \ | |
698 | $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
699 | $(THREADSLIB) | |
700 | cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
701 | libgnat$(soext) | |
702 | cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
703 | libgnarl$(soext) | |
704 | ||
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 | ||
714 | gnatlib-shared-dual: | |
715 | $(MAKE) $(FLAGS_TO_PASS) \ | |
716 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
717 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
718 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ | |
719 | PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ | |
720 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
721 | THREAD_KIND="$(THREAD_KIND)" \ | |
722 | LN_S="$(LN_S)" \ | |
723 | gnatlib-shared-default | |
724 | $(MV) $(RTSDIR)/libgna*$(soext) . | |
725 | $(MV) $(RTSDIR)/libgnat_pic$(arext) . | |
726 | $(MV) $(RTSDIR)/libgnarl_pic$(arext) . | |
727 | $(RM) ../stamp-gnatlib2-$(RTSDIR) | |
728 | $(MAKE) $(FLAGS_TO_PASS) \ | |
729 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
730 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
731 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ | |
732 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
733 | THREAD_KIND="$(THREAD_KIND)" \ | |
734 | LN_S="$(LN_S)" \ | |
735 | gnatlib | |
736 | $(MV) libgna*$(soext) $(RTSDIR) | |
737 | $(MV) libgnat_pic$(arext) $(RTSDIR) | |
738 | $(MV) libgnarl_pic$(arext) $(RTSDIR) | |
739 | ||
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 | ||
748 | gnatlib-shared-dual-win32: | |
749 | $(MAKE) $(FLAGS_TO_PASS) \ | |
750 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
751 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
752 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ | |
753 | PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ | |
754 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
755 | THREAD_KIND="$(THREAD_KIND)" \ | |
756 | LN_S="$(LN_S)" \ | |
757 | gnatlib-shared-win32 | |
758 | $(MV) $(RTSDIR)/libgna*$(soext) . | |
759 | $(RM) ../stamp-gnatlib2-$(RTSDIR) | |
760 | $(MAKE) $(FLAGS_TO_PASS) \ | |
761 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
762 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
763 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ | |
764 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
765 | THREAD_KIND="$(THREAD_KIND)" \ | |
766 | LN_S="$(LN_S)" \ | |
767 | gnatlib | |
768 | $(MV) libgna*$(soext) $(RTSDIR) | |
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)" \ | |
777 | GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \ | |
778 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \ | |
779 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
780 | THREAD_KIND="$(THREAD_KIND)" \ | |
781 | LN_S="$(LN_S)" \ | |
782 | gnatlib | |
783 | $(RM) $(RTSDIR)/libgna*$(soext) | |
784 | $(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext) | |
785 | $(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext) | |
786 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared -shared-libgcc \ | |
787 | $(PICFLAG_FOR_TARGET) \ | |
788 | -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
789 | $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ | |
790 | $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB) | |
791 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -shared -shared-libgcc \ | |
792 | $(PICFLAG_FOR_TARGET) \ | |
793 | -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
794 | $(GNATRTL_TASKING_OBJS) \ | |
795 | $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
796 | $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) | |
797 | ||
798 | gnatlib-shared-darwin: | |
799 | $(MAKE) $(FLAGS_TO_PASS) \ | |
800 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
801 | GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \ | |
802 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-common" \ | |
803 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
804 | THREAD_KIND="$(THREAD_KIND)" \ | |
805 | LN_S="$(LN_S)" \ | |
806 | gnatlib | |
807 | $(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext) | |
808 | $(CP) $(RTSDIR)/libgnat$(arext) $(RTSDIR)/libgnat_pic$(arext) | |
809 | $(CP) $(RTSDIR)/libgnarl$(arext) $(RTSDIR)/libgnarl_pic$(arext) | |
810 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \ | |
811 | -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
812 | $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ | |
813 | $(SO_OPTS) \ | |
814 | -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
815 | -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \ | |
816 | -Wl,-rpath,@loader_path/../../../../ $(MISCLIB) | |
817 | cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \ | |
818 | -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
819 | $(GNATRTL_TASKING_OBJS) \ | |
820 | $(SO_OPTS) \ | |
821 | -Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
822 | -nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \ | |
823 | -Wl,-rpath,@loader_path/../../../../ \ | |
824 | $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) | |
825 | cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
826 | libgnat$(soext) | |
827 | cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ | |
828 | libgnarl$(soext) | |
829 | cd $(RTSDIR); $(DSYMUTIL_FOR_TARGET) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) | |
830 | cd $(RTSDIR); $(DSYMUTIL_FOR_TARGET) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) | |
831 | ||
832 | gnatlib-shared: | |
833 | $(MAKE) $(FLAGS_TO_PASS) \ | |
834 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
835 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
836 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ | |
837 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
838 | THREAD_KIND="$(THREAD_KIND)" \ | |
839 | LN_S="$(LN_S)" \ | |
840 | PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ | |
841 | $(GNATLIB_SHARED) | |
842 | ||
843 | gnatlib-zcx: | |
844 | $(MAKE) $(FLAGS_TO_PASS) \ | |
845 | EH_MECHANISM="-gcc" \ | |
846 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
847 | THREAD_KIND="$(THREAD_KIND)" \ | |
848 | LN_S="$(LN_S)" \ | |
849 | ../stamp-gnatlib1-$(RTSDIR) | |
850 | sed \ | |
851 | -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' \ | |
852 | $(RTSDIR)/system.ads > $(RTSDIR)/s.ads | |
853 | $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads | |
854 | $(MAKE) $(FLAGS_TO_PASS) \ | |
855 | EH_MECHANISM="-gcc" \ | |
856 | GNATLIBFLAGS="$(GNATLIBFLAGS)" \ | |
857 | GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ | |
858 | GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ | |
859 | FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \ | |
860 | MULTISUBDIR="$(MULTISUBDIR)" \ | |
861 | THREAD_KIND="$(THREAD_KIND)" \ | |
862 | LN_S="$(LN_S)" \ | |
863 | gnatlib | |
864 | ||
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 | ||
873 | b_gnatl.adb : $(GNATLINK_OBJS) | |
874 | $(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali | |
875 | ||
876 | b_gnatl.o : b_gnatl.adb | |
877 | $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN $< $(OUTPUT_OPTION) | |
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 | |
883 | $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN $< $(OUTPUT_OPTION) | |
884 | ||
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 | ||
891 | ADA_INCLUDE_DIR = $(libsubdir)/adainclude | |
892 | ADA_RTL_OBJ_DIR = $(libsubdir)/adalib | |
893 | ADA_RTL_DSO_DIR = $(toolexeclibdir) | |
894 | ||
895 | # Special flags | |
896 | ||
897 | # need to keep the frame pointer in tracebak.o to pop the stack properly on | |
898 | # some targets. | |
899 | ||
900 | tracebak.o : tracebak.c | |
901 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \ | |
902 | $(INCLUDES) $(NO_OMIT_ADAFLAGS) $< $(OUTPUT_OPTION) | |
903 | ||
904 | adadecode.o : adadecode.c adadecode.h | |
905 | aux-io.o : aux-io.c | |
906 | argv.o : argv.c | |
907 | cal.o : cal.c | |
908 | deftarg.o : deftarg.c | |
909 | errno.o : errno.c | |
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 | |
918 | sysdep.o : sysdep.c | |
919 | raise.o : raise.c raise.h | |
920 | sigtramp-armdroid.o : sigtramp-armdroid.c sigtramp.h | |
921 | sigtramp-armvxworks.o : sigtramp-armvxworks.c sigtramp.h | |
922 | sigtramp-ios.o : sigtramp-ios.c sigtramp.h | |
923 | sigtramp-vxworks.o : sigtramp-vxworks.c $(VX_SIGTRAMP_EXTRA_SRCS) | |
924 | sigtramp-vxworks-vxsim.o : sigtramp-vxworks-vxsim.c $(VX_SIGTRAMP_EXTRA_SRCS) | |
925 | terminals.o : terminals.c | |
926 | vx_stack_info.o : vx_stack_info.c | |
927 | ||
928 | raise-gcc.o : raise-gcc.c raise.h | |
929 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
930 | -iquote $(srcdir) -iquote $(ftop_srcdir)/libgcc \ | |
931 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) | |
932 | ||
933 | cio.o : cio.c | |
934 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
935 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) | |
936 | ||
937 | init.o : init.c adaint.h raise.h | |
938 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
939 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) | |
940 | ||
941 | init-vxsim.o : init-vxsim.c | |
942 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
943 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) | |
944 | ||
945 | initialize.o : initialize.c raise.h | |
946 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
947 | $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) | |
948 | ||
949 | link.o : link.c | |
950 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
951 | $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \ | |
952 | $< $(OUTPUT_OPTION) | |
953 | ||
954 | targext.o : targext.c | |
955 | $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \ | |
956 | -iquote $(srcdir) \ | |
957 | $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \ | |
958 | $< $(OUTPUT_OPTION) | |
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: |