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