git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add DEST Makefile variable

From
PRPavel Roskin <proski@gnu.org>
Date
Apr 21, 2005, 23:37 UTC
Message-ID
<1114126624.17161.19.camel@dv>
In-Reply-To
<20050421230732.GA13311@kiste.smurf.noris.de>
Hello!
On Fri, 2005-04-22 at 01:07 +0200, Matthias Urlichs wrote:
Show 15 quoted lines
> 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
Previous: Matthias Urlichs
Message 4 of 4 in “Add DEST Makefile variable”
  1. Add DEST Makefile variableMatthias Urlichs, Apr 21, 2005
  2. Junio C HamanoApr 21, 2005
  3. Matthias UrlichsApr 21, 2005
  4. Pavel RoskinApr 21, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.