Git fork
at reftables-rust 78 lines 2.2 kB view raw
1# The default target of this Makefile is... 2all:: 3 4# Import tree-wide shared Makefile behavior and libraries 5include ../shared.mak 6 7# make and install sample templates 8INSTALL ?= install 9TAR ?= tar 10RM ?= rm -f 11prefix ?= $(HOME) 12template_instdir ?= $(prefix)/share/git-core/templates 13# DESTDIR= 14 15ifndef SHELL_PATH 16 SHELL_PATH = /bin/sh 17endif 18ifndef PERL_PATH 19 PERL_PATH = perl 20endif 21 22SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 23PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) 24 25# Shell quote (do not use $(call) to accommodate ancient setups); 26DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) 27template_instdir_SQ = $(subst ','\'',$(template_instdir)) 28 29all:: boilerplates.made custom 30 31# Put templates that can be copied straight from the source 32# in a file direc--tory--file in the source. They will be 33# just copied to the destination. 34 35TEMPLATES = 36TEMPLATES += description 37TEMPLATES += hooks/applypatch-msg.sample 38TEMPLATES += hooks/commit-msg.sample 39TEMPLATES += hooks/fsmonitor-watchman.sample 40TEMPLATES += hooks/post-update.sample 41TEMPLATES += hooks/pre-applypatch.sample 42TEMPLATES += hooks/pre-commit.sample 43TEMPLATES += hooks/pre-merge-commit.sample 44TEMPLATES += hooks/prepare-commit-msg.sample 45TEMPLATES += hooks/pre-push.sample 46TEMPLATES += hooks/pre-rebase.sample 47TEMPLATES += hooks/pre-receive.sample 48TEMPLATES += hooks/push-to-checkout.sample 49TEMPLATES += hooks/sendemail-validate.sample 50TEMPLATES += hooks/update.sample 51TEMPLATES += info/exclude 52 53boilerplates.made: $(TEMPLATES) 54 $(QUIET)umask 022 && for template in $(TEMPLATES); \ 55 do \ 56 dir=$$(dirname "$$template") && \ 57 mkdir -p blt/$$dir && \ 58 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 59 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ 60 -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \ 61 blt/$$template && \ 62 if test -x "$$template"; then rx=rx; else rx=r; fi && \ 63 chmod a+$$rx "blt/$$template" || exit; \ 64 done && \ 65 date >$@ 66 67# If you need build-tailored templates, build them into blt/ 68# directory yourself here. 69custom: 70 $(QUIET): no custom templates yet 71 72clean: 73 $(RM) -r blt boilerplates.made 74 75install: all 76 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' 77 (cd blt && $(TAR) cf - .) | \ 78 (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)