The seventh batch
[git/gitster.git] / templates / Makefile
blobbd1e9e30c120032b209fb1d221b9d93eea31c649
1 # Import tree-wide shared Makefile behavior and libraries
2 include ../shared.mak
4 # make and install sample templates
5 INSTALL ?= install
6 TAR ?= tar
7 RM ?= rm -f
8 prefix ?= $(HOME)
9 template_instdir ?= $(prefix)/share/git-core/templates
10 # DESTDIR=
12 ifndef SHELL_PATH
13 SHELL_PATH = /bin/sh
14 endif
15 ifndef PERL_PATH
16 PERL_PATH = perl
17 endif
19 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
20 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
22 # Shell quote (do not use $(call) to accommodate ancient setups);
23 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
24 template_instdir_SQ = $(subst ','\'',$(template_instdir))
26 all: boilerplates.made custom
28 # Put templates that can be copied straight from the source
29 # in a file direc--tory--file in the source. They will be
30 # just copied to the destination.
32 TEMPLATES =
33 TEMPLATES += description
34 TEMPLATES += hooks/applypatch-msg.sample
35 TEMPLATES += hooks/commit-msg.sample
36 TEMPLATES += hooks/fsmonitor-watchman.sample
37 TEMPLATES += hooks/post-update.sample
38 TEMPLATES += hooks/pre-applypatch.sample
39 TEMPLATES += hooks/pre-commit.sample
40 TEMPLATES += hooks/pre-merge-commit.sample
41 TEMPLATES += hooks/prepare-commit-msg.sample
42 TEMPLATES += hooks/pre-push.sample
43 TEMPLATES += hooks/pre-rebase.sample
44 TEMPLATES += hooks/pre-receive.sample
45 TEMPLATES += hooks/push-to-checkout.sample
46 TEMPLATES += hooks/sendemail-validate.sample
47 TEMPLATES += hooks/update.sample
48 TEMPLATES += info/exclude
50 boilerplates.made: $(TEMPLATES)
51 $(QUIET)umask 022 && for template in $(TEMPLATES); \
52 do \
53 dir=$$(dirname "$$template") && \
54 mkdir -p blt/$$dir && \
55 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
56 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
57 -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
58 blt/$$template && \
59 if test -x "$$template"; then rx=rx; else rx=r; fi && \
60 chmod a+$$rx "blt/$$template" || exit; \
61 done && \
62 date >$@
64 # If you need build-tailored templates, build them into blt/
65 # directory yourself here.
66 custom:
67 $(QUIET): no custom templates yet
69 clean:
70 $(RM) -r blt boilerplates.made
72 install: all
73 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
74 (cd blt && $(TAR) cf - .) | \
75 (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)