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