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.
32 bpsrc
= $(filter-out %~
,$(wildcard *--*))
33 boilerplates.made
: $(bpsrc
)
34 $(QUIET
)umask
022 && ls
*--* 2>/dev
/null | \
35 while read boilerplate
; \
37 case
"$$boilerplate" in
*~
) continue
;; esac
&& \
38 dst
=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
39 dir=`expr "$$dst" : '\(.*\)/'` && \
40 mkdir
-p blt
/$$dir && \
41 case
"$$boilerplate" in \
44 sed
-e
'1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
45 -e
's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
46 -e
's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
48 if
test -x
"$$boilerplate"; then rx
=rx
; else rx
=r
; fi
&& \
49 chmod a
+$$rx "blt/$$dst" || exit
; \
53 # If you need build-tailored templates, build them into blt/
54 # directory yourself here.
56 $(QUIET
): no custom templates yet
59 $(RM
) -r blt boilerplates.made
62 $(INSTALL
) -d
-m
755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
63 (cd blt
&& $(TAR
) cf
- .
) | \
64 (cd
'$(DESTDIR_SQ)$(template_instdir_SQ)' && umask
022 && $(TAR
) xof
-)