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
40GIT_SUBTREE_TEST := ../../git-subtree
41
42all:: $(GIT_SUBTREE)
43
44$(GIT_SUBTREE): $(GIT_SUBTREE_SH)
45 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
46 chmod +x $@
47
48doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
49
50install: $(GIT_SUBTREE)
51 $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
52 $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
53
54install-doc: install-man install-html
55
56install-man: $(GIT_SUBTREE_DOC)
57 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
58 $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
59
60install-html: $(GIT_SUBTREE_HTML)
61 $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir)
62 $(INSTALL) -m 644 $^ $(DESTDIR)$(htmldir)
63
64$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
65 $(XMLTO) -m $(MANPAGE_XSL) man $^
66
67$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
68 $(ASCIIDOC) -b docbook -d manpage -f $(ASCIIDOC_CONF) \
69 -agit_version=$(GIT_VERSION) $^
70
71$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
72 $(ASCIIDOC) -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \
73 -agit_version=$(GIT_VERSION) $^
74
75$(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
76 cp $< $@
77
78test: $(GIT_SUBTREE_TEST)
79 $(MAKE) -C t/ test
80
81clean:
82 $(RM) $(GIT_SUBTREE)
83 $(RM) *.xml *.html *.1
84
85.PHONY: FORCE