Merge git://git.kernel.org/pub/scm/gitk/gitk
[git/dkf.git] / templates / Makefile
blob9e1ae1a4e0322a37b494177474a964caf05ca4dd
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 (do not use $(call) to accomodate ancient setups);
10 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
11 template_dir_SQ = $(subst ','\'',$(template_dir))
13 all: boilerplates.made custom
15 # Put templates that can be copied straight from the source
16 # in a file direc--tory--file in the source. They will be
17 # just copied to the destination.
19 bpsrc = $(filter-out %~,$(wildcard *--*))
20 boilerplates.made : $(bpsrc)
21 ls *--* 2>/dev/null | \
22 while read boilerplate; \
23 do \
24 case "$$boilerplate" in *~) continue ;; esac && \
25 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
26 dir=`expr "$$dst" : '\(.*\)/'` && \
27 mkdir -p blt/$$dir && \
28 case "$$boilerplate" in \
29 *--) ;; \
30 *) cp $$boilerplate blt/$$dst ;; \
31 esac || exit; \
32 done || exit
33 date >$@
35 # If you need build-tailored templates, build them into blt/
36 # directory yourself here.
37 custom:
38 : no custom templates yet
40 clean:
41 rm -rf blt boilerplates.made
43 install: all
44 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'
45 (cd blt && $(TAR) cf - .) | \
46 (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)