diff mbox

[01/36] build: make PREFIX overwritable from the environment

Message ID 20171105162544.72960-1-luc.vanoostenryck@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Luc Van Oostenryck Nov. 5, 2017, 4:25 p.m. UTC
From: Uwe Kleine-König <uwe@kleine-koenig.org>

This way I can just use

	env PREFIX=/usr make install

on the command line to install sparse into the system.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Josh Triplett Nov. 5, 2017, 5:44 p.m. UTC | #1
On Sun, Nov 05, 2017 at 05:25:09PM +0100, Luc Van Oostenryck wrote:
> From: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> This way I can just use
> 
> 	env PREFIX=/usr make install
> 
> on the command line to install sparse into the system.

You can already use "make PREFIX=/usr install" to do this, which seems
far more conventional, and seems less error-prone (e.g. it won't pick up
something random from the environment, only something intentionally put
on the command line).

Any particular reason to do this?

>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index d03417641..e011df3cc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -54,7 +54,7 @@ BASIC_CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
>  endif
>  
>  DESTDIR=
> -PREFIX=$(HOME)
> +PREFIX ?= $(HOME)
>  BINDIR=$(PREFIX)/bin
>  LIBDIR=$(PREFIX)/lib
>  MANDIR=$(PREFIX)/share/man
> -- 
> 2.14.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Uwe Kleine-König Nov. 5, 2017, 6:54 p.m. UTC | #2
Hello Josh,

On 11/05/2017 06:44 PM, Josh Triplett wrote:
> On Sun, Nov 05, 2017 at 05:25:09PM +0100, Luc Van Oostenryck wrote:
>> From: Uwe Kleine-König <uwe@kleine-koenig.org>
>>
>> This way I can just use
>>
>> 	env PREFIX=/usr make install
>>
>> on the command line to install sparse into the system.
> 
> You can already use "make PREFIX=/usr install" to do this, which seems
> far more conventional, and seems less error-prone (e.g. it won't pick up
> something random from the environment, only something intentionally put
> on the command line).

Having PREFIX in the build environment and then being surprised that
it's picked up by a build isn't something I'd show consideration for.

> Any particular reason to do this?

I had this patch in my stack for the sparse debian package because
with debhelper it is easier to put something into the environment than
to overwrite the make command line. (But having said that, the currently
used packaging doesn't rely on this feature any more.)

Best regards
Uwe
Josh Triplett Nov. 5, 2017, 8:30 p.m. UTC | #3
On Sun, Nov 05, 2017 at 07:54:52PM +0100, Uwe Kleine-König wrote:
> Hello Josh,
> 
> On 11/05/2017 06:44 PM, Josh Triplett wrote:
> > On Sun, Nov 05, 2017 at 05:25:09PM +0100, Luc Van Oostenryck wrote:
> >> From: Uwe Kleine-König <uwe@kleine-koenig.org>
> >>
> >> This way I can just use
> >>
> >> 	env PREFIX=/usr make install
> >>
> >> on the command line to install sparse into the system.
> > 
> > You can already use "make PREFIX=/usr install" to do this, which seems
> > far more conventional, and seems less error-prone (e.g. it won't pick up
> > something random from the environment, only something intentionally put
> > on the command line).
> 
> Having PREFIX in the build environment and then being surprised that
> it's picked up by a build isn't something I'd show consideration for.

I could *imagine* it happening by way of using that variable as an
intermediate step in, say, .bashrc, and not unsetting it; I don't know
offhand of any other package that would be affected by it, since most
use things like autotools and cmake that would not pick it up by the
environment.

I'm not saying that this is common, just that picking something up from
the environment seems marginally more error-prone.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d03417641..e011df3cc 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@  BASIC_CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
 endif
 
 DESTDIR=
-PREFIX=$(HOME)
+PREFIX ?= $(HOME)
 BINDIR=$(PREFIX)/bin
 LIBDIR=$(PREFIX)/lib
 MANDIR=$(PREFIX)/share/man