5 cmddir
= $(prefix)/libexec
/topgit
6 sharedir
= $(prefix)/share
/topgit
7 hooksdir
= $(cmddir
)/hooks
9 commands_in
:= $(wildcard tg-
*.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 version
:= $(shell test -d .git
&& git describe
--match
"topgit-[0-9]*" --abbrev
=4 --dirty
2>/dev
/null | sed
-e
's/^topgit-//' )
20 ifneq ($(strip $(version
)),)
21 version_arg
= -e s
/TG_VERSION
=.
*/TG_VERSION
=$(version
)/
26 all:: precheck
$(commands_out
) $(hooks_out
) $(help_out
)
28 tg
$(commands_out
) $(hooks_out
): % : %.sh Makefile TG-PREFIX
30 @sed
-e
's#@cmddir@#$(cmddir)#g;' \
31 -e
's#@hooksdir@#$(hooksdir)#g' \
32 -e
's#@bindir@#$(bindir)#g' \
33 -e
's#@sharedir@#$(sharedir)#g' \
39 $(help_out
): README create-help.sh
40 @CMD
=`echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` && \
41 echo
'[HELP]' $$CMD && \
42 .
/create-help.sh
$$CMD
48 @echo skipping precheck because DESTDIR is set
52 install -d
-m
755 "$(DESTDIR)$(bindir)"
53 install tg
"$(DESTDIR)$(bindir)"
54 install -d
-m
755 "$(DESTDIR)$(cmddir)"
55 install $(commands_out
) "$(DESTDIR)$(cmddir)"
56 install -d
-m
755 "$(DESTDIR)$(hooksdir)"
57 install $(hooks_out
) "$(DESTDIR)$(hooksdir)"
58 install -d
-m
755 "$(DESTDIR)$(sharedir)"
59 install -m
644 $(help_out
) "$(DESTDIR)$(sharedir)"
60 install -m
644 README
"$(DESTDIR)$(sharedir)/tg-tg.txt"
61 install -m
644 leaves.awk
"$(DESTDIR)$(sharedir)"
64 rm -f tg
$(commands_out
) $(hooks_out
) $(help_out
)
68 $(bindir):$(cmddir
):$(hooksdir
):$(sharedir
):$(version
)
73 @if
test x
"$$TRACK_PREFIX" != x
"`cat TG-PREFIX 2>/dev/null`"; then \
74 echo
"* new prefix flags"; \
75 echo
"$$TRACK_PREFIX" >TG-PREFIX
; \