• 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		-Wfloat-equal \
13		-Wformat=2 \
14		-Winit-self \
15		-Wmissing-format-attribute \
16		-Wmissing-noreturn \
17		-Wnull-dereference \
18		-Wpointer-arith \
19		-Wshadow \
20		-Wstrict-prototypes \
21		-Wundef \
22		-Wunused \
23		-Wwrite-strings \
24		-fno-common
25endif
26
27ifneq ($(DESTDIR),)
28	LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
29	LIBSEPOLA ?= $(LIBDIR)/libsepol.a
30
31	CFLAGS += -I$(DESTDIR)$(PREFIX)/include
32	LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib -L$(LIBDIR)
33	export CFLAGS
34	export LDFLAGS
35	export LIBSEPOLA
36endif
37
38all install relabel clean test indent:
39	@for subdir in $(SUBDIRS); do \
40		(cd $$subdir && $(MAKE) $@) || exit 1; \
41	done
42
43install-pywrap install-rubywrap swigify:
44	@for subdir in $(PYSUBDIRS); do \
45		(cd $$subdir && $(MAKE) $@) || exit 1; \
46	done
47
48distclean:
49	@for subdir in $(DISTCLEANSUBDIRS); do \
50		(cd $$subdir && $(MAKE) $@) || exit 1; \
51	done
52