2005-08-06 21:50:14 +02:00
|
|
|
# make and install sample templates
|
2005-08-03 01:45:21 +02:00
|
|
|
|
2007-03-06 08:09:14 +01:00
|
|
|
ifndef V
|
2007-03-06 07:35:01 +01:00
|
|
|
QUIET = @
|
|
|
|
endif
|
|
|
|
|
2005-09-23 19:41:40 +02:00
|
|
|
INSTALL ?= install
|
|
|
|
TAR ?= tar
|
2007-07-14 19:51:44 +02:00
|
|
|
RM ?= rm -f
|
2005-09-23 19:41:40 +02:00
|
|
|
prefix ?= $(HOME)
|
2008-01-01 22:15:21 +01:00
|
|
|
template_instdir ?= $(prefix)/share/git-core/templates
|
2005-08-05 01:56:38 +02:00
|
|
|
# DESTDIR=
|
2005-08-03 01:45:21 +02:00
|
|
|
|
2010-03-20 15:48:08 +01: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 05:49:16 +01:00
|
|
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
2006-07-29 18:25:03 +02:00
|
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
2008-01-01 22:15:21 +01:00
|
|
|
template_instdir_SQ = $(subst ','\'',$(template_instdir))
|
2005-10-10 22:50:01 +02:00
|
|
|
|
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)
|
2008-08-22 02:31:50 +02:00
|
|
|
$(QUIET)umask 022 && ls *--* 2>/dev/null | \
|
2005-08-06 21:50:14 +02: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 02:31:50 +02:00
|
|
|
mkdir -p blt/$$dir && \
|
2005-08-06 21:50:14 +02:00
|
|
|
case "$$boilerplate" in \
|
2008-08-22 02:31:50 +02:00
|
|
|
*--) continue;; \
|
|
|
|
esac && \
|
2010-03-20 15:48:08 +01: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 02:31:50 +02:00
|
|
|
chmod a+$$rx "blt/$$dst" || exit; \
|
2007-03-06 07:35:01 +01:00
|
|
|
done && \
|
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:
|
2007-03-06 07:35:01 +01:00
|
|
|
$(QUIET): no custom templates yet
|
2005-08-06 21:50:14 +02:00
|
|
|
|
2005-08-03 01:45:21 +02:00
|
|
|
clean:
|
2007-07-14 19:51:44 +02:00
|
|
|
$(RM) -r blt boilerplates.made
|
2005-08-03 01:45:21 +02:00
|
|
|
|
2005-08-06 21:50:14 +02:00
|
|
|
install: all
|
2008-01-01 22:15:21 +01:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
|
2005-09-23 19:41:40 +02:00
|
|
|
(cd blt && $(TAR) cf - .) | \
|
2009-10-24 15:06:57 +02:00
|
|
|
(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)
|