Fix contrib/subtree Makefile to patch #! line
[git.git] / contrib / subtree / Makefile
blobd9a0ce2c6337b906617306f466139b5f486a753d
1 -include ../../config.mak.autogen
2 -include ../../config.mak
4 prefix ?= /usr/local
5 mandir ?= $(prefix)/share/man
6 gitexecdir ?= $(prefix)/libexec/git-core
7 man1dir ?= $(mandir)/man1
9 ../../GIT-VERSION-FILE: FORCE
10 $(MAKE) -C ../../ GIT-VERSION-FILE
12 -include ../../GIT-VERSION-FILE
14 # this should be set to a 'standard' bsd-type install program
15 INSTALL ?= install
16 RM ?= rm -f
18 ASCIIDOC = asciidoc
19 XMLTO = xmlto
21 ifndef SHELL_PATH
22 SHELL_PATH = /bin/sh
23 endif
24 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
26 ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
27 MANPAGE_XSL = ../../Documentation/manpage-normal.xsl
29 GIT_SUBTREE_SH := git-subtree.sh
30 GIT_SUBTREE := git-subtree
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
37 all: $(GIT_SUBTREE)
39 $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
40 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
41 chmod +x $@
43 doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)
45 install: $(GIT_SUBTREE)
46 $(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
47 $(INSTALL) -m 755 $(GIT_SUBTREE) $(DESTDIR)$(gitexecdir)
49 install-doc: install-man
51 install-man: $(GIT_SUBTREE_DOC)
52 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
53 $(INSTALL) -m 644 $^ $(DESTDIR)$(man1dir)
55 $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
56 $(XMLTO) -m $(MANPAGE_XSL) man $^
58 $(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
59 $(ASCIIDOC) -b docbook -d manpage -f $(ASCIIDOC_CONF) \
60 -agit_version=$(GIT_VERSION) $^
62 $(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
63 $(ASCIIDOC) -b xhtml11 -d manpage -f $(ASCIIDOC_CONF) \
64 -agit_version=$(GIT_VERSION) $^
66 test:
67 $(MAKE) -C t/ test
69 clean:
70 $(RM) $(GIT_SUBTREE)
71 $(RM) *.xml *.html *.1
73 .PHONY: FORCE