1 # Import tree-wide shared Makefile behavior and libraries
4 # make and install sample templates
9 template_instdir ?
= $(prefix)/share
/git-core
/templates
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.
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
); \
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 > \
59 if
test -x
"$$template"; then rx
=rx
; else rx
=r
; fi
&& \
60 chmod a
+$$rx "blt/$$template" || exit
; \
64 # If you need build-tailored templates, build them into blt/
65 # directory yourself here.
67 $(QUIET
): no custom templates yet
70 $(RM
) -r blt boilerplates.made
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
-)