* [PATCH] make: add install-strip target
@ 2021-08-17 11:07 Bagas Sanjaya
2021-08-17 21:28 ` Johannes Schindelin
0 siblings, 1 reply; 9+ messages in thread
From: Bagas Sanjaya @ 2021-08-17 11:07 UTC (permalink / raw)
To: git
Cc: Johannes Schindelin, Junio C Hamano, SZEDER Gábor, ak,
Jeff Hostetler, Ævar Arnfjörð Bjarmason,
Bagas Sanjaya
Previously to install Git with stripped binaries, users have to do `make
all` then `make strip` before doing `make install`. It is nice to have
`install-strip` target for convenience, so that they can simply type
`make install-strip` and have Git with stripped binaries installed.
On some environments where disk space and resources is limited (such as
embedded systems), installed size can be smaller that with non-stripped
binaries.
Also mention the target in INSTALL.
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
INSTALL | 5 +++++
Makefile | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/INSTALL b/INSTALL
index 66389ce059..6e6303d482 100644
--- a/INSTALL
+++ b/INSTALL
@@ -25,6 +25,11 @@ set up install paths (via config.mak.autogen), so you can write instead
$ make all doc ;# as yourself
# make install install-doc install-html;# as root
+If you're tight on space (common on embedded systems), you can install
+with debugging info stripped with
+
+ # make install-strip
+
If you're willing to trade off (much) longer build time for a later
faster git you can also do a profile feedback build with
diff --git a/Makefile b/Makefile
index 9573190f1d..8c4633ba8e 100644
--- a/Makefile
+++ b/Makefile
@@ -3093,6 +3093,9 @@ endif
done && \
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
+install-strip: all strip
+ $(MAKE) install
+
.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
.PHONY: quick-install-doc quick-install-man quick-install-html
install-gitweb:
@@ -3265,7 +3268,7 @@ ifdef MSVC
$(RM) compat/vcbuild/MSVC-DEFS-GEN
endif
-.PHONY: all install profile-clean cocciclean clean strip
+.PHONY: all install install-strip profile-clean cocciclean clean strip
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY: FORCE cscope
base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-17 11:07 [PATCH] make: add install-strip target Bagas Sanjaya
@ 2021-08-17 21:28 ` Johannes Schindelin
2021-08-17 21:48 ` Eric Sunshine
2021-08-17 22:13 ` Junio C Hamano
0 siblings, 2 replies; 9+ messages in thread
From: Johannes Schindelin @ 2021-08-17 21:28 UTC (permalink / raw)
To: Bagas Sanjaya
Cc: git, Junio C Hamano, SZEDER Gábor, ak, Jeff Hostetler,
Ævar Arnfjörð Bjarmason
Hi Bagas,
On Tue, 17 Aug 2021, Bagas Sanjaya wrote:
> diff --git a/Makefile b/Makefile
> index 9573190f1d..8c4633ba8e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -3093,6 +3093,9 @@ endif
> done && \
> ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
>
> +install-strip: all strip
Would those `all` and `strip` targets interfere with one another if `make
-j2` was called? If not, wouldn't it be sufficient to let `install-strip`
depend on `strip` alone?
Ciao,
Dscho
> + $(MAKE) install
> +
> .PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
> .PHONY: quick-install-doc quick-install-man quick-install-html
> install-gitweb:
> @@ -3265,7 +3268,7 @@ ifdef MSVC
> $(RM) compat/vcbuild/MSVC-DEFS-GEN
> endif
>
> -.PHONY: all install profile-clean cocciclean clean strip
> +.PHONY: all install install-strip profile-clean cocciclean clean strip
> .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
> .PHONY: FORCE cscope
>
>
> base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-17 21:28 ` Johannes Schindelin
@ 2021-08-17 21:48 ` Eric Sunshine
2021-08-18 10:25 ` Johannes Schindelin
2021-08-17 22:13 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Eric Sunshine @ 2021-08-17 21:48 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Bagas Sanjaya, Git List, Junio C Hamano, SZEDER Gábor, ak,
Jeff Hostetler, Ævar Arnfjörð Bjarmason
On Tue, Aug 17, 2021 at 5:29 PM Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> On Tue, 17 Aug 2021, Bagas Sanjaya wrote:
> > diff --git a/Makefile b/Makefile
> > @@ -3093,6 +3093,9 @@ endif
> > +install-strip: all strip
>
> Would those `all` and `strip` targets interfere with one another if `make
> -j2` was called? If not, wouldn't it be sufficient to let `install-strip`
> depend on `strip` alone?
A more pertinent question, perhaps, is why would we need
`install-strip` at all? What benefit does it provide over simply
typing `make strip install`?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-17 21:28 ` Johannes Schindelin
2021-08-17 21:48 ` Eric Sunshine
@ 2021-08-17 22:13 ` Junio C Hamano
2021-08-18 10:30 ` Johannes Schindelin
1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2021-08-17 22:13 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Bagas Sanjaya, git, SZEDER Gábor, ak, Jeff Hostetler,
Ævar Arnfjörð Bjarmason
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Would those `all` and `strip` targets interfere with one another if `make
> -j2` was called? If not, wouldn't it be sufficient to let `install-strip`
> depend on `strip` alone?
Good question.
I would have expected that this will *not* be a new target, but some
sort of make variable (e.g. "make INSTALL_STRIP=yes install").
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-17 21:48 ` Eric Sunshine
@ 2021-08-18 10:25 ` Johannes Schindelin
2021-08-19 19:54 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2021-08-18 10:25 UTC (permalink / raw)
To: Eric Sunshine
Cc: Bagas Sanjaya, Git List, Junio C Hamano, SZEDER Gábor, ak,
Jeff Hostetler, Ævar Arnfjörð Bjarmason
Hi Eric,
On Tue, 17 Aug 2021, Eric Sunshine wrote:
> On Tue, Aug 17, 2021 at 5:29 PM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > On Tue, 17 Aug 2021, Bagas Sanjaya wrote:
> > > diff --git a/Makefile b/Makefile
> > > @@ -3093,6 +3093,9 @@ endif
> > > +install-strip: all strip
> >
> > Would those `all` and `strip` targets interfere with one another if `make
> > -j2` was called? If not, wouldn't it be sufficient to let `install-strip`
> > depend on `strip` alone?
>
> A more pertinent question, perhaps, is why would we need
> `install-strip` at all? What benefit does it provide over simply
> typing `make strip install`?
That would require an order-only prerequisite (see
https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html)
for `make -j2 strip install` to work correctly, i.e. something like this:
-- snip --
diff --git a/Makefile b/Makefile
index 2d5c822f7a8..9987f3b2c13 100644
--- a/Makefile
+++ b/Makefile
@@ -2990,7 +2990,7 @@ profile-install: profile
profile-fast-install: profile-fast
$(MAKE) install
-install: all
+install: all | strip
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
-- snap --
I am not quite certain that this is compatible with other `make`
implementations we still might support (if there are any, I remember that
we often have to rely on `gmake` because the native `make` does not
understand our `Makefile`?), so that might need to be conditional on GNU
Make.
Ciao,
Dscho
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-17 22:13 ` Junio C Hamano
@ 2021-08-18 10:30 ` Johannes Schindelin
2021-08-19 19:42 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2021-08-18 10:30 UTC (permalink / raw)
To: Junio C Hamano
Cc: Bagas Sanjaya, git, SZEDER Gábor, ak, Jeff Hostetler,
Ævar Arnfjörð Bjarmason
Hi Junio,
On Tue, 17 Aug 2021, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Would those `all` and `strip` targets interfere with one another if `make
> > -j2` was called? If not, wouldn't it be sufficient to let `install-strip`
> > depend on `strip` alone?
>
> Good question.
>
> I would have expected that this will *not* be a new target, but some
> sort of make variable (e.g. "make INSTALL_STRIP=yes install").
That would work, too. At the same time: wouldn't it be nicer to let `make
-j15 strip install` Do The Right Thing?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-18 10:30 ` Johannes Schindelin
@ 2021-08-19 19:42 ` Junio C Hamano
0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2021-08-19 19:42 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Bagas Sanjaya, git, SZEDER Gábor, ak, Jeff Hostetler,
Ævar Arnfjörð Bjarmason
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> That would work, too. At the same time: wouldn't it be nicer to let `make
> -j15 strip install` Do The Right Thing?
Oh, absolutely. With "make all install" and "make strip install",
building (and optional stripping) should complete before the
"install" target kicks in.
It may be a bit tricky to implement, though. Making 'install'
depend unconditionally on 'all' is trivial, but we want it to depend
on 'strip' only when 'strip' is part of the targets requested.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-18 10:25 ` Johannes Schindelin
@ 2021-08-19 19:54 ` Junio C Hamano
2021-08-24 13:15 ` Johannes Schindelin
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2021-08-19 19:54 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Eric Sunshine, Bagas Sanjaya, Git List, SZEDER Gábor, ak,
Jeff Hostetler, Ævar Arnfjörð Bjarmason
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> -install: all
> +install: all | strip
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
> $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
> -- snap --
>
> I am not quite certain that this is compatible with other `make`
> implementations we still might support (if there are any, I remember that
> we often have to rely on `gmake` because the native `make` does not
> understand our `Makefile`?), so that might need to be conditional on GNU
> Make.
I think we are pretty-much dependent on GNU make already (it is
possible to raise a weather balloon to confirm by renaming Makefile
to GNUmakefile and observing if anybody complains, I think).
But I am not sure what such a rule does for a .PHONY target like
'strip'. Does it do the right thing, i.e. "install recipe is run
after 'strip' recipe has run, iff 'strip' is also asked for"?
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] make: add install-strip target
2021-08-19 19:54 ` Junio C Hamano
@ 2021-08-24 13:15 ` Johannes Schindelin
0 siblings, 0 replies; 9+ messages in thread
From: Johannes Schindelin @ 2021-08-24 13:15 UTC (permalink / raw)
To: Junio C Hamano
Cc: Eric Sunshine, Bagas Sanjaya, Git List, SZEDER Gábor, ak,
Jeff Hostetler, Ævar Arnfjörð Bjarmason
Hi Junio,
On Thu, 19 Aug 2021, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > -install: all
> > +install: all | strip
> > $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
> > $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
> > $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
> > -- snap --
> >
> > I am not quite certain that this is compatible with other `make`
> > implementations we still might support (if there are any, I remember that
> > we often have to rely on `gmake` because the native `make` does not
> > understand our `Makefile`?), so that might need to be conditional on GNU
> > Make.
>
> I think we are pretty-much dependent on GNU make already (it is
> possible to raise a weather balloon to confirm by renaming Makefile
> to GNUmakefile and observing if anybody complains, I think).
>
> But I am not sure what such a rule does for a .PHONY target like
> 'strip'. Does it do the right thing, i.e. "install recipe is run
> after 'strip' recipe has run, iff 'strip' is also asked for"?
My reading of the documentation is that just as with regular dependencies,
it does not matter whether order-only dependencies are .PHONY or not.
The only difference between order-only vs regular dependencies seems to be
that order-only dependencies are not necessarily built. But if they are,
they are guaranteed to be built before the order-only dependencee.
Granted, I did not have time to test it, but from an implementation point
of view, I would be surprised if there was any more to it.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-24 13:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 11:07 [PATCH] make: add install-strip target Bagas Sanjaya
2021-08-17 21:28 ` Johannes Schindelin
2021-08-17 21:48 ` Eric Sunshine
2021-08-18 10:25 ` Johannes Schindelin
2021-08-19 19:54 ` Junio C Hamano
2021-08-24 13:15 ` Johannes Schindelin
2021-08-17 22:13 ` Junio C Hamano
2021-08-18 10:30 ` Johannes Schindelin
2021-08-19 19:42 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).