Code

Merge branch 'maint'
[git.git] / templates / Makefile
index ebd3a62fd866453ad77406ec063b923e99ee0990..cc3fc3094cbbf1e15dff9cd1f3fc80e92d6be06e 100644 (file)
@@ -8,12 +8,12 @@ INSTALL ?= install
 TAR ?= tar
 RM ?= rm -f
 prefix ?= $(HOME)
-template_dir ?= $(prefix)/share/git-core/templates
+template_instdir ?= $(prefix)/share/git-core/templates
 # DESTDIR=
 
 # Shell quote (do not use $(call) to accommodate ancient setups);
 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
-template_dir_SQ = $(subst ','\'',$(template_dir))
+template_instdir_SQ = $(subst ','\'',$(template_instdir))
 
 all: boilerplates.made custom
 
@@ -29,10 +29,10 @@ boilerplates.made : $(bpsrc)
                case "$$boilerplate" in *~) continue ;; esac && \
                dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
                dir=`expr "$$dst" : '\(.*\)/'` && \
-               mkdir -p blt/$$dir && \
+               $(INSTALL) -d -m 755 blt/$$dir && \
                case "$$boilerplate" in \
                *--) ;; \
-               *) cp $$boilerplate blt/$$dst ;; \
+               *) cp -p $$boilerplate blt/$$dst ;; \
                esac || exit; \
        done && \
        date >$@
@@ -46,6 +46,6 @@ clean:
        $(RM) -r blt boilerplates.made
 
 install: all
-       $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_dir_SQ)'
+       $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
        (cd blt && $(TAR) cf - .) | \
-       (cd '$(DESTDIR_SQ)$(template_dir_SQ)' && $(TAR) xf -)
+       (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)