summaryrefslogtreecommitdiff
path: root/git-daemon/Makefile
blob: 54a78c13f9062a6dd3d4b604c2163d806d73a58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Makefile for userv-git-daemon
#
# This was written by Tony Finch <dot@dotat.at> and subsequently
# heavily modified by Ian Jackson <ijackson@chiark.greenend.org.uk>
# You may do anything with it, at your own risk.
# http://creativecommons.org/publicdomain/zero/1.0/

include ../settings.make

gituser=	userv-git
varloggit=	$(varlog)/git

TARGETS=	git-upload-pack inetd.conf git-daemon git-service logrotate

SUBSTVARS=	libuserv etcuserv varloggit gituser

CONFIGS=	$(services)/git-upload-pack \
		$(etcuserv)/git-urlmap \
		$(etcdir)/logrotate.d/userv-git-daemon

all:		$(TARGETS)

sedscript:	Makefile read-urlmap
		echo >$@.new '$(foreach f, $(SUBSTVARS), s,@$f@,$($f),g; )'
		echo >>$@.new '/@@READ_URLMAP@@/c\'
		@#'
		perl >>$@.new -pe 's/\\/\\\\/g; s/$$/\\/' <read-urlmap
		mv -f $@.new $@

%:		%.in sedscript
		set -e; \
		sed -f sedscript <$< >$@.new; \
		if test -x $<; then chmod +x $@.new; fi; \
		mv -f $@.new $@

install:	all
		mkdir -p $(libuserv) $(etcuserv) $(services) \
			$(etcdir)/logrotate.d
		install -d -o $(gituser) -g adm $(varloggit)
		cp git-daemon git-service $(libuserv)
		cp git-upload-pack $(services)/git-upload-pack:new
		cp git-urlmap $(etcuserv)/git-urlmap:new
		cp logrotate $(etcdir)/logrotate.d/userv-git-daemon:new
		set -e; for f in $(CONFIGS); do \
			if test -f $$f; then continue; fi; \
			mv $$f:new $$f; \
		done

mkdocdir:
		mkdir -p $(docdir)/userv-git-daemon

install-docs:	mkdocdir
		cp README $(docdir)/userv-git-daemon/README

install-examples: all mkdocdir
		cp inetd.conf $(docdir)/userv-git-daemon/inetd.conf

distclean clean:
		rm -f $(TARGETS) *~

# end