Merge branch 'jk/tag-sort'
[gitweb.git] / contrib / subtree / Makefile
index d888d4516114c719e46ab7f2aeb24e63618b7fac..d9a0ce2c6337b906617306f466139b5f486a753d 100644 (file)
@@ -18,6 +18,11 @@ RM       ?= rm -f
 ASCIIDOC = asciidoc
 XMLTO    = xmlto
 
+ifndef SHELL_PATH
+       SHELL_PATH = /bin/sh
+endif
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
 ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
 MANPAGE_XSL   = ../../Documentation/manpage-normal.xsl
 
@@ -32,7 +37,8 @@ GIT_SUBTREE_HTML := git-subtree.html
 all: $(GIT_SUBTREE)
 
 $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
-       cp $< $@ && chmod +x $@
+       sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
+       chmod +x $@
 
 doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)