Pretty print the help creation commands in Makefile.
[topgit.git] / Makefile
blob2975f295d637bd1d840ff57436e032614e2bd231
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-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 tg "$(bindir)"
35 install -d -m 755 "$(cmddir)"
36 install $(commands_out) "$(cmddir)"
37 install -d -m 755 "$(hooksdir)"
38 install $(hooks_out) "$(hooksdir)"
39 install -d -m 755 "$(sharedir)"
40 install $(help_out) "$(sharedir)"
42 clean::
43 rm -f tg $(commands_out) $(hooks_out) $(help_out)