Install templates with the user and group of the installing personality
[git/git.git] / templates / Makefile
CommitLineData
d3af621b 1# make and install sample templates
8d5afef0 2
2314c947 3ifndef V
74f2b2a8
SP
4 QUIET = @
5endif
6
229a7ed7
JH
7INSTALL ?= install
8TAR ?= tar
4cb08df5 9RM ?= rm -f
229a7ed7 10prefix ?= $(HOME)
0b50b860 11template_instdir ?= $(prefix)/share/git-core/templates
a682ef9f 12# DESTDIR=
8d5afef0 13
3dff5379 14# Shell quote (do not use $(call) to accommodate ancient setups);
7ffe7098 15DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
0b50b860 16template_instdir_SQ = $(subst ','\'',$(template_instdir))
4769948a 17
8c512428 18all: boilerplates.made custom
d3af621b
JH
19
20# Put templates that can be copied straight from the source
21# in a file direc--tory--file in the source. They will be
22# just copied to the destination.
8c512428
JH
23
24bpsrc = $(filter-out %~,$(wildcard *--*))
25boilerplates.made : $(bpsrc)
74f2b2a8 26 $(QUIET)ls *--* 2>/dev/null | \
d3af621b
JH
27 while read boilerplate; \
28 do \
29 case "$$boilerplate" in *~) continue ;; esac && \
30 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
31 dir=`expr "$$dst" : '\(.*\)/'` && \
99077215 32 $(INSTALL) -d -m 755 blt/$$dir && \
d3af621b
JH
33 case "$$boilerplate" in \
34 *--) ;; \
99077215 35 *) cp -p $$boilerplate blt/$$dst ;; \
d3af621b 36 esac || exit; \
74f2b2a8 37 done && \
8c512428 38 date >$@
d3af621b
JH
39
40# If you need build-tailored templates, build them into blt/
41# directory yourself here.
42custom:
74f2b2a8 43 $(QUIET): no custom templates yet
d3af621b 44
8d5afef0 45clean:
4cb08df5 46 $(RM) -r blt boilerplates.made
8d5afef0 47
d3af621b 48install: all
0b50b860 49 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
229a7ed7 50 (cd blt && $(TAR) cf - .) | \
71f46377 51 (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)