Avoid composing too long "References" header.
[git/spearce.git] / templates / Makefile
blobb8352e731bf4baffbda780a1420f52ca4670b828
1 # make and install sample templates
3 ifndef V
4 QUIET = @
5 endif
7 INSTALL ?= install
8 TAR ?= tar
9 prefix ?= $(HOME)
10 template_dir ?= $(prefix)/share/git-core/templates/
11 # DESTDIR=
13 # Shell quote (do not use $(call) to accommodate ancient setups);
14 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
15 template_dir_SQ = $(subst ','\'',$(template_dir))
17 all: boilerplates.made custom
19 # Put templates that can be copied straight from the source
20 # in a file direc--tory--file in the source. They will be
21 # just copied to the destination.
23 bpsrc = $(filter-out %~,$(wildcard *--*))
24 boilerplates.made : $(bpsrc)
25 $(QUIET)ls *--* 2>/dev/null | \
26 while read boilerplate; \
27 do \
28 case "$$boilerplate" in *~) continue ;; esac && \
29 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
30 dir=`expr "$$dst" : '\(.*\)/'` && \
31 mkdir -p blt/$$dir && \
32 case "$$boilerplate" in \
33 *--) ;; \
34 *) cp $$boilerplate blt/$$dst ;; \
35 esac || exit; \
36 done && \
37 date >$@
39 # If you need build-tailored templates, build them into blt/
40 # directory yourself here.
41 custom:
42 $(QUIET): no custom templates yet
44 clean:
45 rm -rf blt boilerplates.made
47 install: all
48 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'
49 (cd blt && $(TAR) cf - .) | \
50 (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)