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)
|
2008-01-02 00:15:21 +03:00
|
|
|
template_instdir ?= $(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))
|
2008-01-02 00:15:21 +03:00
|
|
|
template_instdir_SQ = $(subst ','\'',$(template_instdir))
|
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)
|
2008-08-22 04:31:50 +04:00
|
|
|
$(QUIET)umask 022 && 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" : '\(.*\)/'` && \
|
2008-08-22 04:31:50 +04:00
|
|
|
mkdir -p blt/$$dir && \
|
2005-08-06 23:50:14 +04:00
|
|
|
case "$$boilerplate" in \
|
2008-08-22 04:31:50 +04:00
|
|
|
*--) continue;; \
|
|
|
|
esac && \
|
|
|
|
cp $$boilerplate blt/$$dst && \
|
|
|
|
if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
|
|
|
|
chmod a+$$rx "blt/$$dst" || 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
|
2008-01-02 00:15:21 +03:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
|
2005-09-23 21:41:40 +04:00
|
|
|
(cd blt && $(TAR) cf - .) | \
|
2008-08-20 19:36:25 +04:00
|
|
|
(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)
|