Make 'make' quieter while building git
[git/git.git] / templates / Makefile
CommitLineData
d3af621b 1# make and install sample templates
8d5afef0 2
74f2b2a8
SP
3ifdef QUIET_MAKE
4 QUIET = @
5endif
6
229a7ed7
JH
7INSTALL ?= install
8TAR ?= tar
9prefix ?= $(HOME)
10template_dir ?= $(prefix)/share/git-core/templates/
a682ef9f 11# DESTDIR=
8d5afef0 12
3dff5379 13# Shell quote (do not use $(call) to accommodate ancient setups);
7ffe7098
RJ
14DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
15template_dir_SQ = $(subst ','\'',$(template_dir))
4769948a 16
8c512428 17all: boilerplates.made custom
d3af621b
JH
18
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.
8c512428
JH
22
23bpsrc = $(filter-out %~,$(wildcard *--*))
24boilerplates.made : $(bpsrc)
74f2b2a8 25 $(QUIET)ls *--* 2>/dev/null | \
d3af621b
JH
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; \
74f2b2a8 36 done && \
8c512428 37 date >$@
d3af621b
JH
38
39# If you need build-tailored templates, build them into blt/
40# directory yourself here.
41custom:
74f2b2a8 42 $(QUIET): no custom templates yet
d3af621b 43
8d5afef0 44clean:
8c512428 45 rm -rf blt boilerplates.made
8d5afef0 46
d3af621b 47install: all
7ffe7098 48 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'
229a7ed7 49 (cd blt && $(TAR) cf - .) | \
7ffe7098 50 (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)