This is the mail archive of the gcc-patches@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]

libiberty for $build



Here's my first attempt at building a libiberty that's specifically
for the build machine.  I figure gcc can add something like this:

FORBUILD = ..`test "$build" != "$host" && echo /$build`
BUILD_LIBIBERTY = $(FORBUILD)/libiberty/libiberty.a

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.in,v
retrieving revision 1.84
diff -p -3 -r1.84 Makefile.in
*** Makefile.in	2001/06/28 04:38:44	1.84
--- Makefile.in	2001/07/10 02:58:35
*************** TARGET_CONFIGDIRS = libiberty libgloss $
*** 174,179 ****
--- 174,182 ----
  # Changed by configure to $(target_alias) if cross.
  TARGET_SUBDIR = .
  
+ BUILD_CONFIGDIRS = libiberty
+ BUILD_SUBDIR = .
+ 
  # This is set by the configure script to the arguments passed to configure.
  CONFIG_ARGUMENTS = 
  
*************** EXTRA_GCC_FLAGS = \
*** 489,494 ****
--- 492,509 ----
  GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
  
  # This is a list of the targets for all of the modules which are compiled
+ # using the build machine's native compiler.  Configure edits the second
+ # macro for build!=host builds.
+ ALL_BUILD_MODULES_LIST = \
+ 	all-build-libiberty
+ ALL_BUILD_MODULES = 
+ 
+ # This is a list of the configure targets for all of the modules which
+ # are compiled using the native tools.
+ CONFIGURE_BUILD_MODULES = \
+ 	configure-build-libiberty
+ 
+ # This is a list of the targets for all of the modules which are compiled
  # using $(FLAGS_TO_PASS).
  ALL_MODULES = \
  	all-apache \
*************** CLEAN_X11_MODULES = \
*** 943,948 ****
--- 958,964 ----
  # The target built for a native build.
  .PHONY: all.normal
  all.normal: \
+ 	$(ALL_BUILD_MODULES) \
  	$(ALL_MODULES) \
  	$(ALL_X11_MODULES) \
  	$(ALL_TARGET_MODULES) \
*************** gcc-no-fixedincludes:
*** 1191,1196 ****
--- 1207,1312 ----
  	  mv gcc/tmp-include gcc/include 2>/dev/null; \
  	else true; fi
  
