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