]>
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 | |
9 | prefix ?= $(HOME) | |
10 | template_dir ?= $(prefix)/share/git-core/templates/ | |
a682ef9f | 11 | # DESTDIR= |
8d5afef0 | 12 | |
3dff5379 | 13 | # Shell quote (do not use $(call) to accommodate ancient setups); |
7ffe7098 RJ |
14 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
15 | template_dir_SQ = $(subst ','\'',$(template_dir)) | |
4769948a | 16 | |
8c512428 | 17 | all: boilerplates.made custom |
d3af621b JH |
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. | |
8c512428 JH |
22 | |
23 | bpsrc = $(filter-out %~,$(wildcard *--*)) | |
24 | boilerplates.made : $(bpsrc) | |
74f2b2a8 | 25 | $(QUIET)ls *--* 2>/dev/null | \ |
d3af621b JH |
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; \ | |
74f2b2a8 | 36 | done && \ |
8c512428 | 37 | date >$@ |
d3af621b JH |
38 | |
39 | # If you need build-tailored templates, build them into blt/ | |
40 | # directory yourself here. | |
41 | custom: | |
74f2b2a8 | 42 | $(QUIET): no custom templates yet |
d3af621b | 43 | |
8d5afef0 | 44 | clean: |
8c512428 | 45 | rm -rf blt boilerplates.made |
8d5afef0 | 46 | |
d3af621b | 47 | install: all |
7ffe7098 | 48 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)' |
229a7ed7 | 49 | (cd blt && $(TAR) cf - .) | \ |
7ffe7098 | 50 | (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -) |