Makefile.in: Don't use directly ../xgcc to build shared libgnat.

2011-08-05  Nicolas Roche  <roche@adacore.com>

	* gcc-interface/Makefile.in: Don't use directly ../xgcc to build shared 
	libgnat. Use rather the value of GCC_FOR_TARGET. Fix issue with         
	canadian cross.
	* gcc-interface/Make-lang.in: Add support for canadian cross setting.

From-SVN: r177462
This commit is contained in:
Nicolas Roche 2011-08-05 15:57:05 +00:00 committed by Arnaud Charlet
parent 993f8920f4
commit 28d711bf64
3 changed files with 76 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2011-08-05 Nicolas Roche <roche@adacore.com>
* gcc-interface/Makefile.in: Don't use directly ../xgcc to build shared
libgnat. Use rather the value of GCC_FOR_TARGET. Fix issue with
canadian cross.
* gcc-interface/Make-lang.in: Add support for canadian cross setting.
2011-08-05 Matthew Heaney <heaney@adacore.com>
* a-comutr.adb, a-cimutr.adb, a-cbmutr.adb (Child_Count, Child_Depth):

View File

@ -94,7 +94,11 @@ ada: gnat1$(exeext) gnatbind$(exeext)
# There are too many Ada sources to check against here. Let's
# always force the recursive make.
ADA_TOOLS_FLAGS_TO_PASS=\
ifeq ($(build), $(host))
ifeq ($(host), $(target))
# This is a regular native. So use the compiler from our current build
# tree.
ADA_TOOLS_FLAGS_TO_PASS=\
"CC=../../xgcc -B../../" \
"CFLAGS=$(CFLAGS)" \
"exeext=$(exeext)" \
@ -103,6 +107,58 @@ ADA_TOOLS_FLAGS_TO_PASS=\
"GNATMAKE=../../gnatmake" \
"GNATLINK=../../gnatlink" \
"GNATBIND=../../gnatbind"
else
# This is a regular cross compiler. Use the native compiler to compile
# the tools.
# put the host RTS dir first in the PATH to hide the default runtime
# files that are among the sources
RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
ADA_TOOLS_FLAGS_TO_PASS=\
CC="$(CC)" \
$(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \
GNATMAKE="gnatmake" \
GNATBIND="gnatbind" \
GNATLINK="gnatlink" \
LIBGNAT=""
endif
else
# Build is different from host so we are either building a canadian cross
# or a cross-native compiler. We provide defaults for tools targeting the
# host platform, but they can be overriden by just setting <tool>_FOR_HOST
# variables.
GNATMAKE_FOR_HOST=$(host)-gnatmake
GNATBIND_FOR_HOST=$(host)-gnatbind
GNATLINK_FOR_HOST=$(host)-gnatlink
GNATLS_FOR_HOST=$(host)-gnatls
ifeq ($(host), $(target))
# This is a cross native. All the sources are taken from the currently
# built runtime.
ADA_TOOLS_FLAGS_TO_PASS=\
CC="$(CC)" \
$(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
ADA_INCLUDES="-I../rts" \
GNATMAKE="$(GNATMAKE_FOR_HOST)" \
GNATBIND="$(GNATBIND_FOR_HOST)" \
GNATLINK="$(GNATLINK_FOR_HOST)" \
LIBGNAT=""
else
# This is a canadian cross. We should use a toolchain running on the
# build platform and targeting the host platform.
RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))
ADA_TOOLS_FLAGS_TO_PASS=\
CC="$(CC)" \
$(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \
GNATMAKE="$(GNATMAKE_FOR_HOST)" \
GNATBIND="$(GNATBIND_FOR_HOST)" \
GNATLINK="$(GNATLINK_FOR_HOST)" \
LIBGNAT=""
endif
endif
GCC_LINK=$(LINKER) $(ALL_LINKERFLAGS) -static-libgcc $(LDFLAGS)

View File

@ -2488,13 +2488,15 @@ gnatlib-shared-default:
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
$(RM) $(RTSDIR)/libgna*$(soext)
cd $(RTSDIR); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
$(TARGET_LIBGCC2_CFLAGS) \
-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(MISCLIB) -lm
cd $(RTSDIR); ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \
$(TARGET_LIBGCC2_CFLAGS) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
@ -2556,12 +2558,14 @@ gnatlib-shared-win32:
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
$(RM) $(RTSDIR)/libgna*$(soext)
cd $(RTSDIR); ../../xgcc -B../../ -shared -shared-libgcc \
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
$(TARGET_LIBGCC2_CFLAGS) \
-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB)
cd $(RTSDIR); ../../xgcc -B../../ -shared -shared-libgcc \
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \
$(TARGET_LIBGCC2_CFLAGS) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
@ -2577,13 +2581,15 @@ gnatlib-shared-darwin:
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
$(RM) $(RTSDIR)/libgnat$(soext) $(RTSDIR)/libgnarl$(soext)
cd $(RTSDIR); ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(MISCLIB) -lm
cd $(RTSDIR); ../../xgcc -B../../ -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(TARGET_LIBGCC2_CFLAGS) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \