make install-strip with binutils

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

make install-strip with binutils

NightStrike
I noticed that there is no install-strip target in the binutils
Makefile.  How do you install stripped versions of the binutils
package?  What's the official approved way to do this, ideally without
resorting to manually running strip?
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ralf Wildenhues
Hello,

* NightStrike wrote on Fri, Oct 22, 2010 at 06:33:17PM CEST:
> I noticed that there is no install-strip target in the binutils
> Makefile.  How do you install stripped versions of the binutils
> package?  What's the official approved way to do this, ideally without
> resorting to manually running strip?

I don't think there is an official approved way yet.  It should be
possible to add forwarders to toplevel Makefile.tpl and Makefile.def,
and add targets to the non-automake-governed sub directories of the
combined GCC/src tree, but you'd need to take care to pass the right
strip program (for host or for target, possibly the in-tree strip).

Hope that helps.

Cheers,
Ralf
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

NightStrike
On Sat, Oct 23, 2010 at 5:59 AM, Ralf Wildenhues <[hidden email]> wrote:
> Hello,
>
> * NightStrike wrote on Fri, Oct 22, 2010 at 06:33:17PM CEST:
>> I noticed that there is no install-strip target in the binutils
>> Makefile.  How do you install stripped versions of the binutils
>> package?  What's the official approved way to do this, ideally without
>> resorting to manually running strip?
>
> I don't think there is an official approved way yet.

Isn't install-strip a required make target for gnu programs?

> It should be
> possible to add forwarders to toplevel Makefile.tpl and Makefile.def,
> and add targets to the non-automake-governed sub directories of the
> combined GCC/src tree, but you'd need to take care to pass the right
> strip program (for host or for target, possibly the in-tree strip).

I.... have no idea how to do that :)


'strip /bin/*' it is, then :)
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ian Lance Taylor-3
NightStrike <[hidden email]> writes:

> On Sat, Oct 23, 2010 at 5:59 AM, Ralf Wildenhues <[hidden email]> wrote:
>> Hello,
>>
>> * NightStrike wrote on Fri, Oct 22, 2010 at 06:33:17PM CEST:
>>> I noticed that there is no install-strip target in the binutils
>>> Makefile.  How do you install stripped versions of the binutils
>>> package?  What's the official approved way to do this, ideally without
>>> resorting to manually running strip?
>>
>> I don't think there is an official approved way yet.
>
> Isn't install-strip a required make target for gnu programs?

Yes.  We are out of GNU standard compliance there.

>> It should be
>> possible to add forwarders to toplevel Makefile.tpl and Makefile.def,
>> and add targets to the non-automake-governed sub directories of the
>> combined GCC/src tree, but you'd need to take care to pass the right
>> strip program (for host or for target, possibly the in-tree strip).
>
> I.... have no idea how to do that :)

Edit the top level Makefile.tpl and Makefile.def files.  Copy a similar
target--say, install-pdf.  Run "autogen Makefile.def".  Test.

Ian
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Maciej W. Rozycki
On Sat, 23 Oct 2010, Ian Lance Taylor wrote:

> >> It should be
> >> possible to add forwarders to toplevel Makefile.tpl and Makefile.def,
> >> and add targets to the non-automake-governed sub directories of the
> >> combined GCC/src tree, but you'd need to take care to pass the right
> >> strip program (for host or for target, possibly the in-tree strip).
> >
> > I.... have no idea how to do that :)
>
> Edit the top level Makefile.tpl and Makefile.def files.  Copy a similar
> target--say, install-pdf.  Run "autogen Makefile.def".  Test.

 Automake should be doing The Right Thing wrt cross-stripping binaries.  
As binutils do not build any target binaries that should be enough, but
our top level is meant to be used with more complex setups and should be
capable of handling GCC and src trees combined.  Therefore as Ralf
mentioned, support for using in-tree strip may be needed; I reckon the
scripts are already capable of doing this for other tools so things may be
as easy as copying & pasting the existing bits.  Then again, maybe not. ;)

  Maciej
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ralf Wildenhues
* Maciej W. Rozycki wrote on Sun, Oct 24, 2010 at 06:03:47AM CEST:
> On Sat, 23 Oct 2010, Ian Lance Taylor wrote:
> > >> It should be
> > >> possible to add forwarders to toplevel Makefile.tpl and Makefile.def,
> > >> and add targets to the non-automake-governed sub directories of the
> > >> combined GCC/src tree, but you'd need to take care to pass the right
> > >> strip program (for host or for target, possibly the in-tree strip).
> > >
> > > I.... have no idea how to do that :)

Since there's nobody jumping on this, and I currently lack time,
NightStrike please open a GCC or binutils PR and Cc: me on it.  Thanks.

Cheers,
Ralf
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

NightStrike
On Wed, Oct 27, 2010 at 2:29 PM, Ralf Wildenhues <[hidden email]> wrote:

> * Maciej W. Rozycki wrote on Sun, Oct 24, 2010 at 06:03:47AM CEST:
>> On Sat, 23 Oct 2010, Ian Lance Taylor wrote:
>> > >> It should be
>> > >> possible to add forwarders to toplevel Makefile.tpl and Makefile.def,
>> > >> and add targets to the non-automake-governed sub directories of the
>> > >> combined GCC/src tree, but you'd need to take care to pass the right
>> > >> strip program (for host or for target, possibly the in-tree strip).
>> > >
>> > > I.... have no idea how to do that :)
>
> Since there's nobody jumping on this, and I currently lack time,
> NightStrike please open a GCC or binutils PR and Cc: me on it.  Thanks.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46202
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ralf Wildenhues
[ adding gcc-patches, gdb-patches ]

* NightStrike wrote on Wed, Oct 27, 2010 at 11:08:51PM CEST:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46202

Tested GCC in non-cross setup on i686-pc-linux-gnu, also tested
binutils+gdb as well as combined tree (to ensure in-tree strip is
used).  I'm fairly certain the cross setup should work as well, as the
toplevel should be using STRIP_FOR_TARGET correctly, but if somebody
could test that for me that would be nice.  Tested 'make info pdf html'
for the docs.  There is also a patch for wwwdocs.

For the moment, the non-libtool libraries are not stripped, while
libtool will --strip-debug its static libraries and --strip-unneeded its
shared libraries if 'strip' is GNU.  I don't plan to work on the
non-libtool libraries.

OK to commit to GCC and sync to src?  The patch has src-specific bits in
etc/.  install-strip will fail for parts of the src tree outside of
binutils+gdb, but fixing that should be straight-forward.

I'll gladly split the .PHONY fixlets and the minor gcc/doc cleanups in
separate patches if you prefer.

If somebody knows the autogen machinery well enough for the lisp part of
Makefile.tpl to generate the install-strip-* dependencies from the
non-strip ones (rather than duplicating them manually in Makefile.def),
I'd appreciate a hint.  The duplication is not too bad yet though.

Startup files $libdir/gcc/$target/$version/$MULTISUBDIR/crt*.o are not
stripped.  The only other files reported as 'not stripped' by the 'file'
program are the $libdir/libgcj_bc.so.1.0.0 ones, and IIUC they are
almost-empty stub libraries where 'file' detection is off.

Note that I found a minor bug in the automake-generated install-strip
rule that causes a failure when you override STRIP with more than word,
e.g., STRIP='strip --verbose';
<http://thread.gmane.org/gmane.comp.sysutils.automake.patches/4890>

Thanks,
Ralf

bits only for src:

etc/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        * Makefile.in (install-strip): New target.

diff --git a/etc/Makefile.in b/etc/Makefile.in
index e910ad4..0d19c13 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -64,7 +64,7 @@ PDFFILES = standards.pdf configure.pdf
 HTMLFILES = standards.html configure.html
 
 all: info
-install: install-info
+install install-strip: install-info
 
 uninstall:
 


gcc www update:

--- htdocs/gcc-4.6/changes.html 2 Nov 2010 04:54:56 -0000 1.54
+++ htdocs/gcc-4.6/changes.html 2 Nov 2010 20:05:56 -0000
@@ -351,5 +351,15 @@
 
 <h2>Other significant improvements</h2>
 
+<h3>Installation changes</h3>
+
+  <ul>
+    <li>
+    An <code>install-strip</code> <code>make</code> target is provided
+    that installs stripped executables, and may install libraries with
+    unneeded or debugging sections stripped.
+    </li>
+  </ul>
+
 </body>
 </html>



bits for GCC and shared GCC/src bits:

PR other/46202: implement install-strip.

ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * configure.ac: Fix just-built in-tree STRIP name to be
        binutils/strip-new.
        * configure: Regenerate.
        * Makefile.def (install-strip-gcc, install-strip-binutils)
        (install-strip-opcodes, install-strip-ld, install-strip-itcl)
        (install-strip-sid): Mirror dependencies on non-strip variants
        of these targets on the respective -strip prerequisites.
        * Makefile.tpl (install-strip, install-strip-host)
        (install-strip-target): New targets.
        (install-strip-[+module+], install-strip-target-[+module+]):
        New targets.
        * Makefile.in: Regenerate.

gcc/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * Makefile.in (install_sh, INSTALL_STRIP_PROGRAM): New
        variables.
        (AR_FOR_TARGET, RANLIB_FOR_TARGET, STRIP_FOR_TARGET): Fix
        shell quoting.
        (STRIP_FOR_TARGET): Look for in-tree strip under name strip-new.
        (install-strip): New target.
        * doc/install.texi (Final install): Minor markup and code style
        fixes.  Document install-strip target.

fixincludes/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * Makefile.in (install-strip): New phony target.
        (all, check, install): Also mark as phony.

libgcc/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * Makefile.in (install-strip): New phony target.

libiberty/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * Makefile.in (install-strip): New phony target.
        (install): Also mark as phony.

gnattools/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * Makefile.in (install-strip): New phony target.
        (check, installcheck, info, dvi, pdf, html, install)
        (install-info, install-pdf, install-html, mostlyclean)
        (clean, distclean, maintainer-clean): Mark phony.

libada/ChangeLog:
2010-11-01  Ralf Wildenhues  <[hidden email]>

        PR other/46202
        * Makefile.in (install-strip): New phony target.
        (check, installcheck, info, dvi, pdf, html, install)
        (install-info, install-pdf, install-html, mostlyclean)
        (clean, distclean, maintainer-clean): Mark phony.

diff --git a/Makefile.def b/Makefile.def
index 6223bf3..279261f 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -346,6 +346,7 @@ dependencies = { module=dvi-gcc; on=all-build-libiberty; };
 dependencies = { module=pdf-gcc; on=all-build-libiberty; };
 dependencies = { module=html-gcc; on=all-build-libiberty; };
 dependencies = { module=install-gcc ; on=install-fixincludes; };
+dependencies = { module=install-strip-gcc ; on=install-strip-fixincludes; };
 
 dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; };
 dependencies = { module=configure-libcpp; on=configure-intl; };
@@ -407,9 +408,11 @@ dependencies = { module=all-binutils; on=all-intl; };
 // binutils might be on PATH, and they might need the shared opcodes
 // library.
 dependencies = { module=install-binutils; on=install-opcodes; };
+dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
 
 // libopcodes depends on libbfd
 dependencies = { module=install-opcodes; on=install-bfd; };
+dependencies = { module=install-strip-opcodes; on=install-strip-bfd; };
 
 dependencies = { module=configure-gas; on=configure-intl; };
 dependencies = { module=all-gas; on=all-libiberty; };
@@ -430,6 +433,7 @@ dependencies = { module=all-ld; on=all-build-byacc; };
 dependencies = { module=all-ld; on=all-build-flex; };
 dependencies = { module=all-ld; on=all-intl; };
 dependencies = { module=install-ld; on=install-gold; };
+dependencies = { module=install-strip-ld; on=install-strip-gold; };
 dependencies = { module=configure-gold; on=configure-intl; };
 dependencies = { module=all-gold; on=all-libiberty; };
 dependencies = { module=all-gold; on=all-intl; };
@@ -460,6 +464,7 @@ dependencies = { module=configure-itcl; on=configure-tk; };
 dependencies = { module=all-itcl; on=all-tcl; };
 dependencies = { module=all-itcl; on=all-tk; };
 dependencies = { module=install-itcl; on=install-tcl; };
+dependencies = { module=install-strip-itcl; on=install-strip-tcl; };
 
 dependencies = { module=configure-tk; on=configure-tcl; };
 dependencies = { module=all-tk; on=all-tcl; };
@@ -470,7 +475,9 @@ dependencies = { module=all-sid; on=all-opcodes; };
 dependencies = { module=all-sid; on=all-tcl; };
 dependencies = { module=all-sid; on=all-tk; };
 dependencies = { module=install-sid; on=install-tcl; };
+dependencies = { module=install-strip-sid; on=install-strip-tcl; };
 dependencies = { module=install-sid; on=install-tk; };
+dependencies = { module=install-strip-sid; on=install-strip-tk; };
 
 dependencies = { module=configure-sim; on=configure-intl; };
 dependencies = { module=all-sim; on=all-intl; };
diff --git a/Makefile.tpl b/Makefile.tpl
index 4c55ee2..cc1d2ac 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -878,6 +878,26 @@ install.all: install-no-fixedincludes
 install-no-fixedincludes: installdirs install-host-nogcc \
  install-target gcc-no-fixedincludes
 
+.PHONY: install-strip
+install-strip:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
+
+.PHONY: install-strip-host
+install-strip-host: [+
+  FOR host_modules +] \
+    maybe-install-strip-[+module+][+
+  ENDFOR host_modules +]
+
+.PHONY: install-strip-target
+install-strip-target: [+
+  FOR target_modules +] \
+    maybe-install-strip-target-[+module+][+
+  ENDFOR target_modules +]
+
+
 ### other supporting targets
 
 MAKEDIRS= \
@@ -1163,6 +1183,23 @@ install-[+module+]: installdirs
 [+ ENDIF no_install +]
 @endif [+module+]
 
