@@ -53,6 +53,8 @@ CHECKING_ADAFLAGS= -gnata
endif
WARN_ADAFLAGS= -W -Wall
+GNATMAKE_FOR_BUILD=gnatmake
+
# For native builds, the base compiler might be old and we need to arrange for
# style warnings not to be flagged as errors during stage1. Cross compilers
# need to be built by a recent/matching native so we might as well leave the
@@ -147,7 +149,8 @@ ifeq ($(build), $(host))
ADA_INCLUDES="-I- -I../rts" \
GNATMAKE="../../gnatmake" \
GNATLINK="../../gnatlink" \
- GNATBIND="../../gnatbind"
+ GNATBIND="../../gnatbind" \
+ GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)"
else
# This is a regular cross compiler. Use the native compiler to compile
# the tools.
@@ -166,6 +169,7 @@ ifeq ($(build), $(host))
GNATMAKE="gnatmake" \
GNATBIND="gnatbind" \
GNATLINK="gnatlink" \
+ GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" \
LIBGNAT=""
endif
else
@@ -189,6 +193,7 @@ else
GNATMAKE="$(GNATMAKE_FOR_HOST)" \
GNATBIND="$(GNATBIND_FOR_HOST)" \
GNATLINK="$(GNATLINK_FOR_HOST)" \
+ GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" \
LIBGNAT=""
else
# This is a canadian cross. We should use a toolchain running on the
@@ -204,6 +209,7 @@ else
GNATMAKE="$(GNATMAKE_FOR_HOST)" \
GNATBIND="$(GNATBIND_FOR_HOST)" \
GNATLINK="$(GNATLINK_FOR_HOST)" \
+ GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" \
LIBGNAT=""
endif
endif
@@ -658,7 +664,7 @@ ada.tags: force
ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
-$(MKDIR) ada/doctools
$(CP) $^ ada/doctools
- cd ada/doctools && $(GNATMAKE) -q xgnatugn
+ cd ada/doctools && $(GNATMAKE_FOR_BUILD) -q xgnatugn
# Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
# xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info
@@ -2415,7 +2415,7 @@ TOOLS_FLAGS_TO_PASS= \
"GNATLINK=$(GNATLINK)" \
"GNATBIND=$(GNATBIND)"
-GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES)
+GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS)
# Build directory for the tools. Let's copy the target-dependent
# sources using the same mechanism as for gnatlib. The other sources are
@@ -24,6 +24,7 @@ srcdir = @srcdir@
libdir = @libdir@
build = @build@
target = @target@
+host = @host@
prefix = @prefix@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -92,6 +93,7 @@ TOOLS_FLAGS_TO_PASS_RE= \
"CC=../../xgcc -B../../" \
"CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
"CFLAGS=$(CFLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
"ADAFLAGS=$(ADAFLAGS)" \
"ADA_CFLAGS=$(ADA_CFLAGS)" \
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
@@ -192,7 +194,11 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rts
# put the host RTS dir first in the PATH to hide the default runtime
# files that are among the sources
# FIXME: This should be done in configure.
+ifeq ($(host), $(build))
RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
+else
+RTS_DIR:=$(strip $(subst \,/,$(shell $(host)-gnatls -v | grep adalib )))
+endif
gnattools-cross: $(GCC_DIR)/stamp-tools
# gnattools1-re
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \