aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: cd5467b9a736c66cd8fc5ef444e2774b1437b0f9 (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
.PHONY: all apache2.tar apache2.tar.xz

DESTDIR ?= /var/www/git.replicant.us

# For make update
REMOTE ?= origin
BRANCH ?= master

all: help install-sources

help:
	@echo "Available commands:"
	@echo "make help               This command"
	@echo "make install-sources:   Install the source code to to a web root"
	@echo "	                       directory for AGPLv3+ compliance"
	@echo "make install-hooks:     Deploys a git hook to automatically instal the"
	@echo "                        source code on git checkout"
	@echo "make update:            Pull in last changes from upstream in the current git repository"

install-hooks: hooks/post-checkout
	install $< -m 770 -t .git/hooks

install-sources: apache2.tar.xz
	@if [ -d $(DESTDIR) ] ; then \
		echo "Shipping the corresponding source code to $(DESTDIR)/$<" ; \
		install $< -t $(DESTDIR) ; \
	fi

apache2.tar:
	rm -f $@
	git archive HEAD \
		--format tar \
		--prefix=apache2/ \
		-o $@

apache2.tar.xz: apache2.tar
	rm -f $@
	xz -9e --verbose $<

update:
	git fetch $(REMOTE)
	git verify-commit $(REMOTE)/$(BRANCH)
	git rebase $(REMOTE)/$(BRANCH)
	make install-sources
	systemctl reload apache2