Sync with 1.7.0.4
[git/ericb.git] / templates / Makefile
blob408f0137a8342414eedba3a02372ea1ad6050117
1 # make and install sample templates
3 ifndef V
4 QUIET = @
5 endif
7 INSTALL ?= install
8 TAR ?= tar
9 RM ?= rm -f
10 prefix ?= $(HOME)
11 template_instdir ?= $(prefix)/share/git-core/templates
12 # DESTDIR=
14 # Shell quote (do not use $(call) to accommodate ancient setups);
15 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
16 template_instdir_SQ = $(subst ','\'',$(template_instdir))
18 all: boilerplates.made custom
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.
24 bpsrc = $(filter-out %~,$(wildcard *--*))
25 boilerplates.made : $(bpsrc)
26 $(QUIET)umask 022 && ls *--* 2>/dev/null | \
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" : '\(.*\)/'` && \
32 mkdir -p blt/$$dir && \
33 case "$$boilerplate" in \
34 *--) continue;; \
35 esac && \
36 cp $$boilerplate blt/$$dst && \
37 if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
38 chmod a+$$rx "blt/$$dst" || exit; \
39 done && \
40 date >$@
42 # If you need build-tailored templates, build them into blt/
43 # directory yourself here.
44 custom:
45 $(QUIET): no custom templates yet
47 clean:
48 $(RM) -r blt boilerplates.made
50 install: all
51 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
52 (cd blt && $(TAR) cf - .) | \
53 (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)