]> git.ipfire.org Git - thirdparty/git.git/blame - templates/Makefile
Merge branch 'gc/branch-recurse-submodules-fix'
[thirdparty/git.git] / templates / Makefile
CommitLineData
8df786d2
ÆAB
1# Import tree-wide shared Makefile behavior and libraries
2include ../shared.mak
3
d3af621b 4# make and install sample templates
229a7ed7
JH
5INSTALL ?= install
6TAR ?= tar
4cb08df5 7RM ?= rm -f
229a7ed7 8prefix ?= $(HOME)
0b50b860 9template_instdir ?= $(prefix)/share/git-core/templates
a682ef9f 10# DESTDIR=
8d5afef0 11
502be959
BW
12ifndef SHELL_PATH
13 SHELL_PATH = /bin/sh
14endif
15ifndef PERL_PATH
16 PERL_PATH = perl
17endif
18
19SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
20PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
21
3dff5379 22# Shell quote (do not use $(call) to accommodate ancient setups);
7ffe7098 23DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
0b50b860 24template_instdir_SQ = $(subst ','\'',$(template_instdir))
4769948a 25
8c512428 26all: boilerplates.made custom
d3af621b
JH
27
28# Put templates that can be copied straight from the source
29# in a file direc--tory--file in the source. They will be
30# just copied to the destination.
8c512428
JH
31
32bpsrc = $(filter-out %~,$(wildcard *--*))
33boilerplates.made : $(bpsrc)
d8bdc492 34 $(QUIET)umask 022 && ls *--* 2>/dev/null | \
d3af621b
JH
35 while read boilerplate; \
36 do \
37 case "$$boilerplate" in *~) continue ;; esac && \
38 dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
39 dir=`expr "$$dst" : '\(.*\)/'` && \
d8bdc492 40 mkdir -p blt/$$dir && \
d3af621b 41 case "$$boilerplate" in \
d8bdc492
JH
42 *--) continue;; \
43 esac && \
502be959
BW
44 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
45 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
46 -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
47 blt/$$dst && \
48 if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
d8bdc492 49 chmod a+$$rx "blt/$$dst" || exit; \
74f2b2a8 50 done && \
8c512428 51 date >$@
d3af621b
JH
52
53# If you need build-tailored templates, build them into blt/
54# directory yourself here.
55custom:
74f2b2a8 56 $(QUIET): no custom templates yet
d3af621b 57
8d5afef0 58clean:
4cb08df5 59 $(RM) -r blt boilerplates.made
8d5afef0 60
d3af621b 61install: all
0b50b860 62 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
229a7ed7 63 (cd blt && $(TAR) cf - .) | \
36e56106 64 (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)