1 # make and install sample templates
6 template_dir ?
= $(prefix)/share
/git-core
/templates
/
10 # Result of this needs to be placed inside ''
11 shq
= $(subst ','\'',$(1))
12 # This has surrounding ''
13 shellquote = '$(call shq
,$(1))'
15 all: boilerplates.made custom
17 # Put templates that can be copied straight from the source
18 # in a file direc--tory--file in the source. They will be
19 # just copied to the destination.
21 bpsrc = $(filter-out %~,$(wildcard *--*))
22 boilerplates.made : $(bpsrc)
23 ls *--* 2>/dev/null | \
24 while read boilerplate; \
26 case "$$boilerplate" in *~) continue ;; esac && \
27 dst=`echo "$$boilerplate" | sed -e 's|^this|.|
;s|
--|
/|g
'` && \
28 dir=`expr "$$dst" : '\
(.
*\
)/'` && \
29 mkdir -p blt/$$dir && \
30 case "$$boilerplate" in \
32 *) cp $$boilerplate blt/$$dst ;; \
37 # If you need build-tailored templates, build them into blt/
38 # directory yourself here.
40 : no custom templates yet
43 rm -rf blt boilerplates.made
46 $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(template_dir))
47 (cd blt && $(TAR) cf - .) | \
48 (cd $(call shellquote,$(DESTDIR)$(template_dir)) && $(TAR) xf -)