tg import: Remove tg_ prefixes from functions
[topgit.git] / Makefile
blobb73a1f15b9c298e0e922df1c61f6fb15df8f7821
1 prefix = $(HOME)
2 bindir = $(prefix)/bin
3 cmddir = $(prefix)/libexec/topgit
4 sharedir = $(prefix)/share/topgit
5 hooksdir = $(cmddir)/hooks
8 commands_in = $(wildcard tg-*.sh)
9 hooks_in = hooks/pre-commit.sh
11 commands_out = $(patsubst %.sh,%,$(commands_in))
12 hooks_out = $(patsubst %.sh,%,$(hooks_in))
13 help_out = $(patsubst %.sh,%.txt,$(commands_in))
15 all:: tg $(commands_out) $(hooks_out) $(help_out)
17 tg $(commands_out) $(hooks_out): % : %.sh
18 @echo "[SED] $@"
19 @sed -e 's#@cmddir@#$(cmddir)#g;' \
20 -e 's#@hooksdir@#$(hooksdir)#g' \
21 -e 's#@bindir@#$(bindir)#g' \
22 -e 's#@sharedir@#$(sharedir)#g' \
23 $@.sh >$@+ && \
24 chmod +x $@+ && \
25 mv $@+ $@
27 $(help_out): README
28 @CMD=`echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` && \
29 echo '[HELP]' $$CMD && \
30 ./create-help.sh $$CMD
32 install:: all
33 install -d -m 755 "$(DESTDIR)$(bindir)"
34 install tg "$(DESTDIR)$(bindir)"
35 install -d -m 755 "$(DESTDIR)$(cmddir)"
36 install $(commands_out) "$(DESTDIR)$(cmddir)"
37 install -d -m 755 "$(DESTDIR)$(hooksdir)"
38 install $(hooks_out) "$(DESTDIR)$(hooksdir)"
39 install -d -m 755 "$(DESTDIR)$(sharedir)"
40 install -m 644 $(help_out) "$(DESTDIR)$(sharedir)"
42 clean::
43 rm -f tg $(commands_out) $(hooks_out) $(help_out)