[committed] libada merge part 2: main part

Nathanael Nerode neroden@twcny.rr.com
Thu Apr 15 03:38:00 GMT 2004


This is the meat of the merge.

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libada/ChangeLog,v
retrieving revision 1.5
diff -u -r1.5 ChangeLog
--- ChangeLog	11 Mar 2004 00:27:37 -0000	1.5
+++ ChangeLog	15 Apr 2004 03:37:51 -0000
@@ -1,3 +1,15 @@
+2004-04-14  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+	* Makefile.in: Call gcc/ada/Makefile directly, not through the
+	intermediary of gcc/Makefile.  Incorporate all necessary parts of
+	rules from gcc/ada/Make-lang.in, including extra gnatlib/gnattools
+	targets, rts-zfp, rts-ravenscar.  Get needed bits of GCC
+	configuration from (new) gcc/libada-mk.  Decide what gnatlib variant
+	to build in configure.ac, not here.
+	* configure.ac: Provide Makefile.in with the new information it needs,
+	such as GCC's tmake_file and xmake_file.
+	* configure: Regenerate.
+
 2004-03-10  Kelley Cook  <kcook@gcc.gnu.org>
 
 	* configure.in: Rename file to ...
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/libada/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- Makefile.in	10 Feb 2004 23:14:58 -0000	1.3
+++ Makefile.in	15 Apr 2004 03:37:51 -0000
@@ -23,32 +23,229 @@
 srcdir = @srcdir@
 build = @build@
 target = @target@
-enable_shared = @enable_shared@
+prefix = @prefix@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
 
 # Nonstandard autoconf-set variables.
+enable_shared = @enable_shared@
+LN_S=@LN_S@
+target_noncanonical=@target_noncanonical@
 
