# Makefile for GNU Ada Compiler (GNAT).
-# Copyright (C) 1994-2011 Free Software Foundation, Inc.
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
#This file is part of GCC.
GNATLIBFLAGS = -W -Wall -gnatpg -nostdinc
GNATLIBCFLAGS = -g -O2
PICFLAG_FOR_TARGET = @PICFLAG_FOR_TARGET@
+
# Pretend that _Unwind_GetIPInfo is available for the target by default. This
# should be autodetected during the configuration of libada and passed down to
# here, but we need something for --disable-libada and hope for the best.
-GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET) \
+GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) \
-fexceptions -DIN_RTS -DHAVE_GETIPINFO
ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
THREAD_KIND = native
# Convert the target variable into a space separated list of architecture,
# manufacturer, and operating system and assign each of those to its own
# variable.
-
host:=$(subst -, ,$(host_canonical))
targ:=$(subst -, ,$(target))
arch:=$(word 1,$(targ))
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
-INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/config \
- -I$(srcdir)/../include
+INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/../include
ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
-INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. -iquote $(fsrcdir)/ada \
- -I$(fsrcdir)/../include
-
-ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
- # On Windows native the tconfig.h files used by C runtime files needs to have
- # the gcc source dir in its include dir list
- INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. -iquote $(fsrcdir)/ada \
- -I$(fsrcdir)/../include -I$(fsrcdir)
+# Likewise, but valid for subdirectories of the current dir.
+# FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in
+# that directory conflicts with a system header file.
+ifneq ($(findstring vxworks,$(osys)),)
+ INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
+ -iquote $(fsrcdir)/ada \
+ -I$(fsrcdir)/../include
+else
+ INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
+ -iquote $(fsrcdir)/ada -iquote $(fsrcdir) \
+ -I$(fsrcdir)/../include
endif
ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
X86_TARGET_PAIRS = \
a-numaux.ads<a-numaux-x86.ads \
a-numaux.adb<a-numaux-x86.adb \
- g-bytswa.adb<g-bytswa-x86.adb \
s-atocou.adb<s-atocou-x86.adb
X86_64_TARGET_PAIRS = \
a-numaux.ads<a-numaux-x86.ads \
a-numaux.adb<a-numaux-x86.adb \
- g-bytswa.adb<g-bytswa-x86.adb \
s-atocou.adb<s-atocou-builtin.adb
LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)ada/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
s-thread.adb<s-thread-ae653.adb \
s-tpopsp.adb<s-tpopsp-vxworks.adb \
s-vxwork.ads<s-vxwork-ppc.ads \
- system.ads<system-vxworks-ppc.ads \
+ system.ads<system-vxworks-ppc-mils.ads \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(DUMMY_SOCKETS_TARGET_PAIRS)
a-exetim.ads<a-exetim-default.ads \
s-linux.ads<s-linux.ads \
s-osinte.adb<s-osinte-posix.adb \
- system.ads<system-linux-x86.ads \
- $(ATOMICS_TARGET_PAIRS) \
- $(X86_TARGET_PAIRS)
+ $(ATOMICS_TARGET_PAIRS)
+
+ LIBGNAT_TARGET_PAIRS_32 = \
+ $(X86_TARGET_PAIRS) \
+ system.ads<system-linux-x86.ads
+
+ LIBGNAT_TARGET_PAIRS_64 = \
+ $(X86_64_TARGET_PAIRS) \
+ system.ads<system-linux-x86_64.ads
+
+ ifeq ($(strip $(MULTISUBDIR)),/64)
+ LIBGNAT_TARGET_PAIRS += $(LIBGNAT_TARGET_PAIRS_64)
+ else
+ LIBGNAT_TARGET_PAIRS += $(LIBGNAT_TARGET_PAIRS_32)
+ endif
ifeq ($(strip $(filter-out xenomai,$(THREAD_KIND))),)
LIBGNAT_TARGET_PAIRS += \
GNATLIB_SHARED = gnatlib-shared-dual
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
endif
ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
THREADSLIB= -lpthread
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
endif
ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
THREADSLIB= -lpthread
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
endif
ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
LN = cp -p
LN_S = cp -p
-.SUFFIXES: .sym
-
-.o.sym:
- @ gnu:[bin]vmssymvec $<
endif
ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
endif
endif
-adamsg.o: adamsg.msg
- -$(DECC) --cc=message adamsg.msg -o adamsg.o
-
EXTRA_GNATMAKE_OBJS = mlib-tgt-vms_common.o
GMEM_LIB = gmemlib
EH_MECHANISM=-gcc
GNATLIB_SHARED=gnatlib-shared-vms
- EXTRA_LIBGNAT_SRCS+=adamsg.msg
- EXTRA_LIBGNAT_OBJS+=adamsg.o
EXTRA_GNATRTL_NONTASKING_OBJS+=s-po32gl.o
EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o
EXTRA_GNATTOOLS = \
indepsw.adb<indepsw-gnu.adb
endif
-ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
- LIBGNAT_TARGET_PAIRS = \
+ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
+ # Cygwin provides a full Posix environment, and so we use the default
+ # versions of s-memory and g-socthi rather than the Windows-specific
+ # MinGW versions. Ideally we would use all the default versions for
+ # Cygwin and none of the MinGW versions, but for historical reasons
+ # the Cygwin port has always been a CygMing frankenhybrid and it is
+ # a long-term project to disentangle them.
+ ifeq ($(strip $(filter-out cygwin%,$(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ s-memory.adb<s-memory.adb \
+ g-socthi.ads<g-socthi.ads \
+ g-socthi.adb<g-socthi.adb
+ else
+ LIBGNAT_TARGET_PAIRS = \
+ s-memory.adb<s-memory-mingw.adb \
+ g-socthi.ads<g-socthi-mingw.ads \
+ g-socthi.adb<g-socthi-mingw.adb
+ endif
+ LIBGNAT_TARGET_PAIRS += \
a-dirval.adb<a-dirval-mingw.adb \
a-excpol.adb<a-excpol-abort.adb \
s-gloloc.adb<s-gloloc-mingw.adb \
s-inmaop.adb<s-inmaop-dummy.adb \
- s-memory.adb<s-memory-mingw.adb \
s-taspri.ads<s-taspri-mingw.ads \
s-tasinf.adb<s-tasinf-mingw.adb \
s-tasinf.ads<s-tasinf-mingw.ads \
- g-socthi.ads<g-socthi-mingw.ads \
- g-socthi.adb<g-socthi-mingw.adb \
g-stsifd.adb<g-stsifd-sockets.adb \
g-soliop.ads<g-soliop-mingw.ads \
$(ATOMICS_TARGET_PAIRS)
EH_MECHANISM=-gcc
GNATLIB_SHARED = gnatlib-shared-darwin
- RANLIB = ranlib -c
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
soext = .dylib
argv.c cio.c cstreams.c errno.c exit.c cal.c ctrl_c.c env.c env.h \
arit64.c raise.h raise.c sysdep.c aux-io.c init.c initialize.c \
locales.c seh_init.c final.c tracebak.c tb-alvms.c tb-alvxw.c \
- tb-gcc.c expect.c mkdir.c socket.c gsocket.h targext.c $(EXTRA_LIBGNAT_SRCS)
+ tb-gcc.c expect.c mkdir.c socket.c gsocket.h targext.c terminals.c \
+ thread.c $(EXTRA_LIBGNAT_SRCS)
LIBGNAT_OBJS = adadecode.o adaint.o argv.o cio.o cstreams.o ctrl_c.o \
errno.o exit.o env.o raise.o sysdep.o aux-io.o init.o initialize.o \
locales.o seh_init.o cal.o arit64.o final.o tracebak.o expect.o \
- mkdir.o socket.o targext.o $(EXTRA_LIBGNAT_OBJS)
+ mkdir.o socket.o targext.o terminals.o $(EXTRA_LIBGNAT_OBJS)
# NOTE ??? - when the -I option for compiling Ada code is made to work,
# the library installation will change and there will be a
$(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
# Copy tsystem.h
$(CP) $(srcdir)/tsystem.h $(RTSDIR)
-# Copy generated target dependent sources
- $(RM) $(RTSDIR)/s-oscons.ads
- (cd $(RTSDIR); $(LN_S) ../s-oscons.ads s-oscons.ads)
$(RM) ../stamp-gnatlib-$(RTSDIR)
touch ../stamp-gnatlib1-$(RTSDIR)
# GNULLI End #############################################################
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
+OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \
+ -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c
+
+OSCONS_EXTRACT=../../$(DECC) -DNATIVE \
+ -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c ; \
+ ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
+ ./s-oscons-tmplt.exe > s-oscons-tmplt.s
+
+else
+# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
+# for running it from $(RTSDIR)
+OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
+ | sed -e 's^\./xgcc^../../xgcc^' -e 's^-B./^-B../../^'`
+OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
+ -DTARGET=\"$(target)\" $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
+OSCONS_EXTRACT=$(OSCONS_CC) $(GNATLIBCFLAGS) -S s-oscons-tmplt.i
+endif
+
+./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb
+ -$(MKDIR) ./bldtools/oscons
+ $(RM) $(addprefix ./bldtools/oscons/,$(notdir $^))
+ $(CP) $^ ./bldtools/oscons
+ (cd ./bldtools/oscons ; gnatmake -q xoscons)
+
+$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
+ $(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
+ (cd $(RTSDIR) ; \
+ $(OSCONS_CPP) ; \
+ $(OSCONS_EXTRACT) ; \
+ ../bldtools/oscons/xoscons)
+
# Don't use semicolon separated shell commands that involve list expansions.
# The semicolon triggers a call to DCL on VMS and DCL can't handle command
# line lengths in excess of 256 characters.
# Example: cd $(RTSDIR); ar rc libfoo.a $(LONG_LIST_OF_OBJS)
# is guaranteed to overflow the buffer.
-gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
+gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads
$(MAKE) -C $(RTSDIR) \
CC="`echo \"$(GCC_FOR_TARGET)\" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
+ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
gnatlib-shared-dual-win32:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
- GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
+ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
+ PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib-shared-win32
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
+ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(PICFLAG_FOR_TARGET)" \
- GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \
+ GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) $(PICFLAG_FOR_TARGET) -fno-common" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \
$(GNATLIB_SHARED)
+# When building a SJLJ runtime for VxWorks, in addition to forcing
+# ZCX_By_default to True, we need to ensure that -crtbe linker options
+# is not passed. Otherwise we will end with weak symbols on
+# __register_frame_info and __deregister_frame_info. The VxWorks 5.x
+# will issue an error on weak symbols.
gnatlib-sjlj:
$(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" \
THREAD_KIND="$(THREAD_KIND)" ../stamp-gnatlib1-$(RTSDIR)
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' $(RTSDIR)/system.ads > $(RTSDIR)/s.ads
- $(MV) $(RTSDIR)/s.ads $(RTSDIR)/system.ads
+ cat $(RTSDIR)/s.ads | grep -v "Linker_Options.*-crtbe" > $(RTSDIR)/s2.ads
+ $(RM) $(RTSDIR)/s.ads
+ $(MV) $(RTSDIR)/s2.ads $(RTSDIR)/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
EH_MECHANISM="" \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
+ FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
+ FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
sysdep.o : sysdep.c
raise.o : raise.c raise.h
sigtramp-ppcvxw.o : sigtramp-ppcvxw.c sigtramp.h
+terminals.o : terminals.c
vx_stack_info.o : vx_stack_info.c
raise-gcc.o : raise-gcc.c raise.h