Commit | Line | Data |
---|---|---|
d3af621b | 1 | # make and install sample templates |
8d5afef0 | 2 | |
2314c947 | 3 | ifndef V |
74f2b2a8 SP |
4 | QUIET = @ |
5 | endif | |
6 | ||
229a7ed7 JH |
7 | INSTALL ?= install |
8 | TAR ?= tar | |
4cb08df5 | 9 | RM ?= rm -f |
229a7ed7 | 10 | prefix ?= $(HOME) |
0b50b860 | 11 | template_instdir ?= $(prefix)/share/git-core/templates |
a682ef9f | 12 | # DESTDIR= |
8d5afef0 | 13 | |
3dff5379 | 14 | # Shell quote (do not use $(call) to accommodate ancient setups); |
7ffe7098 | 15 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
0b50b860 | 16 | template_instdir_SQ = $(subst ','\'',$(template_instdir)) |
4769948a | 17 | |
8c512428 | 18 | all: boilerplates.made custom |
d3af621b JH |
19 | |
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. | |
8c512428 JH |
23 | |
24 | bpsrc = $(filter-out %~,$(wildcard *--*)) | |
25 | boilerplates.made : $(bpsrc) | |
d8bdc492 | 26 | $(QUIET)umask 022 && ls *--* 2>/dev/null | \ |
d3af621b JH |
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" : '\(.*\)/'` && \ | |
d8bdc492 | 32 | mkdir -p blt/$$dir && \ |
d3af621b | 33 | case "$$boilerplate" in \ |
d8bdc492 JH |
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; \ | |
74f2b2a8 | 39 | done && \ |
8c512428 | 40 | date >$@ |
d3af621b JH |
41 | |
42 | # If you need build-tailored templates, build them into blt/ | |
43 | # directory yourself here. | |
44 | custom: | |
74f2b2a8 | 45 | $(QUIET): no custom templates yet |
d3af621b | 46 | |
8d5afef0 | 47 | clean: |
4cb08df5 | 48 | $(RM) -r blt boilerplates.made |
8d5afef0 | 49 | |
d3af621b | 50 | install: all |
0b50b860 | 51 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' |
229a7ed7 | 52 | (cd blt && $(TAR) cf - .) | \ |
71f46377 | 53 | (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -) |