chiark / gitweb /
Check for pre-commit hook existence.
[topgit.git] / Makefile
1 # Set PREFIX to wherever you want to install TopGit
2 PREFIX = $(HOME)
3 bindir = $(PREFIX)/bin
4 cmddir = $(PREFIX)/libexec/topgit
5 hooksdir = $(cmddir)/hooks
6
7
8 commands_in = tg-create.sh tg-delete.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh
9 hooks_in = hooks/pre-commit.sh
10
11 commands_out = $(patsubst %.sh,%,$(commands_in))
12 hooks_out = $(patsubst %.sh,%,$(hooks_in))
13
14 all::   tg $(commands_out) $(hooks_out)
15
16 tg $(commands_out) $(hooks_out): % : %.sh
17         @echo "[SED] $@"
18         @sed -e 's#@cmddir@#$(cmddir)#g;' \
19                 -e 's#@hooksdir@#$(hooksdir)#g' \
20                 -e 's#@bindir@#$(bindir)#g' \
21                 $@.sh >$@+ && \
22         chmod +x $@+ && \
23         mv $@+ $@
24
25
26 install:: all
27         install tg "$(bindir)"
28         install -d -m 755 "$(cmddir)"
29         install $(commands_out) "$(cmddir)"
30         install -d -m 755 "$(hooksdir)"
31         install $(hooks_out) "$(hooksdir)"
32
33 clean::
34         rm -f tg $(commands_out) $(hooks_out)