git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan McGee <dpmcgee@gmail.com>
To: git@vger.kernel.org, "David A. Greene" <greened@obbligato.org>
Subject: [PATCH] contrib/subtree: fix Makefile to respect non-configure `make`
Date: Sun,  1 Jul 2012 13:55:13 -0500	[thread overview]
Message-ID: <1341168913-14598-1-git-send-email-dpmcgee@gmail.com> (raw)

* DESTDIR being defined had no effect.
* prefix was handled inconsistently.
* Unlike the top-level Makefile, this required libexecdir to be defined,
  not gitexecdir.
* The Makefile assumed the git it could use via the shell was the
  correct version, which is not true at all from a packager's
  standpoint. Don't shell out to git at all, use the standard version
  logic like Documentation/ does.

After these changes, it is actually possible to install git-subtree when
packaging git into a temporary install directory, rather than installing
it on the running system.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---

Packaging this tool in the git package for Arch Linux turned out to be much
more of a process than I expected. We've used the non-configure-based make
system since git has been in our repositories, and it looks like the install
process for this command was never tested with this build system.

The one thing I didn't do here was add some of the sophistication around
relative vs. absolute paths in mandir and gitexecdir that the top-level
Makefile performs. Opinions or thoughts on that? This version will support
relative paths only.

 contrib/subtree/Makefile | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile
index 05cdd5c..919464a 100644
--- a/contrib/subtree/Makefile
+++ b/contrib/subtree/Makefile
@@ -2,12 +2,14 @@
 -include ../../config.mak
 
 prefix ?= /usr/local
-mandir ?= $(prefix)/share/man
-libexecdir ?= $(prefix)/libexec/git-core
-gitdir ?= $(shell git --exec-path)
+mandir ?= share/man
+gitexecdir ?= libexec/git-core
 man1dir ?= $(mandir)/man1
 
-gitver ?= $(word 3,$(shell git --version))
+../../GIT-VERSION-FILE: FORCE
+	$(MAKE) -C ../../ GIT-VERSION-FILE
+
+-include ../../GIT-VERSION-FILE
 
 # this should be set to a 'standard' bsd-type install program
 INSTALL ?= install
@@ -30,19 +32,19 @@ $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
 doc: $(GIT_SUBTREE_DOC)
 
 install: $(GIT_SUBTREE)
-	$(INSTALL) -m 755 $(GIT_SUBTREE) $(libexecdir)
+	$(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(prefix)/$(gitexecdir)
 
 install-doc: install-man
 
 install-man: $(GIT_SUBTREE_DOC)
-	$(INSTALL) -m 644 $^ $(man1dir)
+	$(INSTALL) -m 644 $^ $(DESTDIR)$(prefix)/$(man1dir)
 
 $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
 	xmlto -m $(MANPAGE_NORMAL_XSL)  man $^
 
 $(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
 	asciidoc -b docbook -d manpage -f $(ASCIIDOC_CONF) \
-		-agit_version=$(gitver) $^
+		-agit_version=$(GIT_VERSION) $^
 
 test:
 	$(MAKE) -C t/ test
@@ -50,3 +52,5 @@ test:
 clean:
 	rm -f *~ *.xml *.html *.1
 	rm -rf subproj mainline
+
+.PHONY: FORCE
-- 
1.7.11.1

             reply	other threads:[~2012-07-01 18:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01 18:55 Dan McGee [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-02-27 13:09 [PATCH] contrib/subtree: fix Makefile to respect non-configure `make` Jan Rueegg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341168913-14598-1-git-send-email-dpmcgee@gmail.com \
    --to=dpmcgee@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=greened@obbligato.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).