Merge branch 'merge-requests/32'
[irker:irker.git] / Makefile
1 # Makefile for the irker relaying daemon
2
3 VERS := $(shell sed -n 's/version = "\(.\+\)"/\1/p' irkerd)
4 SYSTEMDSYSTEMUNITDIR := $(shell pkg-config --variable=systemdsystemunitdir systemd)
5
6 # `prefix`, `mandir` & `DESTDIR` can and should be set on the command
7 # line to control installation locations
8 prefix ?= /usr
9 mandir ?= /share/man
10 target = $(DESTDIR)$(prefix)
11
12 docs: irkerd.html irkerd.8 irkerhook.html irkerhook.1 irk.html irk.1
13
14 irkerd.8: irkerd.xml
15         xmlto man irkerd.xml
16 irkerd.html: irkerd.xml
17         xmlto html-nochunks irkerd.xml
18
19 irkerhook.1: irkerhook.xml
20         xmlto man irkerhook.xml
21 irkerhook.html: irkerhook.xml
22         xmlto html-nochunks irkerhook.xml
23
24 irk.1: irk.xml
25         xmlto man irk.xml
26 irk.html: irk.xml
27         xmlto html-nochunks irkerhook.xml
28
29 install.html: install.txt
30         asciidoc -o install.html install.txt
31 security.html: security.txt
32         asciidoc -o security.html security.txt
33 hacking.html: hacking.txt
34         asciidoc -o hacking.html hacking.txt
35
36 install: irk.1 irkerd.8 irkerhook.1 uninstall
37         install -m 755 -o 0 -g 0 -d "$(target)/bin"
38         install -m 755 -o 0 -g 0 irkerd "$(target)/bin/irkerd"
39 ifneq ($(strip $(SYSTEMDSYSTEMUNITDIR)),)
40         install -m 755 -o 0 -g 0 -d "$(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)"
41         install -m 644 -o 0 -g 0 irkerd.service "$(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)"
42 endif
43         install -m 755 -o 0 -g 0 -d "$(target)$(mandir)/man8"
44         install -m 755 -o 0 -g 0 irkerd.8 "$(target)$(mandir)/man8/irkerd.8"
45         install -m 755 -o 0 -g 0 -d "$(target)$(mandir)/man1"
46         install -m 755 -o 0 -g 0 irkerhook.1 "$(target)$(mandir)/man1/irkerhook.1"
47         install -m 755 -o 0 -g 0 irk.1 "$(target)$(mandir)/man1/irk.1"
48
49 uninstall:
50         rm -f "$(target)/bin/irkerd"
51 ifneq ($(strip $(SYSTEMDSYSTEMUNITDIR)),)
52         rm -f "$(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)/irkerd.service"
53 endif
54         rm -f "$(target)$(mandir)/man8/irkerd.8"
55         rm -f "$(target)$(mandir)/man1/irkerhook.1"
56         rm -f "$(target)$(mandir)/man1/irk.1"
57
58 clean:
59         rm -f irkerd.8 irkerhook.1 irk.1 irker-*.tar.gz *~ *.html
60
61 PYLINTOPTS = --rcfile=/dev/null --reports=n \
62         --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
63         --dummy-variables-rgx='^_'
64 SUPPRESSIONS = "C0103,C0111,C0301,C0302,C1001,R0201,R0902,R0903,R0912,R0913,R0914,R0915,E1101,W0142,W0201,W0212,W0621,W0702,W0703,W1201,F0401,E0611"
65 pylint:
66         @pylint $(PYLINTOPTS) --disable=$(SUPPRESSIONS) irkerd
67         @pylint $(PYLINTOPTS) --disable=$(SUPPRESSIONS) irkerhook.py
68
69 loc:
70         @echo "LOC:"; wc -l irkerd irkerhook.py
71         @echo -n "LLOC: "; grep -vE '(^ *#|^ *$$)' irkerd irkerhook.py | wc -l
72
73 DOCS = \
74         README \
75         COPYING \
76         NEWS \
77         install.txt \
78         security.txt \
79         hacking.txt \
80         irkerhook.xml \
81         irkerd.xml \
82         irk.xml \
83
84 SOURCES = \
85         $(DOCS) \
86         irkerd \
87         irkerhook.py \
88         filter-example.py \
89         filter-test.py \
90         irk \
91         Makefile
92
93 EXTRA_DIST = \
94         org.catb.irkerd.plist \
95         irkerd.service \
96         irker-logo.png
97
98 version:
99         @echo $(VERS)
100
101 irker-$(VERS).tar.gz: $(SOURCES) irkerd.8 irkerhook.1 irk.1
102         mkdir irker-$(VERS)
103         cp -pR $(SOURCES) $(EXTRA_DIST) irker-$(VERS)/
104         @COPYFILE_DISABLE=1 tar -cvzf irker-$(VERS).tar.gz irker-$(VERS)
105         rm -fr irker-$(VERS)
106
107 irker-$(VERS).md5:
108         @md5sum irker-$(VERS).tar.gz >irker-$(VERS).md5
109
110 dist: irker-$(VERS).tar.gz irker-$(VERS).md5
111
112 release: irker-$(VERS).tar.gz irker-$(VERS).md5 irkerd.html irk.html irkerhook.html install.html security.html hacking.html
113         shipper version=$(VERS) | sh -e -x