templates / Makefileon commit Merge branch 'fixes' (d5b0c9e)
   1# make and install sample templates
   2
   3INSTALL ?= install
   4TAR ?= tar
   5prefix ?= $(HOME)
   6template_dir ?= $(prefix)/share/git-core/templates/
   7# DESTDIR=
   8
   9all: boilerplates.made custom
  10        find blt
  11
  12# Put templates that can be copied straight from the source
  13# in a file direc--tory--file in the source.  They will be
  14# just copied to the destination.
  15
  16bpsrc = $(filter-out %~,$(wildcard *--*))
  17boilerplates.made : $(bpsrc)
  18        ls *--* 2>/dev/null | \
  19        while read boilerplate; \
  20        do \
  21                case "$$boilerplate" in *~) continue ;; esac && \
  22                dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
  23                dir=`expr "$$dst" : '\(.*\)/'` && \
  24                mkdir -p blt/$$dir && \
  25                case "$$boilerplate" in \
  26                *--) ;; \
  27                *) cp $$boilerplate blt/$$dst ;; \
  28                esac || exit; \
  29        done || exit
  30        date >$@
  31
  32# If you need build-tailored templates, build them into blt/
  33# directory yourself here.
  34custom:
  35        : no custom templates yet
  36
  37clean:
  38        rm -rf blt boilerplates.made
  39
  40install: all
  41        $(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
  42        (cd blt && $(TAR) cf - .) | \
  43        (cd $(DESTDIR)$(template_dir) && $(TAR) xf -)