1PYTHON ?= python3
2
3# Installation directories.
4LINGUAS ?= ru
5PREFIX ?= /usr
6BINDIR ?= $(PREFIX)/bin
7MANDIR ?= $(PREFIX)/share/man
8BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions
9CFLAGS ?= -Wall -Werror -Wextra -W
10override CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared
11
12BASHCOMPLETIONS=sepolicy-bash-completion.sh
13
14all: python-build
15
16python-build:
17	$(PYTHON) setup.py build
18
19clean:
20	$(PYTHON) setup.py clean
21	-rm -rf build *~ \#* *pyc .#*
22
23sepolgen:
24	ln -sf sepolicy sepolgen
25
26test:
27	@$(PYTHON) test_sepolicy.py -v
28
29install:
30	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
31	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
32	install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
33	(cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
34	-mkdir -p $(DESTDIR)$(MANDIR)/man8
35	install -m 644 *.8 $(DESTDIR)$(MANDIR)/man8
36	for lang in $(LINGUAS) ; do \
37		if [ -e $${lang} ] ; then \
38			mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \
39			install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \
40		fi ; \
41	done
42	-mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR)
43	install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/sepolicy
44
45relabel:
46