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