1-include ../../config.mak.autogen
2-include ../../config.mak
3
4prefix ?= /usr/local
5mandir ?= $(prefix)/share/man
6gitexecdir ?= $(prefix)/libexec/git-core
7man1dir ?= $(mandir)/man1
8
9../../GIT-VERSION-FILE: FORCE
10 $(MAKE) -C ../../ GIT-VERSION-FILE
11
12-include ../../GIT-VERSION-FILE
13
14# this should be set to a 'standard' bsd-type install program
15INSTALL ?= install
16RM ?= rm -f
17
18ASCIIDOC = asciidoc
19XMLTO = xmlto
20
21ifndef SHELL_PATH
22 SHELL_PATH = /bin/sh
23endif
24SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
25
26ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
27MANPAGE_XSL = ../../Documentation/manpage-normal.xsl
28
29GIT_SUBTREE_SH := git-subtree.sh
30GIT_SUBTREE := git-subtree
31
32GIT_SUBTREE_DOC := git-subtree.1
33GIT_SUBTREE_XML := git-subtree.xml
34GIT_SUBTREE_TXT := git-subtree.txt
35GIT_SUBTREE_HTML := git-subtree.html
36
37all: $(GIT_SUBTREE)
38
39$(GIT_SUBTREE): $(GIT_SUBTREE_SH)
40 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
41 chmod +x $@
42
43doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
44
45install: $(GIT_SUBTREE)
46 $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
47 $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
48
49install-doc: install-man
50
51install-man: $(GIT_SUBTREE_DOC)
52 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
53 $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
54
55$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
56 $(XMLTO) -m $(MANPAGE_XSL) man $^
57
58$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
59 $(ASCIIDOC) -b docbook -d manpage -f $(ASCIIDOC_CONF) \
60 -agit_version=$(GIT_VERSION) $^
61
62$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
63 $(ASCIIDOC) -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \
64 -agit_version=$(GIT_VERSION) $^
65
66test:
67 $(MAKE) -C t/ test
68
69clean:
70 $(RM) $(GIT_SUBTREE)
71 $(RM) *.xml *.html *.1
72
73.PHONY: FORCE