1# Installation directories.
2PREFIX ?= $(DESTDIR)/usr
3LIBDIR ?= $(PREFIX)/lib
4USRBINDIR ?= $(PREFIX)/sbin
5SBINDIR ?= $(DESTDIR)/sbin
6
7MAX_STACK_SIZE=8192
8CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissing-include-dirs \
9          -Wunused -Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith \
10          -Wbad-function-cast -Wcast-align -Wwrite-strings -Wlogical-op -Waggregate-return \
11          -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \
12          -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute \
13          -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wvolatile-register-var \
14          -Wdisabled-optimization -Wbuiltin-macro-redefined -Wpacked-bitfield-compat \
15          -Wsync-nand -Wattributes -Wcoverage-mismatch -Wmultichar -Wcpp \
16          -Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wendif-labels -Wextra \
17          -Wformat-contains-nul -Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar \
18          -Wnormalized=nfc -Woverflow -Wpointer-to-int-cast -Wpragmas -Wsuggest-attribute=const \
19          -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines \
20          -Wno-missing-field-initializers -Wno-sign-compare -Wjump-misses-init \
21          -Wno-format-nonliteral -Wframe-larger-than=$(MAX_STACK_SIZE) -Wp,-D_FORTIFY_SOURCE=2 \
22          -fstack-protector-all --param=ssp-buffer-size=4 -fexceptions \
23          -fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time \
24          -fipa-pure-const -Wno-suggest-attribute=pure -Wno-suggest-attribute=const \
25          -Werror -Wno-aggregate-return -Wno-redundant-decls
26override CFLAGS += -I../include -D_GNU_SOURCE $(EMFLAGS)
27LDLIBS += -L../src -lselinux -L$(LIBDIR)
28
29TARGETS=$(patsubst %.c,%,$(wildcard *.c))
30
31sefcontext_compile: LDLIBS += -lpcre ../src/libselinux.a -lsepol
32
33ifeq ($(DISABLE_AVC),y)
34	UNUSED_TARGETS+=compute_av compute_create compute_member compute_relabel
35endif
36ifeq ($(DISABLE_BOOL),y)
37	UNUSED_TARGETS+=getsebool togglesebool
38endif
39TARGETS:= $(filter-out $(UNUSED_TARGETS), $(TARGETS))
40
41all: $(TARGETS)
42
43install: all
44	-mkdir -p $(USRBINDIR)
45	install -m 755 $(TARGETS) $(USRBINDIR)
46	-mkdir -p $(SBINDIR)
47clean:
48	rm -f $(TARGETS) *.o *~
49
50distclean: clean
51
52indent:
53	../../scripts/Lindent $(wildcard *.[ch])
54
55relabel:
56
57