Subject: Re: [PATCH] Add DEST Makefile variable

From: Pavel Roskin <[email-masked]>
Date: Thu, 21 Apr 2005 19:37:04 -0400

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 <[email-masked]>

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