+ # This rule is used to build the modules which are built with the
+ # build machine's native compiler.
+ .PHONY: $(ALL_BUILD_MODULES)
+ $(ALL_BUILD_MODULES):
+ 	dir=`echo $@ | sed -e 's/all-build-//'`; \
+ 	if [ -f ./$${dir}/Makefile ] ; then \
+ 	  r=`pwd`; export r; \
+ 	  s=`cd $(srcdir); pwd`; export s; \
+ 	  (cd $(BUILD_SUBDIR)/$${dir} && $(MAKE) all); \
+ 	else \
+ 	  true; \
+ 	fi
+ 
+ # This rule is used to configure the modules which are built with the
+ # native tools.
+ .PHONY: $(CONFIGURE_BUILD_MODULES)
+ $(CONFIGURE_BUILD_MODULES):
+ 	@dir=`echo $@ | sed -e 's/configure-build-//'`; \
+ 	if [ ! -d $(BUILD_SUBDIR) ]; then \
+ 	  true; \
+ 	elif [ -f $(BUILD_SUBDIR)/$${dir}/Makefile ] ; then \
+ 	  true; \
+ 	elif echo " $(BUILD_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
+ 	  if [ -d $(srcdir)/$${dir} ]; then \
+ 	    [ -d $(BUILD_SUBDIR)/$${dir} ] || mkdir $(BUILD_SUBDIR)/$${dir};\
+ 	    r=`pwd`; export r; \
+ 	    s=`cd $(srcdir); pwd`; export s; \
+ 	    AR="$(AR_FOR_BUILD)"; export AR; \
+ 	    AS="$(AS_FOR_BUILD)"; export AS; \
+ 	    CC="$(CC_FOR_BUILD)"; export CC; \
+ 	    CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+ 	    CXX="$(CXX_FOR_BUILD)"; export CXX; \
+ 	    CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+ 	    GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
+ 	    DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
+ 	    LD="$(LD_FOR_BUILD)"; export LD; \
+             LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
+ 	    NM="$(NM_FOR_BUILD)"; export NM; \
+ 	    RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
+ 	    WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
+ 	    echo Configuring in $(BUILD_SUBDIR)/$${dir}; \
+ 	    cd "$(BUILD_SUBDIR)/$${dir}" || exit 1; \
+ 	    case $(srcdir) in \
+ 	    /* | [A-Za-z]:[\\/]*) \
+ 	      topdir=$(srcdir) ;; \
+ 	    *) \
+ 	      case "$(BUILD_SUBDIR)" in \
+ 	      .) topdir="../$(srcdir)" ;; \
+ 	      *) topdir="../../$(srcdir)" ;; \
+ 	      esac ;; \
+ 	    esac; \
+ 	    if [ "$(srcdir)" = "." ] ; then \
+ 	      if [ "$(BUILD_SUBDIR)" != "." ] ; then \
+ 		if $(SHELL) $$s/symlink-tree $${topdir}/$${dir} "no-such-file" ; then \
+ 		  if [ -f Makefile ]; then \
+ 		    if $(MAKE) distclean; then \
+ 		      true; \
+ 		    else \
+ 		      exit 1; \
+ 		    fi; \
+ 		  else \
+ 		    true; \
+ 		  fi; \
+ 		else \
+ 		  exit 1; \
+ 		fi; \
+ 	      else \
+ 		true; \
+ 	      fi; \
+ 	      srcdiroption="--srcdir=."; \
+ 	      libsrcdir="."; \
+ 	    else \
+ 	      srcdiroption="--srcdir=$${topdir}/$${dir}"; \
+ 	      libsrcdir="$$s/$${dir}"; \
+ 	    fi; \
+ 	    if [ -f $${libsrcdir}/configure ] ; then \
+ 	      rm -f no-such-file skip-this-dir; \
+ 	      CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+ 		$(CONFIG_ARGUMENTS) $${srcdiroption} \
+ 		--with-target-subdir="$(TARGET_SUBDIR)"; \
+ 	    else \
+ 	      rm -f no-such-file skip-this-dir; \
+ 	      CONFIG_SITE=no-such-file $(SHELL) $$s/configure \
+ 		$(CONFIG_ARGUMENTS) $${srcdiroption} \
+ 		--with-target-subdir="$(TARGET_SUBDIR)"; \
+ 	    fi || exit 1; \
+ 	    if [ -f skip-this-dir ] ; then \
+ 	      sh skip-this-dir; \
+ 	      rm -f skip-this-dir; \
+ 	      cd ..; rmdir $${dir} || true; \
+ 	    else \
+ 	      true; \
+ 	    fi; \
+ 	  else \
+ 	    true; \
+ 	  fi; \
+ 	else \
+ 	  true; \
+ 	fi
+ 
  # This rule is used to build the modules which use FLAGS_TO_PASS.  To
  # build a target all-X means to cd to X and make all.
  #
*************** configure-target-libgloss: $(ALL_GCC)
*** 1639,1644 ****
--- 1755,1763 ----
  all-target-libgloss: configure-target-libgloss configure-target-newlib
  all-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl
  all-libiberty:
+ 
+ all-build-libiberty: configure-build-libiberty
+ 
  configure-target-libffi: $(ALL_GCC_C) 
  all-target-libffi: configure-target-libffi
  configure-target-libjava: $(ALL_GCC_CXX) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-libffi
Index: configure
===================================================================
RCS file: /cvs/gcc/gcc/configure,v
retrieving revision 1.36
diff -p -3 -r1.36 configure
*** configure	2001/05/23 17:24:49	1.36
--- configure	2001/07/10 02:58:37
*************** else
*** 1086,1091 ****
--- 1086,1097 ----
  	GDB_TK=""
  fi
  
+ all_build_modules=
+ if test x"${build_alias}" != x"${host_alias}"
+ then
+   all_build_modules='$(ALL_BUILD_MODULES_LIST)'
+ fi
+ 
  for subdir in . ${subdirs} ; do
  
      # ${subdir} is relative path from . to the directory we're currently
*************** EOF
*** 1382,1387 ****
--- 1388,1394 ----
                      -e "s|^oldincludedir[ 	]*=.*$|oldincludedir = ${oldincludedir}|" \
                      -e "s|^infodir[ 	]*=.*$|infodir = ${infodir}|" \
                      -e "s|^mandir[ 	]*=.*$|mandir = ${mandir}|" \
+ 		    -e "s|^ALL_BUILD_MODULES =.*|ALL_BUILD_MODULES =${all_build_modules}|" \
  		    -e "/^CC[ 	]*=/{
  			:loop1
  			/\\\\$/ N
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.106
diff -p -3 -r1.106 configure.in
*** configure.in	2001/06/01 09:14:43	1.106
--- configure.in	2001/07/10 02:58:38
*************** if [ ! -d ${target_subdir} ] ; then
*** 445,450 ****
--- 445,462 ----
    fi
  fi
  
+ build_subdir=${build_alias}
+ 
+ if [ x"${build_alias}" != x"${host}" ] ; then
+   if [ ! -d ${build_subdir} ] ; then
+     if mkdir ${build_subdir} ; then true
+     else
+       echo "'*** could not make ${PWD=`pwd`}/${build_subdir}" 1>&2
+       exit 1
+     fi
+   fi
+ fi
+ 
  copy_dirs=
  
  # Handle --with-headers=XXX.  The contents of the named directory are
*************** sed -e "s:^TARGET_CONFIGDIRS[ 	]*=.*$:TA
*** 1523,1528 ****
--- 1535,1541 ----
      -e "s%^CXX_FOR_TARGET[ 	]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%" \
      -e "s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[ 	]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = ${qqCXX_FOR_TARGET}%" \
      -e "s%^TARGET_SUBDIR[ 	]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
+     -e "s%^BUILD_SUBDIR[ 	]*=.*$%BUILD_SUBDIR = ${build_subdir}%" \
      -e "s%^gxx_include_dir[ 	]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
         Makefile > Makefile.tem
  rm -f Makefile


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