[PATCH] contrib/subtree: fix Makefile to respect non-configure `make`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 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@xxxxxxxxx>
---

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]