Merge branch 'jk/remote-insteadof-cleanup'
[git] / contrib / subtree / Makefile
1 # The default target of this Makefile is...
2 all::
3
4 -include ../../config.mak.autogen
5 -include ../../config.mak
6
7 prefix ?= /usr/local
8 gitexecdir ?= $(prefix)/libexec/git-core
9 mandir ?= $(prefix)/share/man
10 man1dir ?= $(mandir)/man1
11 htmldir ?= $(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
19 INSTALL  ?= install
20 RM       ?= rm -f
21
22 ASCIIDOC         = asciidoc
23 ASCIIDOC_CONF    = -f ../../Documentation/asciidoc.conf
24 ASCIIDOC_HTML    = xhtml11
25 ASCIIDOC_DOCBOOK = docbook
26 ASCIIDOC_EXTRA   =
27 XMLTO            = xmlto
28
29 ifdef USE_ASCIIDOCTOR
30 ASCIIDOC         = asciidoctor
31 ASCIIDOC_CONF    =
32 ASCIIDOC_HTML    = xhtml5
33 ASCIIDOC_DOCBOOK = docbook45
34 ASCIIDOC_EXTRA  += -I../../Documentation -rasciidoctor-extensions
35 ASCIIDOC_EXTRA  += -alitdd='&\#x2d;&\#x2d;'
36 endif
37
38 ifndef SHELL_PATH
39         SHELL_PATH = /bin/sh
40 endif
41 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
42
43 MANPAGE_XSL   = ../../Documentation/manpage-normal.xsl
44
45 GIT_SUBTREE_SH := git-subtree.sh
46 GIT_SUBTREE    := git-subtree
47
48 GIT_SUBTREE_DOC := git-subtree.1
49 GIT_SUBTREE_XML := git-subtree.xml
50 GIT_SUBTREE_TXT := git-subtree.txt
51 GIT_SUBTREE_HTML := git-subtree.html
52 GIT_SUBTREE_TEST := ../../git-subtree
53
54 all:: $(GIT_SUBTREE)
55
56 $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
57         sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
58         chmod +x $@
59
60 doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
61
62 man: $(GIT_SUBTREE_DOC)
63
64 html: $(GIT_SUBTREE_HTML)
65
66 install: $(GIT_SUBTREE)
67         $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
68         $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
69
70 install-doc: install-man install-html
71
72 install-man: $(GIT_SUBTREE_DOC)
73         $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
74         $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
75
76 install-html: $(GIT_SUBTREE_HTML)
77         $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir)
78         $(INSTALL) -m 644 $^ $(DESTDIR)$(htmldir)
79
80 $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
81         $(XMLTO) -m $(MANPAGE_XSL) man $^
82
83 $(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
84         $(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \
85                 -agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
86
87 $(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
88         $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \
89                 -agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
90
91 $(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
92         cp $< $@
93
94 test: $(GIT_SUBTREE_TEST)
95         $(MAKE) -C t/ test
96
97 clean:
98         $(RM) $(GIT_SUBTREE)
99         $(RM) *.xml *.html *.1
100
101 .PHONY: FORCE