This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


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

Patch for newlib/Makefile.am


This patch corrects the way newlib/Makefile.am passes
information to subordinate Makefiles.

This patch is the results of discussions on the RTEMS list
with some feedback from Ian Lance Taylor.   We tripped this
while trying to build distributable tool binaries for various
hosts.  In particular, the override of $prefix during 
"make install" by RPMs tripped problems.

Ralf's explanation and part of an email thread when I 
asked him to refresh my memory follow:

------------

They are multilib related bug fixes to newlib:

1. INSTALL can be a relative path to $(top_srcdir)/install.sh, so
passing INSTALL=$(INSTALL) will incorrectly override the correct
autoconf detected values inside of the Makefiles. This bug rarely is
visible, because on most hosts another install but install-sh will
get used.

Deinstall install on you build host and you'll probably see this
issue.

2. If not adding AM_MAKEFLAGS to FLAGS_TO_PASS, they will get lost
and multilibs will not get installed correctly. - I have just found
the relevant mail from an discussion with Ian (forward will follow)
-------------------
Ian's Mail...

> 
>          Ian Lance Taylor <ian@zembu.com>
>                                                                      10/21/99 23:50
> 
>  Subject: 
>          Re: [Fwd: newlib does not honor overriding $prefix]
>      To: 
>          corsepiu@faw.uni-ulm.de
>      CC: 
>          joel.sherrill@OARcorp.com
> 
> 
> 
>    Date: Fri, 22 Oct 1999 01:57:33 +0200
>    From: Ralf Corsepius <corsepiu@faw.uni-ulm.de>
> 
>    * Later we try to install to /tmp/opt/rtems using this:
> 
>    make prefix=/tmp/opt/rtems install
> 
>    Now the observation is that all files except newlib's multilibs get
>    installed to /tmp/opt/rtems.
> 
>    I assume that $prefix might get lost somewhere between
>    build/<target_alias>/newlib/Makefile.am, probably in multi-do, ie. in
>    config-ml.in generated parts of newlib/Makefile.
> 
>    If I add this patch to gcc-2.95.1/config-ml.in
> 
>    --- gcc-2.95.1.orig/config-ml.in        Tue Apr 13 16:46:07 1999
>    +++ gcc-2.95.1/config-ml.in     Thu Oct 21 16:48:13 1999
>    @@ -430,6 +430,7 @@
>                  if [ -d ../$${dir}/$${lib} ]; then \
>                    flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
>                    if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
>    +                               prefix="$(prefix)" \
>                                    CFLAGS="$(CFLAGS) $${flags}" \
>                                    CXXFLAGS="$(CXXFLAGS) $${flags}" \
>                                    LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
> 
> 
>    all newlib's multilibed libraries get correctly installed to /tmp/opt/rtems
>    when using "make prefix=/tmp/opt/rtems install".
> 
>    I assume this might not the correct fix, but it may give you some indication
>    on what might be going wrong.
> 
>    My gut feeling is telling me that AM_MAKEFLAGS possibly should be passed to
>    MAKE in multi-do (the fragment generated by the stanza from config-ml.in
>    above) in newlib/Makefile.am. At least adding FLAGS_TO_PASS=$(AM_MAKEFLAGS)
>    to newlib/Makefile.am also seems to fix our problem.
> 
> GNU make normally passes down command line arguments automatically in
> the definition of $(MAKE).  So ordinarily the recursive invocation
> would include the command line definition of prefix.  However, the
> newlib Makefile.am file sets MAKEOVERRIDES, which prevents this.
> There was some good reason to set this, but I no longer remember what
> it was.
> 
> I think that setting FLAGS_TO_PASS in newlib/Makefile.am, as you
> suggest, is the right fix.
> 
> Ian
> 
=======================================

And now the ChangeLog entry:

2000-12-06      Ralf Corsepius <corsepiu@faw.uni-ulm.de>

        * Makefile.am: $(INSTALL), $(INSTALL_DATA), and
$(INSTALL_PROGRAM)  
        can be a relative path to $(top_srcdir)/install.sh so ensure the
        autoconf detected settings are properly passed recursively.
        Similarly, add AM_MAKEFLAGS to FLAGS_TO_PASS so they also get
passed
        properly to subdirectories.



-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985
Index: newlib/Makefile.am
===================================================================
RCS file: /cvs/src/src/newlib/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- Makefile.am	2000/09/06 20:46:27	1.3
+++ Makefile.am	2000/12/01 13:20:16
@@ -19,10 +19,6 @@
 	"CFLAGS=$(CFLAGS)" \
 	"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
 	"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
-	"INSTALL=$(INSTALL)" \
-	"INSTALL_DATA=$(INSTALL_DATA)" \
-	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
-	"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
 	"LDFLAGS=$(LDFLAGS)" \
 	"LIBCFLAGS=$(LIBCFLAGS)" \
 	"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
@@ -49,6 +45,8 @@
 	"RANLIB=$(RANLIB)" \
 	"DESTDIR=$(DESTDIR)"
 
+FLAGS_TO_PASS=$(AM_MAKEFLAGS)
+
 if HAVE_DOC
 DOCDIR = doc
 endif

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