Re: [PATCH] make: add INSTALL_STRIP variable

5 messages, 4 authors, 2021-08-24 · open the first message on its own page

Re: [PATCH] make: add INSTALL_STRIP variable

From: Junio C Hamano <hidden>
Date: 2021-08-20 18:16:43

Đoàn Trần Công Danh  [off-list ref] writes:
quoted
 install: all
+ifdef INSTALL_STRIP
+	$(MAKE) strip
+endif
I believe it's better to write like this:

----- 8< ------
ifdef INSTALL_STRIP
install: strip
endif

install: all
	....
---- >8-------

IOW, install depends on strip, not install invoke strip.
I think it would work better for:

	make install strip
I think you meant "it would work better than 'make install strip'",
and if so, I tend to agree.  With

	echo INSTALL_STRIP=YesPlease >>config.mak

either Bagas's or your "before installing, make sure we strip"
change lets

	make install

just work without "strip" given on the command line.

If users with such a config.mak type "make install strip", it will
make the recipe for "install" wait until "strip" is done, which is
what we want, but "strip" on the command line for them is redundant,
and there is no way for them to install unstripped binaries, which
may be a bit of downside.

But for those who do not always want to use INSTALL_STRIP, as Dscho
said after I mentioned the "make variable" thing, we probably a
wrong thing when they say "make -j strip install", as there is
nothing to make recipe for "install" to wait for "strip", so it is
not a fully satisfactory solution.

I think we want two things:

 (1) if a user says "make [-j] strip install", make sure "install"
     won't start before "strip" finishes;

 (2) if a user wants to always install stripped binary, allow some
     make variable in config.mak so that "make install" would do
     that without an explicit "strip".

Of course, if a user does not have (2) configured, "make install"
should install unstripped binaries, but that goes without saying.

And after thinking it like this, perhaps a new "install-stripped"
target that runs "strip" and then "install" as originally proposed
in the thread that triggered this discussion may be the simplest
approach.  We can control the optional dependency between "strip"
and "install", those who want to install stripped binary can use
"install-stripped" instead of "install", and they can on-demand
choose to install unstripped binary (which was a potential downside
of the "make variable" approach under discussion here).

Thanks.

Re: [PATCH] make: add INSTALL_STRIP variable

From: Đoàn Trần Công Danh <hidden>
Date: 2021-08-21 02:13:22

On 2021-08-20 11:16:37-0700, Junio C Hamano [off-list ref] wrote:
Đoàn Trần Công Danh  [off-list ref] writes:
quoted
quoted
 install: all
+ifdef INSTALL_STRIP
+	$(MAKE) strip
+endif
I believe it's better to write like this:

----- 8< ------
ifdef INSTALL_STRIP
install: strip
endif

install: all
	....
---- >8-------

IOW, install depends on strip, not install invoke strip.
I think it would work better for:

	make install strip
I think you meant "it would work better than 'make install strip'",
and if so, I tend to agree.  With

	echo INSTALL_STRIP=YesPlease >>config.mak

either Bagas's or your "before installing, make sure we strip"
change lets

	make install

just work without "strip" given on the command line.

If users with such a config.mak type "make install strip", it will
make the recipe for "install" wait until "strip" is done, which is
what we want, but "strip" on the command line for them is redundant,
and there is no way for them to install unstripped binaries, which
may be a bit of downside.

But for those who do not always want to use INSTALL_STRIP, as Dscho
said after I mentioned the "make variable" thing, we probably a
wrong thing when they say "make -j strip install", as there is
nothing to make recipe for "install" to wait for "strip", so it is
not a fully satisfactory solution.
In that case, we can use this construct (since we depends on GNU Make,
anyway).

---- 8< ------
ifneq ($(filter install,$(MAKECMDGOALS)),)
ifneq ($(filter strip,$(MAKECMDGOALS)),)
install: strip
endif
endif
---- >8 -----

MAKECMDGOALS is available from at least GNU Make 3.75.1 in 1997.

