Add WARNINGS_AS_ERRORS make flag
Previous behavior was all warnings were treated as errors. This is now controllable via a make variable and defaults to off (but can be turned on in local.mk for those who still want the old behavior)
This commit is contained in:
parent
02c35d8a71
commit
373e7cae62
1 changed files with 11 additions and 1 deletions
12
common.mk
12
common.mk
|
@ -106,8 +106,14 @@ ENTRY_SYMBOL ?= call_user_start
|
||||||
# but compiled code size will come down a small amount.)
|
# but compiled code size will come down a small amount.)
|
||||||
SPLIT_SECTIONS ?= 1
|
SPLIT_SECTIONS ?= 1
|
||||||
|
|
||||||
|
# Set this to 1 to have all compiler warnings treated as errors (and stop the
|
||||||
|
# build). This is recommended whenever you are working on code which will be
|
||||||
|
# submitted back to the main project, as all submitted code will be expected to
|
||||||
|
# compile without warnings to be accepted.
|
||||||
|
WARNINGS_AS_ERRORS ?= 0
|
||||||
|
|
||||||
# Common flags for both C & C++_
|
# Common flags for both C & C++_
|
||||||
C_CXX_FLAGS ?= -Wall -Werror -Wl,-EL -nostdlib $(EXTRA_C_CXX_FLAGS)
|
C_CXX_FLAGS ?= -Wall -Wl,-EL -nostdlib $(EXTRA_C_CXX_FLAGS)
|
||||||
# Flags for C only
|
# Flags for C only
|
||||||
CFLAGS ?= $(C_CXX_FLAGS) -std=gnu99 $(EXTRA_CFLAGS)
|
CFLAGS ?= $(C_CXX_FLAGS) -std=gnu99 $(EXTRA_CFLAGS)
|
||||||
# Flags for C++ only
|
# Flags for C++ only
|
||||||
|
@ -118,6 +124,10 @@ CPPFLAGS += -mlongcalls -mtext-section-literals
|
||||||
|
|
||||||
LDFLAGS = -nostdlib -Wl,--no-check-sections -L$(BUILD_DIR)sdklib -L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=$(BUILD_DIR)$(PROGRAM).map $(EXTRA_LDFLAGS)
|
LDFLAGS = -nostdlib -Wl,--no-check-sections -L$(BUILD_DIR)sdklib -L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=$(BUILD_DIR)$(PROGRAM).map $(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
|
ifeq ($(WARNINGS_AS_ERRORS),1)
|
||||||
|
C_CXX_FLAGS += -Werror
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(SPLIT_SECTIONS),1)
|
ifeq ($(SPLIT_SECTIONS),1)
|
||||||
C_CXX_FLAGS += -ffunction-sections -fdata-sections
|
C_CXX_FLAGS += -ffunction-sections -fdata-sections
|
||||||
LDFLAGS += -Wl,-gc-sections
|
LDFLAGS += -Wl,-gc-sections
|
||||||
|
|
Loading…
Reference in a new issue