diff mbox

build: make PREFIX overwritable on the commandline

Message ID CANeU7QnCU7qfFzRGMC-v=Q5onaJgSUvAqiUWJT0FaKHc_Qp2RQ@mail.gmail.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Christopher Li Sept. 23, 2017, 11:20 a.m. UTC
On Fri, Sep 22, 2017 at 5:25 PM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
> This way I can just use
>
>         make install PREFIX=/usr
>
> on the command line to install sparse into the system.
>
>  DESTDIR=
> -PREFIX=$(HOME)
> +PREFIX ?= $(HOME)

Are you sure you need this patch to use "make install PREFIX=/usr" ?

Variable that assign from the command line will ignore other normal assignment.
You need to use override to assign to command line variables.

This patch can show it:


When I invoke with PREFIX=/usr/local/

$ make PREFIX=/usr/local/ clean
prefix origin: command line value: /usr/local/

So your patch is not needed.

Chris
--
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

Comments

Uwe Kleine-König Sept. 23, 2017, 6:31 p.m. UTC | #1
On Sat, Sep 23, 2017 at 07:20:27AM -0400, Christopher Li wrote:
> On Fri, Sep 22, 2017 at 5:25 PM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
> > This way I can just use
> >
> >         make install PREFIX=/usr
> >
> > on the command line to install sparse into the system.
> >
> >  DESTDIR=
> > -PREFIX=$(HOME)
> > +PREFIX ?= $(HOME)
> 
> Are you sure you need this patch to use "make install PREFIX=/usr" ?

Oh, you're right. I pass PREFIX via the environment. But as there are
already other things I pass on the command line I can also pass PREFIX
there. I still consider ?= as the right thing to do there, but it's not
important any more. If you still consider the patch fine, I can update
the commit log accordingly.

Best regards
Uwe
Christopher Li Oct. 3, 2017, 4:38 a.m. UTC | #2
On Sat, Sep 23, 2017 at 2:31 PM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>> Are you sure you need this patch to use "make install PREFIX=/usr" ?
>
> Oh, you're right. I pass PREFIX via the environment. But as there are
> already other things I pass on the command line I can also pass PREFIX
> there. I still consider ?= as the right thing to do there, but it's not
> important any more. If you still consider the patch fine, I can update
> the commit log accordingly.

Sorry for the delay. I am catching up with the patches.
I don't mind having the patch if you want to pass PREFIX from the
environment.

Please update the comments.

Thanks

Chris
--
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 a4653aa1..868e7816 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,7 @@  endif

 DESTDIR=
 PREFIX=$(HOME)
+$(info prefix origin: $(origin PREFIX) value: $(PREFIX))
 BINDIR=$(PREFIX)/bin
 LIBDIR=$(PREFIX)/lib
 MANDIR=$(PREFIX)/share/man