Merge branch 'rs/export-strbuf-addchars'
[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 mandir ?= $(prefix)/share/man
9 gitexecdir ?= $(prefix)/libexec/git-core
10 man1dir ?= $(mandir)/man1
11
12 ../../GIT-VERSION-FILE: FORCE
13         $(MAKE) -C ../../ GIT-VERSION-FILE
14
15 -include ../../GIT-VERSION-FILE
16
17 # this should be set to a 'standard' bsd-type install program
18 INSTALL  ?= install
19 RM       ?= rm -f
20
21 ASCIIDOC = asciidoc
22 XMLTO    = xmlto
23
24 ifndef SHELL_PATH
25         SHELL_PATH = /bin/sh
26 endif
27 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
28
29 ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
30 MANPAGE_XSL   = ../../Documentation/manpage-normal.xsl
31
32 GIT_SUBTREE_SH := git-subtree.sh
33 GIT_SUBTREE    := git-subtree
34
35 GIT_SUBTREE_DOC := git-subtree.1
36 GIT_SUBTREE_XML := git-subtree.xml
37 GIT_SUBTREE_TXT := git-subtree.txt
38 GIT_SUBTREE_HTML := git-subtree.html
39
40 all:: $(GIT_SUBTREE)
41
42 $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
43         sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
44         chmod +x $@
45
46 doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
47
48 install: $(GIT_SUBTREE)
49         $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
50         $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
51
52 install-doc: install-man
53
54 install-man: $(GIT_SUBTREE_DOC)
55         $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
56         $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
57
58 $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
59         $(XMLTO) -m $(MANPAGE_XSL) man $^
60
61 $(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
62         $(ASCIIDOC) -b docbook -d manpage -f $(ASCIIDOC_CONF) \
63                 -agit_version=$(GIT_VERSION) $^
64
65 $(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
66         $(ASCIIDOC) -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \
67                 -agit_version=$(GIT_VERSION) $^
68
69 test:
70         $(MAKE) -C t/ test
71
72 clean:
73         $(RM) $(GIT_SUBTREE)
74         $(RM) *.xml *.html *.1
75
76 .PHONY: FORCE