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