Add zlib
[git/pclouds.git] / templates / Makefile
blob79c92ba34cd136c6059420684997ffc7e0cc6e8c
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_dir = $(prefix)/share/git-core/templates
12 # DESTDIR=
13 # set NOEXECTEMPL to non-empty to change the names of hook scripts
14 # so that the tools will not find them
16 # Shell quote (do not use $(call) to accommodate ancient setups);
17 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
18 template_dir_SQ = $(subst ','\'',$(template_dir))
20 all: boilerplates.made custom
22 # Put templates that can be copied straight from the source
23 # in a file direc--tory--file in the source. They will be
24 # just copied to the destination.
26 bpsrc = $(filter-out %~,$(wildcard *--*))
27 boilerplates.made : $(bpsrc)
28 $(QUIET)ls *--* 2>/dev/null | \
29 while read boilerplate; \
30 do \
31 case "$$boilerplate" in *~) continue ;; esac && \
32 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
33 dir=`expr "$$dst" : '\(.*\)/'` && \
34 mkdir -p blt/$$dir && \
35 case "$$boilerplate" in \
36 *--) ;; \
37 *) if head -1 $$boilerplate | grep -q '^#!/'; then \
38 cp $$boilerplate blt/$${dst}$(NOEXECTEMPL); \
39 else \
40 cp $$boilerplate blt/$$dst; \
41 fi ;; \
42 esac || exit; \
43 done && \
44 date >$@
46 # If you need build-tailored templates, build them into blt/
47 # directory yourself here.
48 custom:
49 $(QUIET): no custom templates yet
51 clean:
52 $(RM) -r blt boilerplates.made
54 install: all
55 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'
56 (cd blt && $(TAR) cf - .) | \
57 (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)