1PYTHON ?= python3
2
3# Installation directories.
4LINGUAS ?= ru
5PREFIX ?= /usr
6SBINDIR ?= $(PREFIX)/sbin
7MANDIR = $(PREFIX)/share/man
8PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")
9PACKAGEDIR ?= $(PYTHONLIBDIR)
10BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions
11
12TARGETS=semanage
13
14BASHCOMPLETIONS=semanage-bash-completion.sh
15
16all: $(TARGETS)
17
18install: all
19	[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
20	-mkdir -p $(DESTDIR)$(SBINDIR)
21	install -m 755 semanage $(DESTDIR)$(SBINDIR)
22	install -m 644 *.8 $(DESTDIR)$(MANDIR)/man8
23	for lang in $(LINGUAS) ; do \
24		if [ -e $${lang} ] ; then \
25			[ -d $(DESTDIR)$(MANDIR)/$${lang}/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \
26			install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \
27		fi ; \
28	done
29	test -d $(DESTDIR)/$(PACKAGEDIR) || install -m 755 -d $(DESTDIR)/$(PACKAGEDIR)
30	install -m 644 seobject.py $(DESTDIR)/$(PACKAGEDIR)
31	-mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR)
32	install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/semanage
33
34test:
35	@$(PYTHON) test-semanage.py -a
36clean:
37
38indent:
39
40relabel:
41