{"thread":{"id":"56310","subject":"[PATCH] make: add install-strip target","startedAt":"2021-08-17T11:09:00Z","lastAt":"2021-08-24T13:16:07Z","messageCount":9,"participants":["Bagas Sanjaya","Johannes Schindelin","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"432940","messageId":"20210817110728.55842-1-bagasdotme@gmail.com","threadId":"56310","inReplyTo":null,"subject":"[PATCH] make: add install-strip target","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-08-17T11:07:29Z","receivedAt":"2021-08-17T11:09:00Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Previously to install Git with stripped binaries, users have to do `make\nall` then `make strip` before doing `make install`. It is nice to have\n`install-strip` target for convenience, so that they can simply type\n`make install-strip` and have Git with stripped binaries installed.\nOn some environments where disk space and resources is limited (such as\nembedded systems), installed size can be smaller that with non-stripped\nbinaries.\n\nAlso mention the target in INSTALL.\n\nSigned-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n---\n INSTALL  | 5 +++++\n Makefile | 5 ++++-\n 2 files changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/INSTALL b/INSTALL\nindex 66389ce059..6e6303d482 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -25,6 +25,11 @@ set up install paths (via config.mak.autogen), so you can write instead\n \t$ make all doc ;# as yourself\n \t# make install install-doc install-html;# as root\n \n+If you're tight on space (common on embedded systems), you can install\n+with debugging info stripped with\n+\n+\t# make install-strip\n+\n If you're willing to trade off (much) longer build time for a later\n faster git you can also do a profile feedback build with\n \ndiff --git a/Makefile b/Makefile\nindex 9573190f1d..8c4633ba8e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3093,6 +3093,9 @@ endif\n \tdone && \\\n \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n+install-strip: all strip\n+\t$(MAKE) install\n+\n .PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf\n .PHONY: quick-install-doc quick-install-man quick-install-html\n install-gitweb:\n@@ -3265,7 +3268,7 @@ ifdef MSVC\n \t$(RM) compat/vcbuild/MSVC-DEFS-GEN\n endif\n \n-.PHONY: all install profile-clean cocciclean clean strip\n+.PHONY: all install install-strip profile-clean cocciclean clean strip\n .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell\n .PHONY: FORCE cscope\n \n\nbase-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf\n-- \n2.25.1\n\n"},{"id":"433029","messageId":"nycvar.QRO.7.76.6.2108172327290.55@tvgsbejvaqbjf.bet","threadId":"56310","inReplyTo":"20210817110728.55842-1-bagasdotme@gmail.com","subject":"Re: [PATCH] make: add install-strip target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2021-08-17T21:28:37Z","receivedAt":"2021-08-17T21:28:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Bagas,\n\nOn Tue, 17 Aug 2021, Bagas Sanjaya wrote:\n\n> diff --git a/Makefile b/Makefile\n> index 9573190f1d..8c4633ba8e 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -3093,6 +3093,9 @@ endif\n>  \tdone && \\\n>  \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n>\n> +install-strip: all strip\n\nWould those `all` and `strip` targets interfere with one another if `make\n-j2` was called? If not, wouldn't it be sufficient to let `install-strip`\ndepend on `strip` alone?\n\nCiao,\nDscho\n\n> +\t$(MAKE) install\n> +\n>  .PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf\n>  .PHONY: quick-install-doc quick-install-man quick-install-html\n>  install-gitweb:\n> @@ -3265,7 +3268,7 @@ ifdef MSVC\n>  \t$(RM) compat/vcbuild/MSVC-DEFS-GEN\n>  endif\n>\n> -.PHONY: all install profile-clean cocciclean clean strip\n> +.PHONY: all install install-strip profile-clean cocciclean clean strip\n>  .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell\n>  .PHONY: FORCE cscope\n>\n>\n> base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf\n> --\n> 2.25.1\n>\n>\n"},{"id":"433034","messageId":"CAPig+cT5nPJ7NKFKXRQJwTzL13oEwzMBBpAa+P+XoZxO9SEKKQ@mail.gmail.com","threadId":"56310","inReplyTo":"nycvar.QRO.7.76.6.2108172327290.55@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] make: add install-strip target","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2021-08-17T21:48:51Z","receivedAt":"2021-08-17T21:49:17Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Aug 17, 2021 at 5:29 PM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> On Tue, 17 Aug 2021, Bagas Sanjaya wrote:\n> > diff --git a/Makefile b/Makefile\n> > @@ -3093,6 +3093,9 @@ endif\n> > +install-strip: all strip\n>\n> Would those `all` and `strip` targets interfere with one another if `make\n> -j2` was called? If not, wouldn't it be sufficient to let `install-strip`\n> depend on `strip` alone?\n\nA more pertinent question, perhaps, is why would we need\n`install-strip` at all? What benefit does it provide over simply\ntyping `make strip install`?\n"},{"id":"433036","messageId":"xmqq8s0z7m9m.fsf@gitster.g","threadId":"56310","inReplyTo":"nycvar.QRO.7.76.6.2108172327290.55@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] make: add install-strip target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-17T22:13:25Z","receivedAt":"2021-08-17T22:13:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Would those `all` and `strip` targets interfere with one another if `make\n> -j2` was called? If not, wouldn't it be sufficient to let `install-strip`\n> depend on `strip` alone?\n\nGood question.\n\nI would have expected that this will *not* be a new target, but some\nsort of make variable (e.g. \"make INSTALL_STRIP=yes install\").\n"},{"id":"433059","messageId":"nycvar.QRO.7.76.6.2108181222120.55@tvgsbejvaqbjf.bet","threadId":"56310","inReplyTo":"CAPig+cT5nPJ7NKFKXRQJwTzL13oEwzMBBpAa+P+XoZxO9SEKKQ@mail.gmail.com","subject":"Re: [PATCH] make: add install-strip target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2021-08-18T10:25:35Z","receivedAt":"2021-08-18T10:26:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Eric,\n\nOn Tue, 17 Aug 2021, Eric Sunshine wrote:\n\n> On Tue, Aug 17, 2021 at 5:29 PM Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> > On Tue, 17 Aug 2021, Bagas Sanjaya wrote:\n> > > diff --git a/Makefile b/Makefile\n> > > @@ -3093,6 +3093,9 @@ endif\n> > > +install-strip: all strip\n> >\n> > Would those `all` and `strip` targets interfere with one another if `make\n> > -j2` was called? If not, wouldn't it be sufficient to let `install-strip`\n> > depend on `strip` alone?\n>\n> A more pertinent question, perhaps, is why would we need\n> `install-strip` at all? What benefit does it provide over simply\n> typing `make strip install`?\n\nThat would require an order-only prerequisite (see\nhttps://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html)\nfor `make -j2 strip install` to work correctly, i.e. something like this:\n\n-- snip --\ndiff --git a/Makefile b/Makefile\nindex 2d5c822f7a8..9987f3b2c13 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2990,7 +2990,7 @@ profile-install: profile\n profile-fast-install: profile-fast\n \t$(MAKE) install\n\n-install: all\n+install: all | strip\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n-- snap --\n\nI am not quite certain that this is compatible with other `make`\nimplementations we still might support (if there are any, I remember that\nwe often have to rely on `gmake` because the native `make` does not\nunderstand our `Makefile`?), so that might need to be conditional on GNU\nMake.\n\nCiao,\nDscho\n"},{"id":"433060","messageId":"nycvar.QRO.7.76.6.2108181229320.55@tvgsbejvaqbjf.bet","threadId":"56310","inReplyTo":"xmqq8s0z7m9m.fsf@gitster.g","subject":"Re: [PATCH] make: add install-strip target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2021-08-18T10:30:33Z","receivedAt":"2021-08-18T10:30:51Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Tue, 17 Aug 2021, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n> > Would those `all` and `strip` targets interfere with one another if `make\n> > -j2` was called? If not, wouldn't it be sufficient to let `install-strip`\n> > depend on `strip` alone?\n>\n> Good question.\n>\n> I would have expected that this will *not* be a new target, but some\n> sort of make variable (e.g. \"make INSTALL_STRIP=yes install\").\n\nThat would work, too. At the same time: wouldn't it be nicer to let `make\n-j15 strip install` Do The Right Thing?\n\nCiao,\nDscho\n"},{"id":"433154","messageId":"xmqq1r6p1ark.fsf@gitster.g","threadId":"56310","inReplyTo":"nycvar.QRO.7.76.6.2108181229320.55@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] make: add install-strip target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-19T19:42:55Z","receivedAt":"2021-08-19T19:43:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> That would work, too. At the same time: wouldn't it be nicer to let `make\n> -j15 strip install` Do The Right Thing?\n\nOh, absolutely.  With \"make all install\" and \"make strip install\",\nbuilding (and optional stripping) should complete before the\n\"install\" target kicks in.\n\nIt may be a bit tricky to implement, though.  Making 'install'\ndepend unconditionally on 'all' is trivial, but we want it to depend\non 'strip' only when 'strip' is part of the targets requested.\n"},{"id":"433155","messageId":"xmqqwnohyzuo.fsf@gitster.g","threadId":"56310","inReplyTo":"nycvar.QRO.7.76.6.2108181222120.55@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] make: add install-strip target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-19T19:54:39Z","receivedAt":"2021-08-19T19:54:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> -install: all\n> +install: all | strip\n>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n>  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n>  \t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n> -- snap --\n>\n> I am not quite certain that this is compatible with other `make`\n> implementations we still might support (if there are any, I remember that\n> we often have to rely on `gmake` because the native `make` does not\n> understand our `Makefile`?), so that might need to be conditional on GNU\n> Make.\n\nI think we are pretty-much dependent on GNU make already (it is\npossible to raise a weather balloon to confirm by renaming Makefile\nto GNUmakefile and observing if anybody complains, I think).\n\nBut I am not sure what such a rule does for a .PHONY target like\n'strip'.  Does it do the right thing, i.e. \"install recipe is run\nafter 'strip' recipe has run, iff 'strip' is also asked for\"?\n\nThanks.\n"},{"id":"433546","messageId":"nycvar.QRO.7.76.6.2108241513280.55@tvgsbejvaqbjf.bet","threadId":"56310","inReplyTo":"xmqqwnohyzuo.fsf@gitster.g","subject":"Re: [PATCH] make: add install-strip target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2021-08-24T13:15:45Z","receivedAt":"2021-08-24T13:16:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Thu, 19 Aug 2021, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n> > -install: all\n> > +install: all | strip\n> >  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n> >  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n> >  \t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n> > -- snap --\n> >\n> > I am not quite certain that this is compatible with other `make`\n> > implementations we still might support (if there are any, I remember that\n> > we often have to rely on `gmake` because the native `make` does not\n> > understand our `Makefile`?), so that might need to be conditional on GNU\n> > Make.\n>\n> I think we are pretty-much dependent on GNU make already (it is\n> possible to raise a weather balloon to confirm by renaming Makefile\n> to GNUmakefile and observing if anybody complains, I think).\n>\n> But I am not sure what such a rule does for a .PHONY target like\n> 'strip'.  Does it do the right thing, i.e. \"install recipe is run\n> after 'strip' recipe has run, iff 'strip' is also asked for\"?\n\nMy reading of the documentation is that just as with regular dependencies,\nit does not matter whether order-only dependencies are .PHONY or not.\n\nThe only difference between order-only vs regular dependencies seems to be\nthat order-only dependencies are not necessarily built. But if they are,\nthey are guaranteed to be built before the order-only dependencee.\n\nGranted, I did not have time to test it, but from an implementation point\nof view, I would be surprised if there was any more to it.\n\nCiao,\nDscho\n"}]}