This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] multilib first patch


Hi,

With Paolo help I tried to restart the effort to enable multilibs for
Ada. The following patch is a first cut: it enables creation of libada
and 32/libada and associated Makefile in the target build dir on
x86_64-linux trunk:

./x86_64-unknown-linux-gnu/libada
./x86_64-unknown-linux-gnu/32/libada

During bootstrap however the "32" part causes no effect because
gcc/ada/Makefile.in assumes it will build only one set of shared+static
in gcc/ada/rts since it uses only one gcc/stamp-gnatlib, file which is
already present when 32/libada tries to build the 32 bit version and so
make does nothing on this invocation.

To build and be later able to install more than one version of the ada
library we need to change (at least) this assumption in some way
and keep more than one library build result around.

Arnaud, Oliver, Paolo, do you have a prefered target, stamp and
directory scheme for this?

Thanks in advance,

Laurent

1/ for reference build generated .../libada/Makefile diff

guerby@gcc17:~/build-mlib6$ diff -u x86_64-unknown-linux-gnu/32/libada/Makefile x86_64-unknown-linux-gnu/libada/Makefile
--- x86_64-unknown-linux-gnu/32/libada/Makefile	2008-07-20 20:36:46.000000000 +0200
+++ x86_64-unknown-linux-gnu/libada/Makefile	2008-07-20 20:36:44.000000000 +0200
@@ -24,11 +24,11 @@
 
 ## Multilib support variables.
 MULTISRCTOP = 
-MULTIBUILDTOP = ../
-MULTIDIRS = 
-MULTISUBDIR = /32
-MULTIDO = true
-MULTICLEAN = true
+MULTIBUILDTOP = 
+MULTIDIRS = 32
+MULTISUBDIR = 
+MULTIDO = $(MAKE)
+MULTICLEAN = $(MAKE)
 
 # GNU Make needs to see an explicit $(MAKE) variable in the command it
 # runs to enable its job server during parallel builds.  Hence the
@@ -71,7 +71,7 @@
 
 # Standard autoconf-set variables.
 SHELL = /bin/sh
-srcdir = ../../../../trunk/libada
+srcdir = ../../../trunk/libada
 build = x86_64-unknown-linux-gnu
 target = x86_64-unknown-linux-gnu
 prefix = /n/17/guerby/install-trunk-mlib6
@@ -214,3 +214,71 @@
 # Don't export variables to the environment, in order to not confuse
 # configure.
 .NOEXPORT:
+
+PWD_COMMAND=$${PWDCMD-pwd}
+
+# FIXME: There should be an @-sign in front of the `if'.
+# Leave out until this is tested a bit more.
+multi-do:
+	if [ -z "$(MULTIDIRS)" ]; then \
(generic multi-xxx omitted ...)

2/ PATCH

(libada/configure regeneration omitted)

Index: gcc/ada/Makefile.in
===================================================================
--- gcc/ada/Makefile.in	(revision 138006)
+++ gcc/ada/Makefile.in	(working copy)
@@ -1982,6 +1982,7 @@
 		$(RANLIB_FOR_TARGET) rts/libgmem$(arext)
         endif
 	$(CHMOD) a-wx rts/*.ali
+	$(RM) ../stamp-gnatlib2
 	touch ../stamp-gnatlib
 
 # Warning: this target assumes that LIBRARY_VERSION has been set correctly.
Index: libada/Makefile.in
===================================================================
--- libada/Makefile.in	(revision 138006)
+++ libada/Makefile.in	(working copy)
@@ -17,7 +17,58 @@
 
 # Default target; must be first.
 all: gnatlib
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
 
+
+.PHONY: all install
+
+## Multilib support variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds.  Hence the
+# comments below.
+
+all-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+
+.PHONY: all-multi install-multi
+
+
+mostlyclean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+
+.PHONY: mostlyclean-multi clean-multi distclean-multi maintainer-clean-multi
+
+install-exec-am: install-multi
+## No uninstall rule?
+
+
+## These cleaning rules are recursive.  They should not be
+## registered as dependencies of *-am rules.  For instance
+## otherwise running `make clean' would cause both
+## clean-multi and mostlyclean-multi to be run, while only
+## clean-multi is really expected (since clean-multi recursively
+## call clean, it already do the job of mostlyclean).
+mostlyclean: mostlyclean-multi
+clean: clean-multi
+distclean: distclean-multi
+maintainer-clean: maintainer-clean-multi
+
+
 # Standard autoconf-set variables.
 SHELL = @SHELL@
 srcdir = @srcdir@
@@ -49,7 +100,7 @@
 
 # For finding the GCC build dir, which is used far too much
 host_subdir = @host_subdir@
-GCC_DIR=../../$(host_subdir)/gcc
+GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc
 # Include fragment generated by GCC configure.
 include $(GCC_DIR)/libada-mk
 
@@ -126,6 +177,7 @@
 
 # Installation rules.
 install:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
 
 install-info:
 
@@ -135,10 +187,13 @@
 
 # Cleaning rules.
 mostlyclean:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
 
 clean:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
 
 distclean:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
 	$(RM) Makefile config.status config.log
 
 maintainer-clean:
Index: libada/configure.ac
===================================================================
--- libada/configure.ac	(revision 138006)
+++ libada/configure.ac	(working copy)
@@ -49,6 +49,53 @@
   [MAINT='#'])
 AC_SUBST([MAINT])dnl
 
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+
+AM_ENABLE_MULTILIB(, ..)
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${enable_version_specific_runtime_libs} in
+  yes)
+    # Need the gcc compiler version to know where to install libraries
+    # and header files if --enable-version-specific-runtime-libs option
+    # is selected.
+    toolexecdir='$(libdir)/gcc/$(target_alias)'
+    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    ;;
+  no)
+    if test -n "$with_cross_host" &&
+       test x"$with_cross_host" != x"no"; then
+      # Install a library built with a cross compiler in tooldir, not libdir.
+      toolexecdir='$(exec_prefix)/$(target_alias)'
+      toolexeclibdir='$(toolexecdir)/lib'
+    else
+      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+      toolexeclibdir='$(libdir)'
+    fi
+    multi_os_directory=`$CC -print-multi-os-directory`
+    case $multi_os_directory in
+      .) ;; # Avoid trailing /.
+      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+    esac
+    ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+# Check the compiler.
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+AC_SUBST(CFLAGS)
+
 AC_ARG_ENABLE([shared],
 [AC_HELP_STRING([--disable-shared],
                 [don't provide a shared libgnat])],



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]