• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1PREFIX ?= /usr
2OPT_SUBDIRS ?= dbus gui mcstrans python restorecond sandbox semodule-utils
3SUBDIRS=libsepol libselinux libsemanage checkpolicy secilc policycoreutils $(OPT_SUBDIRS)
4PYSUBDIRS=libselinux libsemanage
5DISTCLEANSUBDIRS=libselinux libsemanage
6
7ifeq ($(DEBUG),1)
8	export CFLAGS = -g3 -O0 -gdwarf-2 -fno-strict-aliasing -Wall -Wshadow -Werror
9	export LDFLAGS = -g
10else
11	export CFLAGS ?= -O2 -Werror -Wall -Wextra \
12		-Wmissing-format-attribute \
13		-Wmissing-noreturn \
14		-Wpointer-arith \
15		-Wshadow \
16		-Wstrict-prototypes \
17		-Wundef \
18		-Wunused \
19		-Wwrite-strings \
20		-fno-common
21endif
22
23ifneq ($(DESTDIR),)
24	LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
25	LIBSEPOLA ?= $(LIBDIR)/libsepol.a
26
27	CFLAGS += -I$(DESTDIR)$(PREFIX)/include
28	LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib -L$(LIBDIR)
29	export CFLAGS
30	export LDFLAGS
31	export LIBSEPOLA
32endif
33
34all install relabel clean test indent:
35	@for subdir in $(SUBDIRS); do \
36		(cd $$subdir && $(MAKE) $@) || exit 1; \
37	done
38
39install-pywrap install-rubywrap swigify:
40	@for subdir in $(PYSUBDIRS); do \
41		(cd $$subdir && $(MAKE) $@) || exit 1; \
42	done
43
44distclean:
45	@for subdir in $(DISTCLEANSUBDIRS); do \
46		(cd $$subdir && $(MAKE) $@) || exit 1; \
47	done
48