+.PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
+maybe-install-strip-[+module+]:
+@if [+module+]
+maybe-install-strip-[+module+]: install-strip-[+module+]
+[+ IF no_install +]
+install-strip-[+module+]:
+[+ ELSE install +]
+install-strip-[+module+]: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(HOST_EXPORTS) \
+ (cd $(HOST_SUBDIR)/[+module+] && \
+  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
+[+ ENDIF no_install +]
+@endif [+module+]
+
 # Other targets (info, dvi, pdf, etc.)
 [+ FOR recursive_targets +]
 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
@@ -1275,6 +1312,28 @@ ENDIF raw_cxx +]
 [+ ENDIF no_install +]
 @endif target-[+module+]
 
+.PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
+maybe-install-strip-target-[+module+]:
+@if target-[+module+]
+maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
+[+ IF no_install +]
+# Dummy target for uninstallable.
+install-strip-target-[+module+]:
+[+ ELSE install +]
+install-strip-target-[+module+]: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
+IF raw_cxx +]
+ $(RAW_CXX_TARGET_EXPORTS) \[+
+ELSE normal_cxx +]
+ $(NORMAL_TARGET_EXPORTS) \[+
+ENDIF raw_cxx +]
+ (cd $(TARGET_SUBDIR)/[+module+] && \
+  $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
+[+ ENDIF no_install +]
+@endif target-[+module+]
+
 # Other targets (info, dvi, pdf, etc.)
 [+ FOR recursive_targets +]
 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
diff --git a/configure.ac b/configure.ac
index ac44863..a7ec467 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3343,7 +3343,7 @@ GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
 GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
 GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
 GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
-GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip])
+GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
 GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
 GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])
 
diff --git a/fixincludes/Makefile.in b/fixincludes/Makefile.in
index f91a70d..e335997 100644
--- a/fixincludes/Makefile.in
+++ b/fixincludes/Makefile.in
@@ -188,6 +188,11 @@ install : all
   $(DESTDIR)$(itoolsdir)/fixincl@EXEEXT@
  $(INSTALL_SCRIPT) mkheaders $(DESTDIR)$(itoolsdir)/mkheaders
 
+install-strip: install
+ test -z '$(STRIP)' \
+  || $(STRIP) $(DESTDIR)$(itoolsdir)/fixincl@EXEEXT@
+
+.PHONY: all check install install-strip
 .PHONY: dvi pdf info html install-pdf install-info install-html
 
 dvi :
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index a3493cf..aa03220 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -22,7 +22,7 @@
 #<http://www.gnu.org/licenses/>.
 
 # The targets for external use include:
-# all, doc, install, install-cross, install-cross-rest,
+# all, doc, install, install-cross, install-cross-rest, install-strip,
 # uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean.
 
 # This is the default target.
@@ -255,6 +255,8 @@ LN_S=@LN_S@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL@
+install_sh = $(SHELL) $(srcdir)/../install-sh
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 MAKEINFO = @MAKEINFO@
 MAKEINFOFLAGS = --no-split
 TEXI2DVI = texi2dvi
@@ -395,7 +397,7 @@ AR_FOR_TARGET := $(shell \
     if [ "$(host)" = "$(target)" ] ; then \
       echo $(AR); \
     else \
-       t='$(program_transform_name)'; echo ar | sed -e $$t ; \
+       t='$(program_transform_name)'; echo ar | sed -e "$$t" ; \
     fi; \
   fi)
 AR_FLAGS_FOR_TARGET =
@@ -410,20 +412,20 @@ RANLIB_FOR_TARGET := $(shell \
     if [ "$(host)" = "$(target)" ] ; then \
       echo $(RANLIB); \
     else \
-       t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
+       t='$(program_transform_name)'; echo ranlib | sed -e "$$t" ; \
     fi; \
   fi)
 ORIGINAL_LD_FOR_TARGET = @ORIGINAL_LD_FOR_TARGET@
 ORIGINAL_NM_FOR_TARGET = @ORIGINAL_NM_FOR_TARGET@
 NM_FOR_TARGET = ./nm
 STRIP_FOR_TARGET := $(shell \
-  if [ -f $(objdir)/../binutils/strip ] ; then \
-    echo $(objdir)/../binutils/strip ; \
+  if [ -f $(objdir)/../binutils/strip-new ] ; then \
+    echo $(objdir)/../binutils/strip-new ; \
   else \
     if [ "$(host)" = "$(target)" ] ; then \
       echo strip; \
     else \
-       t='$(program_transform_name)'; echo strip | sed -e $$t ; \
+       t='$(program_transform_name)'; echo strip | sed -e "$$t" ; \
     fi; \
   fi)
 
