2005-08-06 19:50:14 +00:00
|
|
|
# make and install sample templates
|
2005-08-02 23:45:21 +00:00
|
|
|
|
2007-03-06 07:09:14 +00:00
|
|
|
ifndef V
|
2007-03-06 06:35:01 +00:00
|
|
|
QUIET = @
|
|
|
|
endif
|
|
|
|
|
2005-09-23 17:41:40 +00:00
|
|
|
INSTALL ?= install
|
|
|
|
TAR ?= tar
|
2007-07-14 17:51:44 +00:00
|
|
|
RM ?= rm -f
|
2005-09-23 17:41:40 +00:00
|
|
|
prefix ?= $(HOME)
|
2008-01-01 21:15:21 +00:00
|
|
|
template_instdir ?= $(prefix)/share/git-core/templates
|
2005-08-04 23:56:38 +00:00
|
|
|
# DESTDIR=
|
2005-08-02 23:45:21 +00:00
|
|
|
|
2010-03-20 14:48:08 +00:00
|
|
|
ifndef SHELL_PATH
|
|
|
|
SHELL_PATH = /bin/sh
|
|
|
|
endif
|
|
|
|
ifndef PERL_PATH
|
|
|
|
PERL_PATH = perl
|
|
|
|
endif
|
|
|
|
|
|
|
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
|
|
|
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
|
|
|
|
|
2007-02-04 04:49:16 +00:00
|
|
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
2006-07-29 16:25:03 +00:00
|
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
2008-01-01 21:15:21 +00:00
|
|
|
template_instdir_SQ = $(subst ','\'',$(template_instdir))
|
2005-10-10 20:50:01 +00:00
|
|
|
|
2005-10-09 01:01:24 +00:00
|
|
|
all: boilerplates.made custom
|
2005-08-06 19:50:14 +00: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 01:01:24 +00:00
|
|
|
|
|
|
|
bpsrc = $(filter-out %~,$(wildcard *--*))
|
|
|
|
boilerplates.made : $(bpsrc)
|
2008-08-22 00:31:50 +00:00
|
|
|
$(QUIET)umask 022 && ls *--* 2>/dev/null | \
|
2005-08-06 19:50:14 +00: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 00:31:50 +00:00
|
|
|
mkdir -p blt/$$dir && \
|
2005-08-06 19:50:14 +00:00
|
|
|
case "$$boilerplate" in \
|
2008-08-22 00:31:50 +00:00
|
|
|
*--) continue;; \
|
|
|
|
esac && \
|
2010-03-20 14:48:08 +00:00
|
|
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
|
|
|
|
-e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
|
|
|
|
blt/$$dst && \
|
|
|
|
if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
|
2008-08-22 00:31:50 +00:00
|
|
|
chmod a+$$rx "blt/$$dst" || exit; \
|
2007-03-06 06:35:01 +00:00
|
|
|
done && \
|
2005-10-09 01:01:24 +00:00
|
|
|
date >$@
|
2005-08-06 19:50:14 +00:00
|
|
|
|
|
|
|
# If you need build-tailored templates, build them into blt/
|
|
|
|
# directory yourself here.
|
|
|
|
custom:
|
2007-03-06 06:35:01 +00:00
|
|
|
$(QUIET): no custom templates yet
|
2005-08-06 19:50:14 +00:00
|
|
|
|
2005-08-02 23:45:21 +00:00
|
|
|
clean:
|
2007-07-14 17:51:44 +00:00
|
|
|
$(RM) -r blt boilerplates.made
|
2005-08-02 23:45:21 +00:00
|
|
|
|
2005-08-06 19:50:14 +00:00
|
|
|
install: all
|
2008-01-01 21:15:21 +00:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
|
2005-09-23 17:41:40 +00:00
|
|
|
(cd blt && $(TAR) cf - .) | \
|
2009-10-24 13:06:57 +00:00
|
|
|
(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)
|