| Pascal Brand | 04ac465 | 2014-06-03 16:12:38 +0200 | [diff] [blame] | 1 | ######################################################################### |
| 2 | # COMMON COMPILATION FLAGS # |
| 3 | ######################################################################### |
| 4 | |
| 5 | CROSS_COMPILE ?= arm-linux-gnueabihf- |
| Sumit Garg | 8d4aef1 | 2015-11-04 08:13:06 -0500 | [diff] [blame] | 6 | CC ?= $(CROSS_COMPILE)gcc |
| Jerome Forissier | aef0ede | 2016-05-03 09:52:26 +0200 | [diff] [blame] | 7 | AR ?= $(CROSS_COMPILE)ar |
| Pascal Brand | 04ac465 | 2014-06-03 16:12:38 +0200 | [diff] [blame] | 8 | |
| Andrey Zhizhikin | c77b4aa | 2020-05-31 20:40:25 +0000 | [diff] [blame] | 9 | override CFLAGS += -Wall -Wbad-function-cast -Wcast-align \ |
| Pascal Brand | 04ac465 | 2014-06-03 16:12:38 +0200 | [diff] [blame] | 10 | -Werror-implicit-function-declaration -Wextra \ |
| 11 | -Wfloat-equal -Wformat-nonliteral -Wformat-security \ |
| 12 | -Wformat=2 -Winit-self -Wmissing-declarations \ |
| 13 | -Wmissing-format-attribute -Wmissing-include-dirs \ |
| 14 | -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs \ |
| 15 | -Wpointer-arith -Wshadow -Wstrict-prototypes \ |
| 16 | -Wswitch-default -Wunsafe-loop-optimizations \ |
| Rouven Czerwinski | 0842873 | 2019-01-22 15:19:57 +0100 | [diff] [blame] | 17 | -Wwrite-strings -D_FILE_OFFSET_BITS=64 |
| Jerome Forissier | 5355fdb | 2018-07-06 10:32:53 +0200 | [diff] [blame] | 18 | ifeq ($(CFG_WERROR),y) |
| Andrey Zhizhikin | c77b4aa | 2020-05-31 20:40:25 +0000 | [diff] [blame] | 19 | override CFLAGS += -Werror |
| Jerome Forissier | 5355fdb | 2018-07-06 10:32:53 +0200 | [diff] [blame] | 20 | endif |
| Andrey Zhizhikin | c77b4aa | 2020-05-31 20:40:25 +0000 | [diff] [blame] | 21 | override CFLAGS += -c -fPIC |
| Pascal Brand | 04ac465 | 2014-06-03 16:12:38 +0200 | [diff] [blame] | 22 | |
| 23 | DEBUG ?= 0 |
| 24 | ifeq ($(DEBUG), 1) |
| Andrey Zhizhikin | c77b4aa | 2020-05-31 20:40:25 +0000 | [diff] [blame] | 25 | override CFLAGS += -DDEBUG -O0 -g |
| Pascal Brand | 04ac465 | 2014-06-03 16:12:38 +0200 | [diff] [blame] | 26 | endif |
| 27 | |
| Jerome Forissier | 6432f51 | 2016-11-28 10:27:56 +0100 | [diff] [blame] | 28 | RM := rm -f |
| 29 | |
| 30 | define rmdir |
| 31 | if [ -d "$(1)" ] ; then rmdir --ignore-fail-on-non-empty $(1) ; fi |
| 32 | endef |