Merge branch 'fixes'
[git.git] / templates / Makefile
1 # make and install sample templates
2
3 INSTALL ?= install
4 TAR ?= tar
5 prefix ?= $(HOME)
6 template_dir ?= $(prefix)/share/git-core/templates/
7 # DESTDIR=
8
9 all: boilerplates.made custom
10         find blt
11
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.
15
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 >$@
31
32 # If you need build-tailored templates, build them into blt/
33 # directory yourself here.
34 custom:
35         : no custom templates yet
36
37 clean:
38         rm -rf blt boilerplates.made
39
40 install: all
41         $(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
42         (cd blt && $(TAR) cf - .) | \
43         (cd $(DESTDIR)$(template_dir) && $(TAR) xf -)