Patch: create a BUILD libiberty.a

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Mon Feb 14 13:54:00 GMT 2000


	I got annoyed enough to finally try writing this. :-)

(There are lots of subtleties in the top level Makefile which I don't
quite get.  So comments would be appreciated.)

Once this goes in, we can clean up all the cruft in the build programs.

Okay to install?

		--Kaveh



2000-02-14  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* Makefile.in (CLEAN_MODULES): Add clean-build-libiberty.
	(bootstrap, all-bootstrap, all-libiberty): Add all-build-libiberty.
	(configure-build-libiberty, all-build-libiberty): New targets.

gcc:
	* aclocal.m4 (AC_GCC_FUNC_DOPRNT): Renamed from
	GCC_FUNC_VFPRINTF_DOPRNT.  Don't set `vfprintf' anymore.
	
	* configure.in: Call AC_GCC_FUNC_DOPRNT.

	* Makefile.in: Remove all references to obstack and vfprintf.
	(LIBS): Move CLIB last.
	(HOST_LIBS): Add ../build-libiberty/libiberty.a.

diff -rup orig/egcs-CVS20000213/Makefile.in egcs-CVS20000213/Makefile.in
--- orig/egcs-CVS20000213/Makefile.in	Sat Feb  5 23:21:57 2000
+++ egcs-CVS20000213/Makefile.in	Mon Feb 14 10:57:19 2000
@@ -876,6 +876,7 @@ CLEAN_MODULES = \
 	clean-ld \
 	clean-libgui \
 	clean-libiberty \
+	clean-build-libiberty \
 	clean-libtool \
 	clean-m4 \
 	clean-make \
@@ -1461,7 +1462,7 @@ all-gcc:
 # in parallel.
 #
 .PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean
-bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
+bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-texinfo all-bison all-byacc all-binutils all-gas all-ld all-build-libiberty
 	@r=`pwd`; export r; \
 	s=`cd $(srcdir); pwd`; export s; \
 	$(SET_LIB_PATH) \
@@ -1586,7 +1587,7 @@ all-gash: all-tcl
 all-gawk:
 ALL_GCC = all-gcc
 all-gcc: all-bison all-byacc all-binutils all-gas all-ld
-all-bootstrap: all-libiberty all-bison all-byacc all-binutils all-gas all-ld
+all-bootstrap: all-libiberty all-build-libiberty all-bison all-byacc all-binutils all-gas all-ld
 GDB_TK = all-tk all-tcl all-itcl all-tix all-libgui
 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
 all-gettext:
@@ -1614,7 +1615,7 @@ configure-target-libio: $(ALL_GCC)
 all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
 check-target-libio: all-target-libstdc++
 all-libgui: all-tcl all-tk all-itcl
-all-libiberty:
+all-libiberty: all-build-libiberty
 configure-target-libjava: $(ALL_GCC) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-newlib
 all-target-libjava: configure-target-libjava all-gcc all-zip all-target-newlib all-target-zlib all-target-boehm-gc all-target-qthreads
 configure-target-librx: $(ALL_GCC) configure-target-newlib
@@ -1853,5 +1854,40 @@ newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_
 
 .NOEXPORT:
 MAKEOVERRIDES=