Anyway, maybe it's only me, but I think people may want to install
first, then strip later for debug mapping.
I think we want two things:

 (1) if a user says "make [-j] strip install", make sure "install"
     won't start before "strip" finishes;

 (2) if a user wants to always install stripped binary, allow some
     make variable in config.mak so that "make install" would do
     that without an explicit "strip".

Of course, if a user does not have (2) configured, "make install"
should install unstripped binaries, but that goes without saying.

And after thinking it like this, perhaps a new "install-stripped"
target that runs "strip" and then "install" as originally proposed
in the thread that triggered this discussion may be the simplest
approach.  We can control the optional dependency between "strip"
and "install", those who want to install stripped binary can use
"install-stripped" instead of "install", and they can on-demand
choose to install unstripped binary (which was a potential downside
of the "make variable" approach under discussion here).

Thanks.
-- 
Danh

Re: [PATCH] make: add INSTALL_STRIP variable

From: Junio C Hamano <hidden>
Date: 2021-08-23 15:55:52

Đoàn Trần Công Danh  [off-list ref] writes:
In that case, we can use this construct (since we depends on GNU Make,
anyway).

---- 8< ------
ifneq ($(filter install,$(MAKECMDGOALS)),)
ifneq ($(filter strip,$(MAKECMDGOALS)),)
install: strip
endif
endif
---- >8 -----

MAKECMDGOALS is available from at least GNU Make 3.75.1 in 1997.
Or the "|" thing Dscho floated earlier?
Anyway, maybe it's only me, but I think people may want to install
first, then strip later for debug mapping.
Perhaps.  One bad thing with the current "strip" arrangement is that
it is done in the built directory, and because "make install" would
blindly install whatever in the built directory, if you truly care
that you install unstripped binaries, you need to see if they are
stripped and rebuild them as needed, because "make strip" may or may
not have been done.  From that point of view, getting rid of the
current "make strip" and introducing either "make strip-installed"
("we've installed things earlier---go strip them") or "make
install-stripped" ("we've built (or if we haven't please build them
first), now install them and strip them in the installed directory")
may make more sense.  And for that, any idea that came up in this
discussion that relies on the current "strip" target would not help.

Thanks.

Re: [PATCH] make: add INSTALL_STRIP variable

From: Bagas Sanjaya <hidden>
Date: 2021-08-24 09:39:51

On 23/08/21 22.55, Junio C Hamano wrote:
Perhaps.  One bad thing with the current "strip" arrangement is that
it is done in the built directory, and because "make install" would
blindly install whatever in the built directory, if you truly care
that you install unstripped binaries, you need to see if they are
stripped and rebuild them as needed, because "make strip" may or may
not have been done.  From that point of view, getting rid of the
current "make strip" and introducing either "make strip-installed"
("we've installed things earlier---go strip them") or "make
install-stripped" ("we've built (or if we haven't please build them
first), now install them and strip them in the installed directory")
may make more sense.  And for that, any idea that came up in this
discussion that relies on the current "strip" target would not help.
But often the installed directory (install prefix) is owned by root,
so one has to `sudo make install-strip`, right?

-- 
An old man doll... just what I always wanted! - Clara

Re: [PATCH] make: add INSTALL_STRIP variable

From: Johannes Schindelin <hidden>
Date: 2021-08-24 09:49:46

Hi Bagas,

On Tue, 24 Aug 2021, Bagas Sanjaya wrote:
On 23/08/21 22.55, Junio C Hamano wrote:
quoted
Perhaps.  One bad thing with the current "strip" arrangement is that
it is done in the built directory, and because "make install" would
blindly install whatever in the built directory, if you truly care
that you install unstripped binaries, you need to see if they are
stripped and rebuild them as needed, because "make strip" may or may
not have been done.  From that point of view, getting rid of the
current "make strip" and introducing either "make strip-installed"
("we've installed things earlier---go strip them") or "make
install-stripped" ("we've built (or if we haven't please build them
first), now install them and strip them in the installed directory")
may make more sense.  And for that, any idea that came up in this
discussion that relies on the current "strip" target would not help.
But often the installed directory (install prefix) is owned by root,
so one has to `sudo make install-strip`, right?
The default for `make install` goes to `$HOME`. I would wager a bet that
that's the common case, too. It does not require `sudo`.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help