| 1 | # Makefile for userv-git-daemon |
| 2 | # |
| 3 | # This was written by Tony Finch <dot@dotat.at> and subsequently |
| 4 | # heavily modified by Ian Jackson <ijackson@chiark.greenend.org.uk> |
| 5 | # You may do anything with it, at your own risk. |
| 6 | # http://creativecommons.org/publicdomain/zero/1.0/ |
| 7 | |
| 8 | include ../settings.make |
| 9 | |
| 10 | gituser= userv-git |
| 11 | varloggit= $(varlog)/git |
| 12 | |
| 13 | TARGETS= git-upload-pack inetd.conf git-daemon git-service logrotate |
| 14 | |
| 15 | SUBSTVARS= libuserv etcuserv varloggit gituser |
| 16 | |
| 17 | CONFIGS= $(services)/git-upload-pack \ |
| 18 | $(etcuserv)/git-urlmap \ |
| 19 | $(etcdir)/logrotate.d/userv-git-daemon |
| 20 | |
| 21 | all: $(TARGETS) |
| 22 | |
| 23 | sedscript: Makefile read-urlmap |
| 24 | echo >$@.new '$(foreach f, $(SUBSTVARS), s,@$f@,$($f),g; )' |
| 25 | echo >>$@.new '/@@READ_URLMAP@@/c\' |
| 26 | @#' |
| 27 | perl >>$@.new -pe 's/\\/\\\\/g; s/$$/\\/' <read-urlmap |
| 28 | mv -f $@.new $@ |
| 29 | |
| 30 | %: %.in sedscript |
| 31 | set -e; \ |
| 32 | sed -f sedscript <$< >$@.new; \ |
| 33 | if test -x $<; then chmod +x $@.new; fi; \ |
| 34 | mv -f $@.new $@ |
| 35 | |
| 36 | install: all |
| 37 | mkdir -p $(libuserv) $(etcuserv) $(services) \ |
| 38 | $(etcdir)/logrotate.d |
| 39 | install -d -o $(gituser) -g adm $(varloggit) |
| 40 | cp git-daemon git-service $(libuserv) |
| 41 | cp git-upload-pack $(services)/git-upload-pack:new |
| 42 | cp git-urlmap $(etcuserv)/git-urlmap:new |
| 43 | cp logrotate $(etcdir)/logrotate.d/userv-git-daemon:new |
| 44 | set -e; for f in $(CONFIGS); do \ |
| 45 | if test -f $$f; then continue; fi; \ |
| 46 | mv $$f:new $$f; \ |
| 47 | done |
| 48 | |
| 49 | mkdocdir: |
| 50 | mkdir -p $(docdir)/userv-git-daemon |
| 51 | |
| 52 | install-docs: mkdocdir |
| 53 | cp README $(docdir)/userv-git-daemon/README |
| 54 | |
| 55 | install-examples: all mkdocdir |
| 56 | cp inetd.conf $(docdir)/userv-git-daemon/inetd.conf |
| 57 | |
| 58 | distclean clean: |
| 59 | rm -f $(TARGETS) *~ |
| 60 | |
| 61 | # end |