1#########################################################################
2# COMMON COMPILATION FLAGS                                              #
3#########################################################################
4
5CROSS_COMPILE   ?= arm-linux-gnueabihf-
6CC              ?= $(CROSS_COMPILE)gcc
7AR		?= $(CROSS_COMPILE)ar
8PKG_CONFIG	?= $(CROSS_COMPILE)pkg-config
9
10override CFLAGS += -Wall -Wbad-function-cast -Wcast-align \
11		   -Werror-implicit-function-declaration -Wextra \
12		   -Wfloat-equal -Wformat-nonliteral -Wformat-security \
13		   -Wformat=2 -Winit-self -Wmissing-declarations \
14		   -Wmissing-format-attribute -Wmissing-include-dirs \
15		   -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs \
16		   -Wpointer-arith -Wshadow -Wstrict-prototypes \
17		   -Wswitch-default -Wunsafe-loop-optimizations \
18		   -Wwrite-strings -D_FILE_OFFSET_BITS=64
19ifeq ($(CFG_WERROR),y)
20override CFLAGS	+= -Werror
21endif
22override CFLAGS += -c -fPIC
23
24DEBUG       ?= 0
25ifeq ($(DEBUG), 1)
26override CFLAGS += -DDEBUG -O0 -g
27endif
28
29RM              := rm -f
30
31define rmdir
32if [ -d "$(1)" ] ; then rmdir --ignore-fail-on-non-empty $(1) ; fi
33endef
34