1prefix ?= /usr/local
2mandir ?= $(prefix)/share/man
3gitdir ?= $(shell git --exec-path)
4
5gitver ?= $(word 3,$(shell git --version))
6
7# this should be set to a 'standard' bsd-type install program
8INSTALL ?= install
9INSTALL_DATA = $(INSTALL) -c -m 0644
10INSTALL_EXE = $(INSTALL) -c -m 0755
11INSTALL_DIR = $(INSTALL) -c -d -m 0755
12
13default:
14 @echo "git-subtree doesn't need to be built."
15 @echo "Just copy it somewhere on your PATH, like /usr/local/bin."
16 @echo
17 @echo "Try: make doc"
18 @echo " or: make test"
19 @false
20
21install: install-exe install-doc
22
23install-exe: git-subtree.sh
24 $(INSTALL_DIR) $(DESTDIR)/$(gitdir)
25 $(INSTALL_EXE) $< $(DESTDIR)/$(gitdir)/git-subtree
26
27install-doc: git-subtree.1
28 $(INSTALL_DIR) $(DESTDIR)/$(mandir)/man1/
29 $(INSTALL_DATA) $< $(DESTDIR)/$(mandir)/man1/
30
31doc: git-subtree.1
32
33%.1: %.xml
34 xmlto -m manpage-normal.xsl man $^
35
36%.xml: %.txt
37 asciidoc -b docbook -d manpage -f asciidoc.conf \
38 -agit_version=$(gitver) $^
39
40test:
41 ./test.sh
42
43clean:
44 rm -f *~ *.xml *.html *.1
45 rm -rf subproj mainline