diff options
author | Nicolas Roche <roche@adacore.com> | 2011-08-05 15:57:05 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-05 17:57:05 +0200 |
commit | 28d711bf640d069aff010c0ac91d6f60dbedefc8 (patch) | |
tree | b9da19095cd786ef259dead7ba5af5d02a0e0480 | |
parent | 993f8920f402a8292fae58b22c03e31f3a308cf8 (diff) | |
download | gcc-28d711bf640d069aff010c0ac91d6f60dbedefc8.zip gcc-28d711bf640d069aff010c0ac91d6f60dbedefc8.tar.gz gcc-28d711bf640d069aff010c0ac91d6f60dbedefc8.tar.bz2 |
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
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Make-lang.in | 58 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Makefile.in | 18 |
3 files changed, 76 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1dcb3eb..5fc09ec 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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): diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 18a22bc..98f142e 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -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) diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 1e7a392..f877417 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -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) \ |