1 # make and install sample templates
11 template_instdir ?
= $(prefix)/share
/git-core
/templates
21 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
22 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH
))
24 # Shell quote (do not use $(call) to accommodate ancient setups);
25 DESTDIR_SQ
= $(subst ','\'',$(DESTDIR))
26 template_instdir_SQ = $(subst ','\'',$(template_instdir
))
28 all: boilerplates.made custom
30 # Put templates that can be copied straight from the source
31 # in a file direc--tory--file in the source. They will be
32 # just copied to the destination.
34 bpsrc
= $(filter-out %~
,$(wildcard *--*))
35 boilerplates.made
: $(bpsrc
)
36 $(QUIET
)umask
022 && ls
*--* 2>/dev
/null | \
37 while read boilerplate
; \
39 case
"$$boilerplate" in
*~
) continue
;; esac
&& \
40 dst
=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
41 dir=`expr "$$dst" : '\(.*\)/'` && \
42 mkdir
-p blt
/$$dir && \
43 case
"$$boilerplate" in \
46 sed
-e
'1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
47 -e
's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
48 -e
's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
50 if
test -x
"$$boilerplate"; then rx
=rx
; else rx
=r
; fi
&& \
51 chmod a
+$$rx "blt/$$dst" || exit
; \
55 # If you need build-tailored templates, build them into blt/
56 # directory yourself here.
58 $(QUIET
): no custom templates yet
61 $(RM
) -r blt boilerplates.made
64 $(INSTALL
) -d
-m
755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
65 (cd blt
&& $(TAR
) cf
- .
) | \
66 (cd
'$(DESTDIR_SQ)$(template_instdir_SQ)' && umask
022 && $(TAR
) xof
-)