build-sys: when warning, also tell how to install git hooks.
[profile/ivi/murphy.git] / Makefile.am
1 SUBDIRS  = . src doc
2 doc_DATA = AUTHORS ChangeLog COPYING INSTALL NEWS README
3
4 # This is the only way with automake I know of to force 'check-git-hooks'
5 # to be evaluated before 'all'. If there is a nicer way, I'm all ears...
6 BUILT_SOURCES = check-git-hooks
7
8 ###################################
9 # git hook management
10 #
11
12 install-git-hooks:
13         if test -d .git; then                                       \
14             for hook in githooks/???*; do                           \
15                 case $$hook in                                      \
16                     *.sample|*~|*.swp) continue;;                   \
17                 esac;                                               \
18                 if test -x $$hook; then                             \
19                     echo "Installing git hook $${hook##*/}...";     \
20                     cp $$hook .git/hooks;                           \
21                     chmod a+x .git/hooks/$${hook##*/};              \
22                 fi                                                  \
23             done                                                    \
24         fi
25
26 check-git-hooks:
27         if test -d .git; then                                                \
28             for hook in githooks/???*; do                                    \
29                 case $$hook in                                               \
30                     *.sample|*~|*.swp) continue;;                            \
31                 esac;                                                        \
32                 if test -x $$hook -a ! -e .git/hooks/$${hook##*/}; then      \
33                     echo "";                                                 \
34                     echo "WARNING:";                                         \
35                     echo "WARNING: You have an uninstalled git hook $$hook"; \
36                     echo "WARNING: Please, consider taking it into use by";  \
37                     echo "WARNING: running 'make install-git-hooks'...";     \
38                     echo "WARNING:";                                         \
39                     echo "";                                                 \
40                 fi                                                           \
41             done                                                             \
42         fi
43
44
45 # cleanup
46 clean-local:
47         rm -f *~