Merge branch 'rs/worktree-use-strbuf-absolute-path'
[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 XMLTO    = xmlto
24
25 ifndef SHELL_PATH
26         SHELL_PATH = /bin/sh
27 endif
28 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
29
30 ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
31 MANPAGE_XSL   = ../../Documentation/manpage-normal.xsl
32
33 GIT_SUBTREE_SH := git-subtree.sh
34 GIT_SUBTREE    := git-subtree
35
36 GIT_SUBTREE_DOC := git-subtree.1
37 GIT_SUBTREE_XML := git-subtree.xml
38 GIT_SUBTREE_TXT := git-subtree.txt
39 GIT_SUBTREE_HTML := git-subtree.html
40 GIT_SUBTREE_TEST := ../../git-subtree
41
42 all:: $(GIT_SUBTREE)
43
44 $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
45         sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
46         chmod +x $@
47
48 doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
49
50 install: $(GIT_SUBTREE)
51         $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
52         $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
53
54 install-doc: install-man install-html
55
56 install-man: $(GIT_SUBTREE_DOC)
57         $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
58         $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
59
60 install-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
78 test: $(GIT_SUBTREE_TEST)
79         $(MAKE) -C t/ test
80
81 clean:
82         $(RM) $(GIT_SUBTREE)
83         $(RM) *.xml *.html *.1
84
85 .PHONY: FORCE