# [PATCH] Add DEST Makefile variable

4 messages from 2005-04-21 to 2005-04-21. Participants: Matthias Urlichs, Junio C Hamano, Pavel Roskin.
Thread: https://gitlist.dev/t/195

## Matthias Urlichs, 2005-04-21 12:39

Subject: [PATCH] Add DEST Makefile variable
Message-ID: <20050421123904.9F2EB7F8AD@smurf.noris.de>
URL: https://gitlist.dev/e/20050421123904.9F2EB7F8AD%40smurf.noris.de

```
This patch changes the Makefile to add a DEST variable (still defaulting
to ~/bin/) so that people (or scripts) can trivially install git
Somewhere Else.

Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>

--- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/Makefile  (mode:100644 sha1:1fef8e4ae93b2abae2ceb69c265c7c8176fe44c0)
+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/Makefile  (mode:100644 sha1:af90bd4e1d53fa3b930c77a240b4681a0b2a886e)
@@ -8,6 +8,7 @@
 # break unless your underlying filesystem supports those sub-second times
 # (my ext3 doesn't).
 CFLAGS=-g -O3 -Wall
+DEST=$(HOME)/bin
 
 CC=gcc
 AR=ar
@@ -56,7 +57,7 @@
 	@chmod +x $@
 
 install: $(PROG) $(GEN_SCRIPT)
-	install $(PROG) $(SCRIPT) $(GEN_SCRIPT) $(HOME)/bin/
+	install $(PROG) $(SCRIPT) $(GEN_SCRIPT) $(DEST)/
 
 clean:
 	rm -f *.o $(PROG) $(GEN_SCRIPT) $(LIB_FILE)

```

## Junio C Hamano, 2005-04-21 22:59

Subject: Re: [PATCH] Add DEST Makefile variable
Message-ID: <7vr7h3d9cu.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vr7h3d9cu.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050421123904.9F2EB7F8AD@smurf.noris.de>

```
>>>>> "MU" == Matthias Urlichs <smurf@smurf.noris.de> writes:

MU>  # (my ext3 doesn't).
MU>  CFLAGS=-g -O3 -Wall
MU> +DEST=$(HOME)/bin
 
MU>  install: $(PROG) $(GEN_SCRIPT)
MU> -	install $(PROG) $(SCRIPT) $(GEN_SCRIPT) $(HOME)/bin/
MU> +	install $(PROG) $(SCRIPT) $(GEN_SCRIPT) $(DEST)/
 
I sent essentially the same some time ago and got a comment to
follow established naming convention.

Many people seem to call What you are calling DEST above BINDIR
and DEST or DESTDIR usually means something completely
different.  It goes like this:

    # DESTDIR=
    BINDIR=$(HOME)/bin

    install:
            install foobar $(DESTDIR)$(BINDIR)/

  $ su ;# personal machine install by local root
  # make BINDIR=/usr/local/bin install

  # binary package creation
  $ make BINDIR=/usr/bin DESTDIR=/var/tmp/tmp-inst install
  $ tar Ccf /var/tmp/tmp-inst tarball.tar.gz .


```

## Matthias Urlichs, 2005-04-21 23:07

Subject: Re: [PATCH] Add DEST Makefile variable
Message-ID: <20050421230732.GA13311@kiste.smurf.noris.de>
URL: https://gitlist.dev/e/20050421230732.GA13311%40kiste.smurf.noris.de
In-Reply-To: <7vr7h3d9cu.fsf@assigned-by-dhcp.cox.net>

```
Hi,

Junio C Hamano:
> I sent essentially the same some time ago and got a comment to
> follow established naming convention.
> 
Well, for a Makefile which installs in basically one directory, that
seems to be overkill.

>     # DESTDIR=
>     BINDIR=$(HOME)/bin
>             install foobar $(DESTDIR)$(BINDIR)/
> 
That doesn't make sense; if you set DESTDIR, you are not going to
install in $HOME.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

```

## Pavel Roskin, 2005-04-21 23:37

Subject: Re: [PATCH] Add DEST Makefile variable
Message-ID: <1114126624.17161.19.camel@dv>
URL: https://gitlist.dev/e/1114126624.17161.19.camel%40dv
In-Reply-To: <20050421230732.GA13311@kiste.smurf.noris.de>

```
Hello!

On Fri, 2005-04-22 at 01:07 +0200, Matthias Urlichs wrote:
> Hi,
> 
> Junio C Hamano:
> > I sent essentially the same some time ago and got a comment to
> > follow established naming convention.
> > 
> Well, for a Makefile which installs in basically one directory, that
> seems to be overkill.
> 
> >     # DESTDIR=
> >     BINDIR=$(HOME)/bin
> >             install foobar $(DESTDIR)$(BINDIR)/
> > 
> That doesn't make sense; if you set DESTDIR, you are not going to
> install in $HOME.

It makes sense to stick with conventions.  DESTDIR is almost always set
by a script for making a package, and that script will likely set prefix
to /usr.

prefix is set to $HOME temporarily.  It should be changed to /usr/local
some day.  It's not uncommon for $HOME to be shared between systems with
different architectures, so ideally no binaries should be installed
there.  I guess $HOME is used to save typing "su" or redefining prefix
in a project that changes every 10 minutes or so.  But once git
stabilizes, there will be no excuse.

By the way, we need to change prefix and bindir to be lowercase for
compatibility with GNU standards.  Also, ifdef is not needed - command
line trumps even unconditional variable assignments.  Another thing to
fix - DESTDIR is not used when bindir is created.

Signed-off-by: Pavel Roskin <proski@gnu.org>

--- a/Makefile
+++ b/Makefile
@@ -14,12 +14,10 @@
 # (my ext3 doesn't).
 CFLAGS=-g -O2 -Wall
 
-ifndef PREFIX
-PREFIX=$(HOME)
-endif
-ifndef BINDIR
-BINDIR=$(PREFIX)/bin
-endif
+# Should be changed to /usr/local
+prefix=$(HOME)
+
+bindir=$(prefix)/bin
 
 CC=gcc
 AR=ar
@@ -81,8 +79,8 @@ gitversion.sh: $(VERSION)
 
 
 install: $(PROG) $(GEN_SCRIPT)
-	install -m755 -d $(BINDIR)
-	install $(PROG) $(SCRIPT) $(GEN_SCRIPT) $(DESTDIR)$(BINDIR)
+	install -m755 -d $(DESTDIR)$(bindir)
+	install $(PROG) $(SCRIPT) $(GEN_SCRIPT) $(DESTDIR)$(bindir)
 
 clean:
 	rm -f *.o mozilla-sha1/*.o $(PROG) $(GEN_SCRIPT) $(LIB_FILE)


-- 
Regards,
Pavel Roskin


```
