xref: /aosp_15_r20/external/selinux/python/sepolicy/Makefile (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard WorkerPYTHON ?= python3
2*2d543d20SAndroid Build Coastguard Worker
3*2d543d20SAndroid Build Coastguard Worker# Installation directories.
4*2d543d20SAndroid Build Coastguard WorkerLINGUAS ?=
5*2d543d20SAndroid Build Coastguard WorkerPREFIX ?= /usr
6*2d543d20SAndroid Build Coastguard WorkerBINDIR ?= $(PREFIX)/bin
7*2d543d20SAndroid Build Coastguard WorkerMANDIR ?= $(PREFIX)/share/man
8*2d543d20SAndroid Build Coastguard WorkerBASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions
9*2d543d20SAndroid Build Coastguard WorkerCFLAGS ?= -Wall -Werror -Wextra -W
10*2d543d20SAndroid Build Coastguard Workeroverride CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared
11*2d543d20SAndroid Build Coastguard Worker
12*2d543d20SAndroid Build Coastguard WorkerBASHCOMPLETIONS=sepolicy-bash-completion.sh
13*2d543d20SAndroid Build Coastguard Worker
14*2d543d20SAndroid Build Coastguard Workerall: python-build
15*2d543d20SAndroid Build Coastguard Worker
16*2d543d20SAndroid Build Coastguard Workerpython-build:
17*2d543d20SAndroid Build Coastguard Worker	$(PYTHON) setup.py build
18*2d543d20SAndroid Build Coastguard Worker
19*2d543d20SAndroid Build Coastguard Workerclean:
20*2d543d20SAndroid Build Coastguard Worker	$(PYTHON) setup.py clean
21*2d543d20SAndroid Build Coastguard Worker	-rm -rf build *~ \#* *pyc .#* sepolicy.egg-info/
22*2d543d20SAndroid Build Coastguard Worker
23*2d543d20SAndroid Build Coastguard Workersepolgen:
24*2d543d20SAndroid Build Coastguard Worker	ln -sf sepolicy sepolgen
25*2d543d20SAndroid Build Coastguard Worker
26*2d543d20SAndroid Build Coastguard Workertest:
27*2d543d20SAndroid Build Coastguard Worker	@$(PYTHON) test_sepolicy.py -v
28*2d543d20SAndroid Build Coastguard Worker
29*2d543d20SAndroid Build Coastguard Workerinstall:
30*2d543d20SAndroid Build Coastguard Worker	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
31*2d543d20SAndroid Build Coastguard Worker	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
32*2d543d20SAndroid Build Coastguard Worker	install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
33*2d543d20SAndroid Build Coastguard Worker	(cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
34*2d543d20SAndroid Build Coastguard Worker	-mkdir -p $(DESTDIR)$(MANDIR)/man8
35*2d543d20SAndroid Build Coastguard Worker	install -m 644 *.8 $(DESTDIR)$(MANDIR)/man8
36*2d543d20SAndroid Build Coastguard Worker	for lang in $(LINGUAS) ; do \
37*2d543d20SAndroid Build Coastguard Worker		if [ -e $${lang} ] ; then \
38*2d543d20SAndroid Build Coastguard Worker			mkdir -p $(DESTDIR)$(MANDIR)/$${lang}/man8 ; \
39*2d543d20SAndroid Build Coastguard Worker			install -m 644 $${lang}/*.8 $(DESTDIR)$(MANDIR)/$${lang}/man8/ ; \
40*2d543d20SAndroid Build Coastguard Worker		fi ; \
41*2d543d20SAndroid Build Coastguard Worker	done
42*2d543d20SAndroid Build Coastguard Worker	-mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR)
43*2d543d20SAndroid Build Coastguard Worker	install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/sepolicy
44*2d543d20SAndroid Build Coastguard Worker
45*2d543d20SAndroid Build Coastguard Workerrelabel:
46