forked from OP-TEE/optee_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.mk
37 lines (31 loc) · 1.22 KB
/
flags.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#########################################################################
# COMMON COMPILATION FLAGS #
#########################################################################
CROSS_COMPILE ?= arm-linux-gnueabihf-
CC ?= $(CROSS_COMPILE)gcc
AR ?= $(CROSS_COMPILE)ar
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
C_COMPILER=$(shell readlink -f $$(which $(CC)))
override CFLAGS += -Wall -Wbad-function-cast -Wcast-align \
-Werror-implicit-function-declaration -Wextra \
-Wfloat-equal -Wformat-nonliteral -Wformat-security \
-Wformat=2 -Winit-self -Wmissing-declarations \
-Wmissing-format-attribute -Wmissing-include-dirs \
-Wmissing-noreturn -Wmissing-prototypes -Wnested-externs \
-Wpointer-arith -Wshadow -Wstrict-prototypes \
-Wswitch-default -Wwrite-strings -D_FILE_OFFSET_BITS=64
ifneq (,$(findstring gcc,$(C_COMPILER)))
override CFLAGS += -Wunsafe-loop-optimizations
endif
ifeq ($(CFG_WERROR),y)
override CFLAGS += -Werror
endif
override CFLAGS += -c -fPIC
DEBUG ?= 0
ifeq ($(DEBUG), 1)
override CFLAGS += -DDEBUG -O0 -g
endif
RM := rm -f
define rmdir
if [ -d "$(1)" ] ; then rmdir --ignore-fail-on-non-empty $(1) ; fi
endef