templates / Makefileon commit git-svn: don't minimize-url when doing an init that tracks multiple paths (dc43166)
   1# make and install sample templates
   2
   3ifndef V
   4        QUIET = @
   5endif
   6
   7INSTALL ?= install
   8TAR ?= tar
   9prefix ?= $(HOME)
  10template_dir ?= $(prefix)/share/git-core/templates/
  11# DESTDIR=
  12
  13# Shell quote (do not use $(call) to accommodate ancient setups);
  14DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
  15template_dir_SQ = $(subst ','\'',$(template_dir))
  16
  17all: boilerplates.made custom
  18
  19# Put templates that can be copied straight from the source
  20# in a file direc--tory--file in the source.  They will be
  21# just copied to the destination.
  22
  23bpsrc = $(filter-out %~,$(wildcard *--*))
  24boilerplates.made : $(bpsrc)
  25        $(QUIET)ls *--* 2>/dev/null | \
  26        while read boilerplate; \
  27        do \
  28                case "$$boilerplate" in *~) continue ;; esac && \
  29                dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
  30                dir=`expr "$$dst" : '\(.*\)/'` && \
  31                mkdir -p blt/$$dir && \
  32                case "$$boilerplate" in \
  33                *--) ;; \
  34                *) cp $$boilerplate blt/$$dst ;; \
  35                esac || exit; \
  36        done && \
  37        date >$@
  38
  39# If you need build-tailored templates, build them into blt/
  40# directory yourself here.
  41custom:
  42        $(QUIET): no custom templates yet
  43
  44clean:
  45        rm -rf blt boilerplates.made
  46
  47install: all
  48        $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(template_dir_SQ)'
  49        (cd blt && $(TAR) cf - .) | \
  50        (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)