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