tg-export: Ensure we don't overwrite a branch by git update-ref
[topgit/greenrd.git] / Makefile
blob6eade1e1679a04f9bae79211cb91ee7fe3c69099
1 # Set PREFIX to wherever you want to install TopGit
2 PREFIX = $(HOME)
3 bindir = $(PREFIX)/bin
4 cmddir = $(PREFIX)/libexec/topgit
5 sharedir = $(PREFIX)/share/topgit
6 hooksdir = $(cmddir)/hooks
9 commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh
10 hooks_in = hooks/pre-commit.sh
12 commands_out = $(patsubst %.sh,%,$(commands_in))
13 hooks_out = $(patsubst %.sh,%,$(hooks_in))
14 help_out = $(patsubst %.sh,%.txt,$(commands_in))
16 all:: tg $(commands_out) $(hooks_out) $(help_out)
18 tg $(commands_out) $(hooks_out): % : %.sh
19 @echo "[SED] $@"
20 @sed -e 's#@cmddir@#$(cmddir)#g;' \
21 -e 's#@hooksdir@#$(hooksdir)#g' \
22 -e 's#@bindir@#$(bindir)#g' \
23 -e 's#@sharedir@#$(sharedir)#g' \
24 $@.sh >$@+ && \
25 chmod +x $@+ && \
26 mv $@+ $@
28 $(help_out): README
29 @CMD=`echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` && \
30 echo '[HELP]' $$CMD && \
31 ./create-help.sh $$CMD
33 install:: all
34 install -d -m 755 "$(bindir)"
35 install tg "$(bindir)"
36 install -d -m 755 "$(cmddir)"
37 install $(commands_out) "$(cmddir)"
38 install -d -m 755 "$(hooksdir)"
39 install $(hooks_out) "$(hooksdir)"
40 install -d -m 755 "$(sharedir)"
41 install -m 644 $(help_out) "$(sharedir)"
43 clean::
44 rm -f tg $(commands_out) $(hooks_out) $(help_out)