From 6df6da4a619b2ff8556d9979003601c99b2b4d2d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 30 Sep 2007 23:41:32 +0000 Subject: [PATCH] Clean up target handling--only build required files, warn about unsupported targets. --- gold/Makefile.am | 19 ++++++++++------- gold/Makefile.in | 42 ++++++++++++++++++++++---------------- gold/configure | 27 +++++++++++++++++++----- gold/configure.ac | 22 +++++++++++++++++--- gold/testsuite/Makefile.in | 1 + 5 files changed, 78 insertions(+), 33 deletions(-) diff --git a/gold/Makefile.am b/gold/Makefile.am index d69076a5621..e4764757f73 100644 --- a/gold/Makefile.am +++ b/gold/Makefile.am @@ -73,24 +73,29 @@ HFILES = \ target-select.h \ workqueue.h -TARGETFILES = \ - i386.cc - YFILES = \ yyscript.y EXTRA_DIST = yyscript.c yyscript.h +TARGETSOURCES = \ + i386.cc + +ALL_TARGETOBJS = \ + i386.$(OBJEXT) + libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) -sources_var = main.cc $(TARGETFILES) -deps_var = libgold.a $(LIBINTL_DEP) -ldadd_var = libgold.a $(LIBINTL) +sources_var = main.cc +deps_var = $(TARGETOBJS) libgold.a $(LIBINTL_DEP) +ldadd_var = $(TARGETOBJS) libgold.a $(LIBINTL) ld_new_SOURCES = $(sources_var) ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS) ld_new_LDADD = $(ldadd_var) $(LIBOBJS) +EXTRA_ld_new_SOURCES = $(TARGETSOURCES) + # Use an explicit dependency for the bison generated header file. script.$(OBJEXT): yyscript.h @@ -113,7 +118,7 @@ install-exec-local: ld-new$(EXEEXT) # the cygnus option. install-data-local: install-info -POTFILES= $(CCFILES) $(HFILES) $(TARGETFILES) +POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES) po/POTFILES.in: @MAINT@ Makefile for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \ diff --git a/gold/Makefile.in b/gold/Makefile.in index 32135726c78..3ca6b8cd581 100644 --- a/gold/Makefile.in +++ b/gold/Makefile.in @@ -84,18 +84,18 @@ am_libgold_a_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) libgold_a_OBJECTS = $(am_libgold_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) -am__objects_4 = i386.$(OBJEXT) -am__objects_5 = main.$(OBJEXT) $(am__objects_4) -am_ld_new_OBJECTS = $(am__objects_5) +am__objects_4 = main.$(OBJEXT) +am_ld_new_OBJECTS = $(am__objects_4) ld_new_OBJECTS = $(am_ld_new_OBJECTS) am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = libgold.a $(am__DEPENDENCIES_1) +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) libgold.a \ + $(am__DEPENDENCIES_1) am__DEPENDENCIES_3 = @LIBOBJS@ -am__ld1_SOURCES_DIST = main.cc i386.cc -@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ld1_OBJECTS = $(am__objects_5) +am__ld1_SOURCES_DIST = main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ld1_OBJECTS = $(am__objects_4) ld1_OBJECTS = $(am_ld1_OBJECTS) -am__ld2_SOURCES_DIST = main.cc i386.cc -@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ld2_OBJECTS = $(am__objects_5) +am__ld2_SOURCES_DIST = main.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ld2_OBJECTS = $(am__objects_4) ld2_OBJECTS = $(am_ld2_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/../depcomp @@ -110,10 +110,11 @@ CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -SOURCES = $(libgold_a_SOURCES) $(ld_new_SOURCES) $(ld1_SOURCES) \ - $(ld2_SOURCES) +SOURCES = $(libgold_a_SOURCES) $(ld_new_SOURCES) \ + $(EXTRA_ld_new_SOURCES) $(ld1_SOURCES) $(ld2_SOURCES) DIST_SOURCES = $(libgold_a_SOURCES) $(ld_new_SOURCES) \ - $(am__ld1_SOURCES_DIST) $(am__ld2_SOURCES_DIST) + $(EXTRA_ld_new_SOURCES) $(am__ld1_SOURCES_DIST) \ + $(am__ld2_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ @@ -202,6 +203,7 @@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +TARGETOBJS = @TARGETOBJS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ @@ -318,21 +320,25 @@ HFILES = \ target-select.h \ workqueue.h -TARGETFILES = \ - i386.cc - YFILES = \ yyscript.y EXTRA_DIST = yyscript.c yyscript.h +TARGETSOURCES = \ + i386.cc + +ALL_TARGETOBJS = \ + i386.$(OBJEXT) + libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) -sources_var = main.cc $(TARGETFILES) -deps_var = libgold.a $(LIBINTL_DEP) -ldadd_var = libgold.a $(LIBINTL) +sources_var = main.cc +deps_var = $(TARGETOBJS) libgold.a $(LIBINTL_DEP) +ldadd_var = $(TARGETOBJS) libgold.a $(LIBINTL) ld_new_SOURCES = $(sources_var) ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS) ld_new_LDADD = $(ldadd_var) $(LIBOBJS) -POTFILES = $(CCFILES) $(HFILES) $(TARGETFILES) +EXTRA_ld_new_SOURCES = $(TARGETSOURCES) +POTFILES = $(CCFILES) $(HFILES) $(TARGETSOURCES) @GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_SOURCES = $(sources_var) @GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld @GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_LDADD = $(ldadd_var) diff --git a/gold/configure b/gold/configure index e9c942a8025..d3e484055fa 100755 --- a/gold/configure +++ b/gold/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CXXFLAGS LIBOBJS CXXCPP EGREP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CXXFLAGS LIBOBJS CXXCPP EGREP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1878,6 +1878,8 @@ if test -n "$enable_targets"; then fi # See which specific instantiations we need. +targetobjs= +all_targets= for targ in $target $canon_targets; do targ_32_little= targ_32_big= @@ -1888,13 +1890,20 @@ for targ in $target $canon_targets; do targ_32_big=yes targ_64_little=yes targ_64_big=yes + all_targets=yes else case "$targ" in - i?86-*) targ_32_little=yes ;; - x86_64-*) targ_64_little=yes ;; + i?86-*) + targ_32_little=yes + targetobjs="$targetobjs i386.\$(OBJEXT)" + ;; + x86_64-*) + targ_64_little=yes + targetobjs="$targetobjs x86_64.\$(OBJEXT)" + ;; *) - { { echo "$as_me:$LINENO: error: \"target $targ: unknown size and endianness\"" >&5 -echo "$as_me: error: \"target $targ: unknown size and endianness\"" >&2;} + { { echo "$as_me:$LINENO: error: \"unsupported target $targ\"" >&5 +echo "$as_me: error: \"unsupported target $targ\"" >&2;} { (exit 1); exit 1; }; } ;; esac @@ -1930,6 +1939,13 @@ _ACEOF fi +if test -n "$all_targets"; then + TARGETOBJS='$(ALL_TARGETOBJS)' +else + TARGETOBJS="$targetobjs" +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6094,6 +6110,7 @@ s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t +s,@TARGETOBJS@,$TARGETOBJS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t diff --git a/gold/configure.ac b/gold/configure.ac index fcb176f7f12..500568e8296 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -41,6 +41,8 @@ if test -n "$enable_targets"; then fi # See which specific instantiations we need. +targetobjs= +all_targets= for targ in $target $canon_targets; do targ_32_little= targ_32_big= @@ -51,12 +53,19 @@ for targ in $target $canon_targets; do targ_32_big=yes targ_64_little=yes targ_64_big=yes + all_targets=yes else case "$targ" in - i?86-*) targ_32_little=yes ;; - x86_64-*) targ_64_little=yes ;; + i?86-*) + targ_32_little=yes + targetobjs="$targetobjs i386.\$(OBJEXT)" + ;; + x86_64-*) + targ_64_little=yes + targetobjs="$targetobjs x86_64.\$(OBJEXT)" + ;; *) - AC_MSG_ERROR("target $targ: unknown size and endianness") + AC_MSG_ERROR("unsupported target $targ") ;; esac fi @@ -79,6 +88,13 @@ if test -n "$targ_64_big"; then [Define to support 64-bit big-endian targets]) fi +if test -n "$all_targets"; then + TARGETOBJS='$(ALL_TARGETOBJS)' +else + TARGETOBJS="$targetobjs" +fi +AC_SUBST(TARGETOBJS) + AC_PROG_CC AC_PROG_CXX AC_PROG_YACC diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 57ac16a534f..9e348219f40 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -356,6 +356,7 @@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +TARGETOBJS = @TARGETOBJS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ -- 2.30.2