2005-08-06 23:50:14 +04:00
|
|
|
# make and install sample templates
|
2005-08-03 03:45:21 +04:00
|
|
|
|
2007-03-06 10:09:14 +03:00
|
|
|
ifndef V
|
2007-03-06 09:35:01 +03:00
|
|
|
QUIET = @
|
|
|
|
endif
|
|
|
|
|
2005-09-23 21:41:40 +04:00
|
|
|
INSTALL ?= install
|
|
|
|
TAR ?= tar
|
2007-07-14 21:51:44 +04:00
|
|
|
RM ?= rm -f
|
2005-09-23 21:41:40 +04:00
|
|
|
prefix ?= $(HOME)
|
2007-06-11 13:10:47 +04:00
|
|
|
template_dir ?= $(prefix)/share/git-core/templates
|
2005-08-05 03:56:38 +04:00
|
|
|
# DESTDIR=
|
2005-08-03 03:45:21 +04:00
|
|
|
|
2007-02-04 07:49:16 +03:00
|
|
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
2006-07-29 20:25:03 +04:00
|
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
|
|
|
template_dir_SQ = $(subst ','\'',$(template_dir))
|
2005-10-11 00:50:01 +04:00
|
|
|
|
2005-10-09 05:01:24 +04:00
|
|
|
all: boilerplates.made custom
|
2005-08-06 23:50:14 +04: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 05:01:24 +04:00
|
|
|
|
|
|
|
bpsrc = $(filter-out %~,$(wildcard *--*))
|
|
|
|
boilerplates.made : $(bpsrc)
|
2007-03-06 09:35:01 +03:00
|
|
|
$(QUIET)ls *--* 2>/dev/null | \
|
2005-08-06 23:50:14 +04:00
|
|
|
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; \
|
2007-03-06 09:35:01 +03:00
|
|
|
done && \
|
2005-10-09 05:01:24 +04:00
|
|
|
date >$@
|
2005-08-06 23:50:14 +04:00
|
|
|
|
|
|
|
# If you need build-tailored templates, build them into blt/
|
|
|
|
# directory yourself here.
|
|
|
|
custom:
|
2007-03-06 09:35:01 +03:00
|
|
|
$(QUIET): no custom templates yet
|
2005-08-06 23:50:14 +04:00
|
|
|
|
2005-08-03 03:45:21 +04:00
|
|
|
clean:
|
2007-07-14 21:51:44 +04:00
|
|
|
$(RM) -r blt boilerplates.made
|
2005-08-03 03:45:21 +04:00
|
|
|
|
2005-08-06 23:50:14 +04:00
|
|
|
install: all
|
2007-12-01 20:05:40 +03:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_dir_SQ)'
|
2005-09-23 21:41:40 +04:00
|
|
|
(cd blt && $(TAR) cf - .) | \
|
2006-07-29 20:25:03 +04:00
|
|
|
(cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)
|