Merge branch 'jk/maint-gitweb-test-use-sane-perl'
[gitweb.git] / contrib / subtree / Makefile
index 91e0cc08ea514a954bd3bab035baf0eadac6644e..05cdd5c9b2fe5210b9780d394b319ddf289a9eeb 100644 (file)
@@ -1,44 +1,51 @@
+-include ../../config.mak.autogen
+-include ../../config.mak
+
 prefix ?= /usr/local
 mandir ?= $(prefix)/share/man
+libexecdir ?= $(prefix)/libexec/git-core
 gitdir ?= $(shell git --exec-path)
+man1dir ?= $(mandir)/man1
 
 gitver ?= $(word 3,$(shell git --version))
 
 # this should be set to a 'standard' bsd-type install program
 INSTALL ?= install
-INSTALL_DATA = $(INSTALL) -c -m 0644
-INSTALL_EXE = $(INSTALL) -c -m 0755
-INSTALL_DIR = $(INSTALL) -c -d -m 0755
 
-default:
-       @echo "git-subtree doesn't need to be built."
-       @echo "Just copy it somewhere on your PATH, like /usr/local/bin."
-       @echo
-       @echo "Try: make doc"
-       @echo " or: make test"
-       @false
+ASCIIDOC_CONF      = ../../Documentation/asciidoc.conf
+MANPAGE_NORMAL_XSL =  ../../Documentation/manpage-normal.xsl
+
+GIT_SUBTREE_SH := git-subtree.sh
+GIT_SUBTREE    := git-subtree
+
+GIT_SUBTREE_DOC := git-subtree.1
+GIT_SUBTREE_XML := git-subtree.xml
+GIT_SUBTREE_TXT := git-subtree.txt
 
-install: install-exe install-doc
+all: $(GIT_SUBTREE)
 
-install-exe: git-subtree.sh
-       $(INSTALL_DIR) $(DESTDIR)/$(gitdir)
-       $(INSTALL_EXE) $< $(DESTDIR)/$(gitdir)/git-subtree
+$(GIT_SUBTREE): $(GIT_SUBTREE_SH)
+       cp $< $@ && chmod +x $@
 
-install-doc: git-subtree.1
-       $(INSTALL_DIR) $(DESTDIR)/$(mandir)/man1/
-       $(INSTALL_DATA) $< $(DESTDIR)/$(mandir)/man1/
+doc: $(GIT_SUBTREE_DOC)
 
-doc: git-subtree.1
+install: $(GIT_SUBTREE)
+       $(INSTALL) -m 755 $(GIT_SUBTREE) $(libexecdir)
 
-%.1: %.xml
-       xmlto -m manpage-normal.xsl  man $^
+install-doc: install-man
 
-%.xml: %.txt
-       asciidoc -b docbook -d manpage -f asciidoc.conf \
+install-man: $(GIT_SUBTREE_DOC)
+       $(INSTALL) -m 644 $^ $(man1dir)
+
+$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
+       xmlto -m $(MANPAGE_NORMAL_XSL)  man $^
+
+$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
+       asciidoc -b docbook -d manpage -f $(ASCIIDOC_CONF) \
                -agit_version=$(gitver) $^
-               
+
 test:
-       ./test.sh
+       $(MAKE) -C t/ test
 
 clean:
        rm -f *~ *.xml *.html *.1