-FLAGS_TO_PASS =
-
-GNATLIB = gnatlib
+# Variables for the user (or the top level) to override.
+objext=.o
+GNATLIBFLAGS= -W -Wall -gnatpg
+THREAD_KIND=native
+TRACE=no
+GNATLIBLDFLAGS=
+ADA_FOR_BUILD=
+ADA_FOR_TARGET=
+LDFLAGS=
+STAGE_PREFIX=
+
+# The tedious process of getting CFLAGS right.
+CFLAGS=-g
+LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
+GCC_WARN_CFLAGS = $(LOOSE_WARN) $(NOCOMMON_FLAG)
+
+ADA_CFLAGS=
+T_ADA_CFLAGS=
+# HPPA is literally the only target which sets X_ADA_CFLAGS
+X_ADA_CFLAGS=@x_ada_cflags@
+ALL_ADA_CFLAGS=$(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
+
+# Variables for gnattools.
+ADAFLAGS= -gnatpg -gnata
+ADA_INCLUDE_DIR = $(libsubdir)/adainclude
+ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
+
+# For finding the GCC build dir, which is used far too much
+GCC_DIR=../../gcc
+# Include fragment generated by GCC configure.
+include $(GCC_DIR)/libada-mk
+# Variables based on those gleaned from the GCC makefile.  :-P
+libsubdir=$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
+
+TARGET_LIBGCC2_CFLAGS=
+GNATLIBCFLAGS= -g -O2
+# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS
+# and possibly GNATLIBCFLAGS.  Currently this uses files
+# in gcc/config.  The 'subst' call is used to rerelativize them
+# from their gcc locations.  This is hackery, but there isn't
+# yet a better way to do this.
+tmake_file=$(subst /config,/../gcc/config,$(gcc_tmake_file))
+ifneq ($(tmake_file),)
+include $(tmake_file)
+endif
 
-ifeq ($(build),$(target))
-  GNATTOOLS = gnattools
+# Get possible host-specific override for libsubdir (ick).
+xmake_file=$(subst /config,/../gcc/config,$(gcc_xmake_file))
+ifneq ($(xmake_file),)
+include $(xmake_file)
+endif
 
-  ifeq ($(enable_shared),yes)
-    GNATLIB = gnatlib-shared
-  endif
+FLAGS_TO_PASS = \
+        "MAKEOVERRIDES=" \
+        "LDFLAGS=$(LDFLAGS)" \
+        "LN_S=$(LN_S)" \
+        "SHELL=$(SHELL)" \
+        "exeext=$(exeext)" \
+        "objext=$(objext)" \
+        "prefix=$(prefix)" \
+        "STAGE_PREFIX=$(STAGE_PREFIX)" \
+	"CC=$(cc_set_by_configure)" \
+        "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)"
+
+ADA_FLAGS_TO_PASS = \
+        "ADA_FOR_BUILD=$(ADA_FOR_BUILD)"        \
+        "ADA_INCLUDE_DIR=$(ADA_INCLUDE_DIR)"    \
+        "ADA_RTL_OBJ_DIR=$(ADA_RTL_OBJ_DIR)"    \
+        "ADAFLAGS=$(ADAFLAGS)"                  \
+        "ADA_FOR_TARGET=$(ADA_FOR_TARGET)"      \
+        "INSTALL=$(INSTALL)"                    \
+        "INSTALL_DATA=$(INSTALL_DATA)"          \
+        "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
+
+ADA_TOOLS_FLAGS_TO_PASS=\
+        "CC=../../xgcc -B../../"        \
+        "CFLAGS=$(CFLAGS)"              \
+        "exeext=$(exeext)"              \
+        "ADAFLAGS=$(ADAFLAGS)"          \
+        "ADA_INCLUDES=-I../rts"         \
+        "GNATMAKE=../../gnatmake"       \
+        "GNATLINK=../../gnatlink"       \
+        "GNATBIND=../../gnatbind"
 
-else
-  GNATTOOLS = cross-gnattools ada.all.cross
-endif
+fyi:
+	echo $(tmake_file)
 
 # Rules to build gnatlib.
-gnatlib:
-	$(MAKE) -C ../../gcc $(FLAGS_TO_PASS) $(GNATLIB)
+.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-shared
+gnatlib: @default_gnatlib_target@
+
+gnatlib-plain:
+	$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
+	  GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+	  GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+	  TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
+	  THREAD_KIND="$(THREAD_KIND)" \
+	  TRACE="$(TRACE)" \
+	  gnatlib ; \
+
+gnatlib-sjlj:
+	$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
+	  GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+	  GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+	  TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
+	  THREAD_KIND="$(THREAD_KIND)" \
+	  TRACE="$(TRACE)" \
+	  gnatlib-sjlj ; \
+
+gnatlib-shared:
+	$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
+	  GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+	  GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+	  GNATLIBLDFLAGS="$(GNATLIBLDFLAGS)" \
+	  TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
+	  THREAD_KIND="$(THREAD_KIND)" \
+	  TRACE="$(TRACE)" \
+	  gnatlib-shared ; \
+
+.PHONY: rts-zfp rts-ravenscar
+rts-zfp:
+	$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
+	  GNATMAKE=../gnatmake-cross \
+	  rts-zfp
+
+rts-ravenscar:
+	$(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
+	  GNATMAKE=../gnatmake-cross \
+	  rts-ravenscar
 
 # Rules to build gnattools.
+# For cross builds of gnattools,
+# 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 )))
+.PHONY: gnattools regnattools
 gnattools: gnatlib
-	$(MAKE) -C ../../gcc $(FLAGS_TO_PASS) $(GNATTOOLS)
+	if test $(build) = $(target) ; then \
+	  $(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
+	    ADA_INCLUDES="-I- -I../rts" \
+	    CC="../../xgcc -B../../" STAGE_PREFIX=../../  gnattools1 ; \
+	  $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2 ; \
+	  $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools3 ; \
+	else \
+	  $(MAKE)  -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
+	    ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \
+	    GNATMAKE="gnatmake" \
+	    GNATBIND="gnatbind" \
+	    GNATLINK="gnatlink" \
+	    LIBGNAT="" \
+	    gnattools1-re gnattools2 gnattools4 ; \
+	  $(MAKE) $(FLAGS_TO_PASS) ada.all.cross ; \
+	fi
+
+regnattools:
+	$(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re
+	$(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
+	$(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools3
+
+# It's unclear whether this is even needed, and if so whether it should run
+# *before* the rest of crossgnattools or *after* it.
+ada.all.cross:
+	if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatbl$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatbl$(exeext) $(GCC_DIR)/gnatbl-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gpr2make$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gpr2make$(exeext) $(GCC_DIR)/gpr2make-cross$(exeext); \
+	fi
+	if [ -f $(GCC_DIR)/gprcmd$(exeext) ] ; then \
+	  mv $(GCC_DIR)/gprcmd$(exeext) $(GCC_DIR)/gprcmd-cross$(exeext); \
+	fi
 
 # Check uninstalled version.
 check:
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libada/configure.ac,v
retrieving revision 1.1
diff -u -r1.1 configure.ac
--- configure.ac	11 Mar 2004 00:27:37 -0000	1.1
+++ configure.ac	15 Apr 2004 03:37:51 -0000
@@ -16,17 +16,16 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 AC_INIT
-AC_CONFIG_SRCDIR([Makefile.in])
-
-# This is an autoconf 2.5x script.
 AC_PREREQ([2.59])
 
+AC_CONFIG_SRCDIR([Makefile.in])
+
+# Command-line options.
 # Very limited version of AC_MAINTAINER_MODE.
-AC_ARG_ENABLE(
-  [maintainer-mode],
-  AC_HELP_STRING([--enable-maintainer-mode],
+AC_ARG_ENABLE([maintainer-mode],
+  [AC_HELP_STRING([--enable-maintainer-mode],
                  [enable make rules and dependencies not useful (and
-                  sometimes confusing) to the casual installer]),
+                  sometimes confusing) to the casual installer])],
   [case ${enable_maintainer_mode} in
      yes) MAINT='' ;;
      no) MAINT='#' ;;
@@ -36,30 +35,58 @@
   [MAINT='#'])
 AC_SUBST([MAINT])dnl
 
-# Start of actual configure tests
-
-# Output: create a Makefile.
-AC_CONFIG_FILES([Makefile])
-
-AC_CANONICAL_SYSTEM
-
-AC_ARG_ENABLE(shared,
-[  --disable-shared        don't provide a shared libgnat],
-[ 
-  case $enable_shared in
+AC_ARG_ENABLE([shared],
+[AC_HELP_STRING([--disable-shared],
+                [don't provide a shared libgnat])],
+[
+case $enable_shared in
   yes | no) ;;
   *)
     enable_shared=no
     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
     for pkg in $enableval; do
-      if test "$pkg" = "ada" || test "$pkg" = "libada"; then
-        enable_shared=yes
-      fi
+      case $pkg in
+        ada | libada)
+          enable_shared=yes ;;
+      esac
     done
     IFS="$ac_save_ifs"
     ;;
-  esac
+esac
 ], [enable_shared=yes])
-AC_SUBST(enable_shared)
+AC_SUBST([enable_shared])
+
+# Start of actual configure tests
+
+AC_PROG_INSTALL
+
+AC_CANONICAL_SYSTEM
+
+sinclude(../config/acx.m4)
+_GCC_TOPLEV_NONCANONICAL_TARGET
+AC_SUBST(target_noncanonical)
+
+# Need to pass this down for now :-P
+AC_PROG_LN_S
+
+# Determine x_ada_cflags
+case $host in
+  hppa*) x_ada_cflags=-mdisable-indexing ;;
+  *) x_ada_cflags= ;;
+esac
+AC_SUBST([x_ada_cflags])
+
+# Determine what to build for 'gnatlib'
+if test $build = $target \
+   && test ${enable_shared} = yes ; then
+  # Note that build=target is almost certainly the wrong test; FIXME
+  default_gnatlib_target="gnatlib-shared"
+else
+  default_gnatlib_target="gnatlib-simple"
+fi
+AC_SUBST([default_gnatlib_target])
+
+# Output: create a Makefile.
+AC_CONFIG_FILES([Makefile])
 
 AC_OUTPUT

-- 
Honesty is the best policy.



More information about the Gcc-patches mailing list