@@ -4464,7 +4466,7 @@ maintainer-clean:
  -rm -f gcc.??s gcc.*aux
  -rm -f $(gcc_docdir)/*.info $(gcc_docdir)/*.1 $(gcc_docdir)/*.7 $(gcc_docdir)/*.dvi $(gcc_docdir)/*.pdf
 #
-# Entry points `install' and `uninstall'.
+# Entry points `install', `install-strip', and `uninstall'.
 # Also use `install-collect2' to install collect2 when the config files don't.
 
 # Copy the compiler files into directories where they will be run.
@@ -4478,6 +4480,12 @@ ifeq ($(enable_plugin),yes)
 install: install-plugin
 endif
 
+install-strip: override INSTALL_PROGRAM = $(INSTALL_STRIP_PROGRAM)
+ifneq ($(STRIP),)
+install-strip: export STRIPPROG = $(STRIP)
+endif
+install-strip: install
+
 # Handle cpp installation.
 install-cpp: installdirs cpp$(exeext)
  -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
index 183e545..6395ff9 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -92,7 +92,7 @@ SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
 # libgcc.mk.  We want this delayed until actual install time.
 SHLIB_INSTALL = \
  $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
- $(INSTALL_PROGRAM) $(SHLIB_DIR)/$(SHLIB_SONAME) \
+ $(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \
   $$(DESTDIR)$$(bindir)/$(SHLIB_SONAME); \
  $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
   $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 877ae5f..98b3d38 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2638,7 +2638,7 @@ messages may be automatically processed.
 
 Now that GCC has been built (and optionally tested), you can install it with
 @smallexample
-cd @var{objdir}; make install
+cd @var{objdir} && make install
 @end smallexample
 
 We strongly recommend to install into a target directory where there is
@@ -2674,7 +2674,8 @@ jail can be achieved with the command
 make DESTDIR=@var{path-to-rootdir} install
 @end smallexample
 
-@noindent where @var{path-to-rootdir} is the absolute path of
+@noindent
+where @var{path-to-rootdir} is the absolute path of
 a directory relative to which all installation paths will be
 interpreted.  Note that the directory specified by @code{DESTDIR}
 need not exist yet; it will be created if necessary.
@@ -2688,6 +2689,12 @@ it will not be created otherwise.  This is regarded as a feature,
 not as a bug, because it gives slightly more control to the packagers
 using the @code{DESTDIR} feature.
 
+You can let installed programs and libraries be stripped with
+
+@smallexample
+make install-strip
+@end smallexample
+
 If you are bootstrapping a released version of GCC then please
 quickly review the build status page for your release, available from
 @uref{http://gcc.gnu.org/buildstat.html}.
diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in
index 9319896..3718b30 100644
--- a/gnattools/Makefile.in
+++ b/gnattools/Makefile.in
@@ -1,5 +1,5 @@
 # Makefile for gnattools
-#   Copyright 2003, 2004, 2009 Free Software Foundation, Inc.
+#   Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -274,18 +274,24 @@ pdf:
 # Build HTML (none here).
 html:
 
+.PHONY: check installcheck info dvi pdf html
+
 # Build TAGS (none here).
 TAGS:
 
 # Installation rules.
 install:
 
+install-strip: install
+
 install-info:
 
 install-pdf:
 
 install-html:
 
+.PHONY: install install-strip install-info install-pdf install-html
+
 # Cleaning rules.
 mostlyclean:
 
@@ -296,6 +302,8 @@ distclean:
 
 maintainer-clean:
 
+.PHONY: mostlyclean clean distclean maintainer-clean
+
 # Rules for rebuilding this Makefile.
 Makefile: $(srcdir)/Makefile.in config.status
  CONFIG_FILES=$@ ; \
diff --git a/libada/Makefile.in b/libada/Makefile.in
index 01fa836..cd51823 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -1,5 +1,5 @@
 # Makefile for libada.
-#   Copyright 2003, 2004, 2009 Free Software Foundation, Inc.
+#   Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 all: gnatlib
  $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
 
-.PHONY: all install
+.PHONY: all
 
 ## Multilib support variables.
 MULTISRCTOP =
@@ -144,16 +144,22 @@ html:
 # Build TAGS (none here).
 TAGS:
 
+.PHONY: check installcheck info dvi pdf html
+
 # Installation rules.
 install: install-gnatlib
  $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
 
+install-strip: install
+
 install-info:
 
 install-pdf:
 
 install-html:
 
+.PHONY: install install-strip install-info install-pdf install-html
+
 # Cleaning rules.
 mostlyclean:
  $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
@@ -167,6 +173,8 @@ distclean:
 
 maintainer-clean:
 
+.PHONY: mostlyclean clean distclean maintainer-clean
+
 # Rules for rebuilding this Makefile.
 Makefile: $(srcdir)/Makefile.in config.status
  CONFIG_FILES=$@ ; \
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 631af5a..dc4838f 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile.in
 
-# Copyright (C) 2005, 2006, 2009 Free Software Foundation
+# Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation
 #
 # This file is part of GCC.
 #
@@ -975,7 +975,9 @@ install-leaf: $(install-shared) $(install-libunwind)
 install: install-leaf
  @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
 
-.PHONY: install install-shared install-libunwind
+install-strip: install
+
+.PHONY: install install-shared install-libunwind install-strip
 
 # Don't export variables to the environment, in order to not confuse
 # configure.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 1893254..f928b5e 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -335,6 +335,9 @@ libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
 
 INSTALL_DEST = @INSTALL_DEST@
 install: install_to_$(INSTALL_DEST) install-subdir
+install-strip: install
+
+.PHONY: install install-strip
 
 # This is tricky.  Even though CC in the Makefile contains
 # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ralf Wildenhues
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00192.html

* Ralf Wildenhues wrote on Tue, Nov 02, 2010 at 09:08:41PM CET:
> * NightStrike wrote on Wed, Oct 27, 2010 at 11:08:51PM CEST:
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46202

> OK to commit to GCC and sync to src?  The patch has src-specific bits in
> etc/.  install-strip will fail for parts of the src tree outside of
> binutils+gdb, but fixing that should be straight-forward.
>
> I'll gladly split the .PHONY fixlets and the minor gcc/doc cleanups in
> separate patches if you prefer.

Now, as GCC build maintainer, it seems most of this patch is free to
proceed on (still, I'd welcome any review!), and the src bits are
trivial.  The web update has been OKed off-list by Gerald, so the only
remaining bits are in gcc/doc/install.texi.  Is that part of the build
maintainer role too, or OK to go ahead with?

Thanks,
Ralf

> bits only for src:
>
> etc/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> * Makefile.in (install-strip): New target.

> bits for GCC and shared GCC/src bits:
>
> PR other/46202: implement install-strip.
>
> ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * configure.ac: Fix just-built in-tree STRIP name to be
> binutils/strip-new.
> * configure: Regenerate.
> * Makefile.def (install-strip-gcc, install-strip-binutils)
> (install-strip-opcodes, install-strip-ld, install-strip-itcl)
> (install-strip-sid): Mirror dependencies on non-strip variants
> of these targets on the respective -strip prerequisites.
> * Makefile.tpl (install-strip, install-strip-host)
> (install-strip-target): New targets.
> (install-strip-[+module+], install-strip-target-[+module+]):
> New targets.
> * Makefile.in: Regenerate.
>
> gcc/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * Makefile.in (install_sh, INSTALL_STRIP_PROGRAM): New
> variables.
> (AR_FOR_TARGET, RANLIB_FOR_TARGET, STRIP_FOR_TARGET): Fix
> shell quoting.
> (STRIP_FOR_TARGET): Look for in-tree strip under name strip-new.
> (install-strip): New target.
> * doc/install.texi (Final install): Minor markup and code style
> fixes.  Document install-strip target.
>
> fixincludes/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * Makefile.in (install-strip): New phony target.
> (all, check, install): Also mark as phony.
>
> libgcc/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * Makefile.in (install-strip): New phony target.
>
> libiberty/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * Makefile.in (install-strip): New phony target.
> (install): Also mark as phony.
>
> gnattools/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * Makefile.in (install-strip): New phony target.
> (check, installcheck, info, dvi, pdf, html, install)
> (install-info, install-pdf, install-html, mostlyclean)
> (clean, distclean, maintainer-clean): Mark phony.
>
> libada/ChangeLog:
> 2010-11-01  Ralf Wildenhues  <[hidden email]>
>
> PR other/46202
> * Makefile.in (install-strip): New phony target.
> (check, installcheck, info, dvi, pdf, html, install)
> (install-info, install-pdf, install-html, mostlyclean)
> (clean, distclean, maintainer-clean): Mark phony.

[...]

> --- a/gcc/doc/install.texi
> +++ b/gcc/doc/install.texi
> @@ -2638,7 +2638,7 @@ messages may be automatically processed.
>  
>  Now that GCC has been built (and optionally tested), you can install it with
>  @smallexample
> -cd @var{objdir}; make install
> +cd @var{objdir} && make install
>  @end smallexample
>  
>  We strongly recommend to install into a target directory where there is
> @@ -2674,7 +2674,8 @@ jail can be achieved with the command
>  make DESTDIR=@var{path-to-rootdir} install
>  @end smallexample
>  
> -@noindent where @var{path-to-rootdir} is the absolute path of
> +@noindent
> +where @var{path-to-rootdir} is the absolute path of
>  a directory relative to which all installation paths will be
>  interpreted.  Note that the directory specified by @code{DESTDIR}
>  need not exist yet; it will be created if necessary.
> @@ -2688,6 +2689,12 @@ it will not be created otherwise.  This is regarded as a feature,
>  not as a bug, because it gives slightly more control to the packagers
>  using the @code{DESTDIR} feature.
>  
> +You can let installed programs and libraries be stripped with
> +
> +@smallexample
> +make install-strip
> +@end smallexample
> +
>  If you are bootstrapping a released version of GCC then please
>  quickly review the build status page for your release, available from
>  @uref{http://gcc.gnu.org/buildstat.html}.
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Gerald Pfeifer
On Wed, 17 Nov 2010, Ralf Wildenhues wrote:
> Now, as GCC build maintainer, it seems most of this patch is free to
> proceed on (still, I'd welcome any review!), and the src bits are
> trivial.  The web update has been OKed off-list by Gerald, so the only
> remaining bits are in gcc/doc/install.texi.  Is that part of the build
> maintainer role too, or OK to go ahead with?

I can approve that one, too. :-)

There is one thing there that may confuse our users a bit and that is
the following:

+ You can let installed programs and libraries be stripped with
+                                                                            
+@smallexample                                                                
+make install-strip                                                          
+@end smallexample  

This could be misread as stripping already installed programs and
libraries, where I assume this installs stripped copies.  If this
is correct, would you mind adjusting this before committing your
patch?  Something like "You can install stripped..." perhaps?

Gerald
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ralf Wildenhues
* Gerald Pfeifer wrote on Sat, Nov 20, 2010 at 01:24:13AM CET:

> On Wed, 17 Nov 2010, Ralf Wildenhues wrote:
> > Now, as GCC build maintainer, it seems most of this patch is free to
> > proceed on (still, I'd welcome any review!), and the src bits are
> > trivial.  The web update has been OKed off-list by Gerald, so the only
> > remaining bits are in gcc/doc/install.texi.  Is that part of the build
> > maintainer role too, or OK to go ahead with?
>
> I can approve that one, too. :-)
>
> There is one thing there that may confuse our users a bit and that is
> the following:

Fixed according to your suggestion.  Thanks for the review!

I noticed one more problem: target-specific exports are supported since
GNU make 3.81 only, but GCC only requires 3.80.  Luckily nothing besides
install-sh uses STRIPPROG, and install-sh tests for non-empty rather
than unset variable for its semantics, so we can export the variable
from gcc/Makefile.in.  The gcc/ part of the final patch is shown below,
the rest as in <http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00192.html>.

I've committed the whole patch to GCC and src now.

Cheers,
Ralf

PR other/46202: implement install-strip.

gcc/:
        PR other/46202
        * Makefile.in (install_sh, INSTALL_STRIP_PROGRAM): New
        variables.
        (AR_FOR_TARGET, RANLIB_FOR_TARGET, STRIP_FOR_TARGET): Fix
        shell quoting.
        (STRIP_FOR_TARGET): Look for in-tree strip under name strip-new.
        (install-strip): New target.
        (STRIPPROG): New variable, exported if STRIP is set.
        * doc/install.texi (Final install): Minor markup and code style
        fixes.  Document install-strip target.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 5491aeaf..98f06e9 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -22,7 +22,7 @@
 #<http://www.gnu.org/licenses/>.
 
 # The targets for external use include:
-# all, doc, install, install-cross, install-cross-rest,
+# all, doc, install, install-cross, install-cross-rest, install-strip,
 # uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean.
 
 # This is the default target.
@@ -255,6 +255,8 @@ LN_S=@LN_S@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL@
+install_sh = $(SHELL) $(srcdir)/../install-sh
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 MAKEINFO = @MAKEINFO@
 MAKEINFOFLAGS = --no-split
 TEXI2DVI = texi2dvi
@@ -387,7 +389,7 @@ AR_FOR_TARGET := $(shell \
     if [ "$(host)" = "$(target)" ] ; then \
       echo $(AR); \
     else \
-       t='$(program_transform_name)'; echo ar | sed -e $$t ; \
+       t='$(program_transform_name)'; echo ar | sed -e "$$t" ; \
     fi; \
   fi)
 AR_FLAGS_FOR_TARGET =
@@ -402,20 +404,20 @@ RANLIB_FOR_TARGET := $(shell \
     if [ "$(host)" = "$(target)" ] ; then \
       echo $(RANLIB); \
     else \
-       t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
+       t='$(program_transform_name)'; echo ranlib | sed -e "$$t" ; \
     fi; \
   fi)
 ORIGINAL_LD_FOR_TARGET = @ORIGINAL_LD_FOR_TARGET@
 ORIGINAL_NM_FOR_TARGET = @ORIGINAL_NM_FOR_TARGET@
 NM_FOR_TARGET = ./nm
 STRIP_FOR_TARGET := $(shell \
-  if [ -f $(objdir)/../binutils/strip ] ; then \
-    echo $(objdir)/../binutils/strip ; \
+  if [ -f $(objdir)/../binutils/strip-new ] ; then \
+    echo $(objdir)/../binutils/strip-new ; \
   else \
     if [ "$(host)" = "$(target)" ] ; then \
       echo strip; \
     else \
-       t='$(program_transform_name)'; echo strip | sed -e $$t ; \
+       t='$(program_transform_name)'; echo strip | sed -e "$$t" ; \
     fi; \
   fi)
 
@@ -4488,7 +4490,7 @@ maintainer-clean:
  -rm -f gcc.??s gcc.*aux
  -rm -f $(gcc_docdir)/*.info $(gcc_docdir)/*.1 $(gcc_docdir)/*.7 $(gcc_docdir)/*.dvi $(gcc_docdir)/*.pdf
 #
-# Entry points `install' and `uninstall'.
+# Entry points `install', `install-strip', and `uninstall'.
 # Also use `install-collect2' to install collect2 when the config files don't.
 
 # Copy the compiler files into directories where they will be run.
@@ -4502,6 +4504,13 @@ ifeq ($(enable_plugin),yes)
 install: install-plugin
 endif
 
+install-strip: override INSTALL_PROGRAM = $(INSTALL_STRIP_PROGRAM)
+ifneq ($(STRIP),)
+install-strip: STRIPPROG = $(STRIP)
+export STRIPPROG
+endif
+install-strip: install
+
 # Handle cpp installation.
 install-cpp: installdirs cpp$(exeext)
  -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
index 183e545..6395ff9 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -92,7 +92,7 @@ SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
 # libgcc.mk.  We want this delayed until actual install time.
 SHLIB_INSTALL = \
  $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
- $(INSTALL_PROGRAM) $(SHLIB_DIR)/$(SHLIB_SONAME) \
+ $(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \
   $$(DESTDIR)$$(bindir)/$(SHLIB_SONAME); \
  $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
   $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 1c9d463..e67793a 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2617,7 +2617,7 @@ messages may be automatically processed.
 
 Now that GCC has been built (and optionally tested), you can install it with
 @smallexample
-cd @var{objdir}; make install
+cd @var{objdir} && make install
 @end smallexample
 
 We strongly recommend to install into a target directory where there is
@@ -2653,7 +2653,8 @@ jail can be achieved with the command
 make DESTDIR=@var{path-to-rootdir} install
 @end smallexample
 
-@noindent where @var{path-to-rootdir} is the absolute path of
+@noindent
+where @var{path-to-rootdir} is the absolute path of
 a directory relative to which all installation paths will be
 interpreted.  Note that the directory specified by @code{DESTDIR}
 need not exist yet; it will be created if necessary.
@@ -2667,6 +2668,12 @@ it will not be created otherwise.  This is regarded as a feature,
 not as a bug, because it gives slightly more control to the packagers
 using the @code{DESTDIR} feature.
 
+You can install stripped programs and libraries with
+
+@smallexample
+make install-strip
+@end smallexample
+
 If you are bootstrapping a released version of GCC then please
 quickly review the build status page for your release, available from
 @uref{http://gcc.gnu.org/buildstat.html}.
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

NightStrike
On Sat, Nov 20, 2010 at 2:38 PM, Ralf Wildenhues <[hidden email]> wrote:

> * Gerald Pfeifer wrote on Sat, Nov 20, 2010 at 01:24:13AM CET:
>> On Wed, 17 Nov 2010, Ralf Wildenhues wrote:
>> > Now, as GCC build maintainer, it seems most of this patch is free to
>> > proceed on (still, I'd welcome any review!), and the src bits are
>> > trivial.  The web update has been OKed off-list by Gerald, so the only
>> > remaining bits are in gcc/doc/install.texi.  Is that part of the build
>> > maintainer role too, or OK to go ahead with?
>>
>> I can approve that one, too. :-)
>>
>> There is one thing there that may confuse our users a bit and that is
>> the following:
>
> Fixed according to your suggestion.  Thanks for the review!

This applies to anything in top level configure, right?  So we can
install-strip GCC, binutils, gdb, etc?
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

Ralf Wildenhues
* NightStrike wrote on Sat, Nov 20, 2010 at 08:42:51PM CET:
> This applies to anything in top level configure, right?  So we can
> install-strip GCC, binutils, gdb, etc?

Yes.  :-)
Reply | Threaded
Open this post in threaded view
|

Re: make install-strip with binutils

NightStrike
On Sat, Nov 20, 2010 at 2:45 PM, Ralf Wildenhues <[hidden email]> wrote:
> * NightStrike wrote on Sat, Nov 20, 2010 at 08:42:51PM CET:
>> This applies to anything in top level configure, right?  So we can
>> install-strip GCC, binutils, gdb, etc?
>
> Yes.  :-)
>

You are quite awesome :)