Make sure 'make install' does not have to rebuild templates.
[git/jnareb-git.git] / templates / Makefile
blobc23aee866d3eca13abd5586ee06bac6e2ab87dc7
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 all: boilerplates.made custom
10 find blt
12 # Put templates that can be copied straight from the source
13 # in a file direc--tory--file in the source. They will be
14 # just copied to the destination.
16 bpsrc = $(filter-out %~,$(wildcard *--*))
17 boilerplates.made : $(bpsrc)
18 ls *--* 2>/dev/null | \
19 while read boilerplate; \
20 do \
21 case "$$boilerplate" in *~) continue ;; esac && \
22 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
23 dir=`expr "$$dst" : '\(.*\)/'` && \
24 mkdir -p blt/$$dir && \
25 case "$$boilerplate" in \
26 *--) ;; \
27 *) cp $$boilerplate blt/$$dst ;; \
28 esac || exit; \
29 done || exit
30 date >$@
32 # If you need build-tailored templates, build them into blt/
33 # directory yourself here.
34 custom:
35 : no custom templates yet
37 clean:
38 rm -rf blt boilerplates.made
40 install: all
41 $(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
42 (cd blt && $(TAR) cf - .) | \
43 (cd $(DESTDIR)$(template_dir) && $(TAR) xf -)