git-am.txt is no stub anymore
[git/dscho.git] / templates / Makefile
blob07e928e56dd00678fdbe092b65bd16f7b7edfcc7
1 # make and install sample templates
3 INSTALL ?= install
4 TAR ?= tar
5 prefix ?= $(HOME)
6 template_dir ?= $(prefix)/share/git-core/templates/
7 # DESTDIR=
9 # Shell quote;
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
16 find blt
18 # Put templates that can be copied straight from the source
19 # in a file direc--tory--file in the source. They will be
20 # just copied to the destination.
22 bpsrc = $(filter-out %~,$(wildcard *--*))
23 boilerplates.made : $(bpsrc)
24 ls *--* 2>/dev/null | \
25 while read boilerplate; \
26 do \
27 case "$$boilerplate" in *~) continue ;; esac && \
28 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
29 dir=`expr "$$dst" : '\(.*\)/'` && \
30 mkdir -p blt/$$dir && \
31 case "$$boilerplate" in \
32 *--) ;; \
33 *) cp $$boilerplate blt/$$dst ;; \
34 esac || exit; \
35 done || exit
36 date >$@
38 # If you need build-tailored templates, build them into blt/
39 # directory yourself here.
40 custom:
41 : no custom templates yet
43 clean:
44 rm -rf blt boilerplates.made
46 install: all
47 $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(template_dir))
48 (cd blt && $(TAR) cf - .) | \
49 (cd $(call shellquote,$(DESTDIR)$(template_dir)) && $(TAR) xf -)