+
+configure-build-libiberty:
+	@if [ ! -d build-libiberty ] ; then mkdir build-libiberty ; fi ; \
+	if [ ! -f build-libiberty/stmp-configure ] ; then \
+	cd build-libiberty ; \
+	case $(srcdir) in \
+	  /*) topdir="$(srcdir)" ; srcdiroption="--srcdir=$${topdir}/libiberty" ;; \
+	  .)  topdir="../$(srcdir)" ; srcdiroption="--srcdir=$${topdir}/build-libiberty" ;; \
+	  *)  topdir="../$(srcdir)" ; srcdiroption="--srcdir=$${topdir}/libiberty" ;; \
+	esac ; \
+	if $(SHELL) $$topdir/symlink-tree $$topdir/libiberty ; then \
+	  if [ -f Makefile ]; then \
+	    if $(MAKE) distclean; then \
+	      true; \
+	    else \
+	      exit 1; \
+	    fi; \
+	  else \
+	    true; \
+	  fi; \
+	else \
+	  exit 1; \
+	fi; \
+	set -x ; \
+	if $(SHELL) configure $(CONFIG_ARGUMENTS) $${srcdiroption} ; \
+	then \
+	  touch stmp-configure ; \
+	else \
+	  exit 1 ; \
+	fi ; \
+	fi
+
+all-build-libiberty: configure-build-libiberty
+	cd build-libiberty ; \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) CC=$(HOST_CC) all
 
 # end of Makefile.in
diff -rup orig/egcs-CVS20000213/gcc/aclocal.m4 egcs-CVS20000213/gcc/aclocal.m4
--- orig/egcs-CVS20000213/gcc/aclocal.m4	Sun Jan 16 15:46:29 2000
+++ egcs-CVS20000213/gcc/aclocal.m4	Mon Feb 14 10:24:48 2000
@@ -65,19 +65,15 @@ GCC_NEED_DECLARATION($ac_func, $2)
 done
 ])
 
-dnl Check if we have vprintf and possibly _doprnt.
-dnl Note autoconf checks for vprintf even though we care about vfprintf.
-AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
+dnl Check if we have _doprnt, but only if vprintf is missing.
+AC_DEFUN(AC_GCC_FUNC_DOPRNT,
 [AC_FUNC_VPRINTF
-vfprintf=
 doprint=
 if test $ac_cv_func_vprintf != yes ; then
-  vfprintf=vfprintf.o
   if test $ac_cv_func__doprnt != yes ; then
     doprint=doprint.o
   fi
 fi
-AC_SUBST(vfprintf)
 AC_SUBST(doprint)
 ])    
 
diff -rup orig/egcs-CVS20000213/gcc/configure.in egcs-CVS20000213/gcc/configure.in
--- orig/egcs-CVS20000213/gcc/configure.in	Fri Feb 11 17:12:55 2000
+++ egcs-CVS20000213/gcc/configure.in	Mon Feb 14 10:25:01 2000
@@ -384,7 +384,7 @@ AC_CHECK_FUNCS(strtoul bsearch strerror 
 # Make sure wchar_t is available
 #AC_CHECK_TYPE(wchar_t, unsigned int)
 
-GCC_FUNC_VFPRINTF_DOPRNT
+AC_GCC_FUNC_DOPRNT
 GCC_FUNC_PRINTF_PTR
 
 case "${host}" in
diff -rup orig/egcs-CVS20000213/gcc/Makefile.in egcs-CVS20000213/gcc/Makefile.in
--- orig/egcs-CVS20000213/gcc/Makefile.in	Fri Feb 11 17:12:52 2000
+++ egcs-CVS20000213/gcc/Makefile.in	Mon Feb 14 10:28:51 2000
@@ -312,18 +312,13 @@ INTL_SUBDIRS = intl $(POSUB)
 # Additional system libraries to link with.
 CLIB=
 
-# Change this to a null string if obstacks are installed in the
-# system library.
-OBSTACK=obstack.o
-
 # The GC method to be used on this system.
 GGC=@GGC@.o
 
 # If a supplementary library is being used for the GC.
 GGC_LIB=
 
-# Configure will set these if you need vfprintf and possibly _doprnt support.
-VFPRINTF=@vfprintf@
+# Configure will set this if you need _doprnt support.
 DOPRINT=@doprint@
 
 # Specify the rule for actually making libgcc.a,
@@ -465,8 +460,6 @@ HOST_LDFLAGS=$(LDFLAGS)
 HOST_CPPFLAGS=$(ALL_CPPFLAGS)
 HOST_ALLOCA=$(ALLOCA)
 HOST_MALLOC=$(MALLOC)
-HOST_OBSTACK=$(OBSTACK)
-HOST_VFPRINTF=$(VFPRINTF)
 HOST_DOPRINT=$(DOPRINT)
 
 # Actual name to use when installing a native compiler.
@@ -555,29 +548,26 @@ ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS)
 USE_ALLOCA= ${ALLOCA}
 USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
 USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
-USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
-USE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac `
 USE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac `
 
-# Dependency on obstack, alloca, malloc or whatever library facilities
+# Dependency on alloca, malloc or whatever library facilities
 # are not installed in the system libraries.
 # We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
-LIBDEPS= $(INTLLIBS) $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT)
+LIBDEPS= $(INTLLIBS) $(ALLOCA) $(MALLOC) $(DOPRINT)
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
 # We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
-HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_INTLLIBS) $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT)
+HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_INTLLIBS) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_DOPRINT)
 
 # How to link with both our special library facilities
 # and the system's installed libraries.
-LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(INTLLIBS) @LIBS@ $(VFPRINTF) $(DOPRINT) $(CLIB) ../libiberty/libiberty.a
+LIBS = $(USE_ALLOCA) $(MALLOC) $(INTLLIBS) @LIBS@ $(DOPRINT) ../libiberty/libiberty.a $(CLIB)
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
-HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC)  \
-	    $(HOST_INTLLIBS) $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) \
-	    $(HOST_CLIB)
+HOST_LIBS = $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) $(HOST_INTLLIBS) \
+	$(USE_HOST_DOPRINT) ../build-libiberty/libiberty.a $(HOST_CLIB)
 
 HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o $(HOST_PREFIX)ggc-none.o
 HOST_PRINT = $(HOST_PREFIX)print-rtl.o
@@ -1379,11 +1369,6 @@ collect2.o : collect2.c $(CONFIG_H) syst
 tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h collect2.h
 hash.o: hash.c hash.h system.h toplev.h
 
-vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h
-	rm -f vfprintf.c
-	$(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c
-	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) vfprintf.c
-
 splay-tree.o: $(srcdir)/../libiberty/splay-tree.c \
   $(srcdir)/../include/splay-tree.h $(srcdir)/../include/libiberty.h
 	rm -f splay-tree.c
@@ -1461,11 +1446,6 @@ ggc-none.o: ggc-none.c $(CONFIG_H) $(RTL
 
 ggc-callbacks.o: ggc-callbacks.c $(CONFIG_H) $(RTL_H) $(TREE_H) ggc.h
 
-obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
-	rm -f obstack.c
-	$(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
-	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c
-
 prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 	-DPREFIX=\"$(prefix)\" \
@@ -1923,16 +1903,6 @@ $(HOST_PREFIX_1)alloca.o: $(srcdir)/../l
 	$(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c
 	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
 
-$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
-	rm -f $(HOST_PREFIX)obstack.c
-	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c
-	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
-
-$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c
-	rm -f $(HOST_PREFIX)vfprintf.c
-	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c
-	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c
-
 $(HOST_PREFIX_1)doprint.o: doprint.c
 	rm -f $(HOST_PREFIX)doprint.c
 	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c
@@ -2340,7 +2310,6 @@ mostlyclean: $(INTL_MOSTLYCLEAN) lang.mo
 # Delete the temporary source copies for cross compilation.
 	-rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
 	-rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
-	-rm -f $(HOST_PREFIX_1)obstack.c
 # Delete the temp files made in the course of building libgcc.a.
 	-rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
 	for name in $(LIB1FUNCS); do rm -f $${name}.c; done


More information about the Gcc-patches mailing list