• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Installation directories.
2PREFIX ?= /usr
3SBINDIR ?= $(PREFIX)/sbin
4
5OS ?= $(shell uname)
6
7ifeq ($(shell $(CC) -v 2>&1 | grep "clang"),)
8COMPILER ?= gcc
9else
10COMPILER ?= clang
11endif
12
13ifeq ($(COMPILER), gcc)
14EXTRA_CFLAGS = -fipa-pure-const -Wpacked-bitfield-compat -Wsync-nand -Wcoverage-mismatch \
15	-Wcpp -Wformat-contains-nul -Wnormalized=nfc -Wsuggest-attribute=const \
16	-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines -Wjump-misses-init \
17	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const
18endif
19
20MAX_STACK_SIZE=8192
21CFLAGS ?= -O -Wall -W -Wundef -Wformat-y2k -Wformat-security -Winit-self -Wmissing-include-dirs \
22          -Wunused -Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith \
23          -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return \
24          -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \
25          -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute \
26          -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wvolatile-register-var \
27          -Wdisabled-optimization -Wbuiltin-macro-redefined \
28          -Wattributes -Wmultichar \
29          -Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wendif-labels -Wextra \
30          -Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar \
31          -Woverflow -Wpointer-to-int-cast -Wpragmas \
32          -Wno-missing-field-initializers -Wno-sign-compare \
33          -Wno-format-nonliteral -Wframe-larger-than=$(MAX_STACK_SIZE) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 \
34          -fstack-protector-all --param=ssp-buffer-size=4 -fexceptions \
35          -fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time \
36          -Werror -Wno-aggregate-return -Wno-redundant-decls -Wstrict-overflow=5 \
37          $(EXTRA_CFLAGS)
38
39ifeq ($(OS), Darwin)
40override CFLAGS += -I/opt/local/include -I../../libsepol/include
41override LDFLAGS += -L../../libsepol/src -undefined dynamic_lookup
42endif
43
44override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
45override LDFLAGS += -L../src
46override LDLIBS += -lselinux $(FTS_LDLIBS)
47PCRE_LDLIBS ?= -lpcre
48
49ifeq ($(ANDROID_HOST),y)
50TARGETS=sefcontext_compile
51else
52TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
53endif
54
55sefcontext_compile: LDLIBS += ../src/libselinux.a $(PCRE_LDLIBS) -lsepol
56
57all: $(TARGETS)
58
59install: all
60	-mkdir -p $(DESTDIR)$(SBINDIR)
61	install -m 755 $(TARGETS) $(DESTDIR)$(SBINDIR)
62
63clean:
64	rm -f $(TARGETS) *.o *~
65
66distclean: clean
67
68indent:
69	../../scripts/Lindent $(wildcard *.[ch])
70
71relabel:
72
73