2005-08-06 21:50:14 +02:00
|
|
|
# make and install sample templates
|
2005-08-03 01:45:21 +02:00
|
|
|
|
2005-09-23 19:41:40 +02:00
|
|
|
INSTALL ?= install
|
|
|
|
TAR ?= tar
|
|
|
|
prefix ?= $(HOME)
|
|
|
|
template_dir ?= $(prefix)/share/git-core/templates/
|
2005-08-05 01:56:38 +02:00
|
|
|
# DESTDIR=
|
2005-08-03 01:45:21 +02:00
|
|
|
|
2005-10-10 22:50:01 +02:00
|
|
|
# Shell quote;
|
|
|
|
# Result of this needs to be placed inside ''
|
|
|
|
shq = $(subst ','\'',$(1))
|
|
|
|
# This has surrounding ''
|
|
|
|
shellquote = '$(call shq,$(1))'
|
|
|
|
|
2005-10-09 03:01:24 +02:00
|
|
|
all: boilerplates.made custom
|
2005-08-06 21:50:14 +02:00
|
|
|
|
|
|
|
# Put templates that can be copied straight from the source
|
|
|
|
# in a file direc--tory--file in the source. They will be
|
|
|
|
# just copied to the destination.
|
2005-10-09 03:01:24 +02:00
|
|
|
|
|
|
|
bpsrc = $(filter-out %~,$(wildcard *--*))
|
|
|
|
boilerplates.made : $(bpsrc)
|
2005-08-06 21:50:14 +02:00
|
|
|
ls *--* 2>/dev/null | \
|
|
|
|
while read boilerplate; \
|
|
|
|
do \
|
|
|
|
case "$$boilerplate" in *~) continue ;; esac && \
|
|
|
|
dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
|
|
|
|
dir=`expr "$$dst" : '\(.*\)/'` && \
|
|
|
|
mkdir -p blt/$$dir && \
|
|
|
|
case "$$boilerplate" in \
|
|
|
|
*--) ;; \
|
|
|
|
*) cp $$boilerplate blt/$$dst ;; \
|
|
|
|
esac || exit; \
|
|
|
|
done || exit
|
2005-10-09 03:01:24 +02:00
|
|
|
date >$@
|
2005-08-06 21:50:14 +02:00
|
|
|
|
|
|
|
# If you need build-tailored templates, build them into blt/
|
|
|
|
# directory yourself here.
|
|
|
|
custom:
|
|
|
|
: no custom templates yet
|
|
|
|
|
2005-08-03 01:45:21 +02:00
|
|
|
clean:
|
2005-10-09 03:01:24 +02:00
|
|
|
rm -rf blt boilerplates.made
|
2005-08-03 01:45:21 +02:00
|
|
|
|
2005-08-06 21:50:14 +02:00
|
|
|
install: all
|
2005-10-10 22:50:01 +02:00
|
|
|
$(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(template_dir))
|
2005-09-23 19:41:40 +02:00
|
|
|
(cd blt && $(TAR) cf - .) | \
|
2005-10-10 22:50:01 +02:00
|
|
|
(cd $(call shellquote,$(DESTDIR)$(template_dir)) && $(TAR) xf -)
|