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
23ASCIIDOC_CONF = -f ../../Documentation/asciidoc.conf
24ASCIIDOC_HTML = xhtml11
25ASCIIDOC_DOCBOOK = docbook
26ASCIIDOC_EXTRA =
27XMLTO = xmlto
28
29ifdef USE_ASCIIDOCTOR
30ASCIIDOC = asciidoctor
31ASCIIDOC_CONF =
32ASCIIDOC_HTML = xhtml5
33ASCIIDOC_DOCBOOK = docbook45
34ASCIIDOC_EXTRA += -I../../Documentation -rasciidoctor-extensions
35ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
36endif
37
38ifndef SHELL_PATH
39 SHELL_PATH = /bin/sh
40endif
41SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
42
43MANPAGE_XSL = ../../Documentation/manpage-normal.xsl
44
45GIT_SUBTREE_SH := git-subtree.sh
46GIT_SUBTREE := git-subtree
47
48GIT_SUBTREE_DOC := git-subtree.1
49GIT_SUBTREE_XML := git-subtree.xml
50GIT_SUBTREE_TXT := git-subtree.txt
51GIT_SUBTREE_HTML := git-subtree.html
52GIT_SUBTREE_TEST := ../../git-subtree
53
54all:: $(GIT_SUBTREE)
55
56$(GIT_SUBTREE): $(GIT_SUBTREE_SH)
57 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
58 chmod +x $@
59
60doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
61
62install: $(GIT_SUBTREE)
63 $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
64 $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
65
66install-doc: install-man install-html
67
68install-man: $(GIT_SUBTREE_DOC)
69 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
70 $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
71
72install-html: $(GIT_SUBTREE_HTML)
73 $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir)
74 $(INSTALL) -m 644 $^ $(DESTDIR)$(htmldir)
75
76$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
77 $(XMLTO) -m $(MANPAGE_XSL) man $^
78
79$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
80 $(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \
81 -agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
82
83$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
84 $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \
85 -agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
86
87$(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
88 cp $< $@
89
90test: $(GIT_SUBTREE_TEST)
91 $(MAKE) -C t/ test
92
93clean:
94 $(RM) $(GIT_SUBTREE)
95 $(RM) *.xml *.html *.1
96
97.PHONY: FORCE