default OPTIMIZATION_LEVEL_DEBUG
help
This option sets optimization level.
- For "Release" setting, -Os flag is added to CFLAGS,
+
+ - for "Release" setting, -Os flag is added to CFLAGS,
and -DNDEBUG flag is added to CPPFLAGS.
- For "Debug" setting, -Og flag is added to CFLAGS.
+
+ - for "Debug" setting, -Og flag is added to CFLAGS.
+
+ To override any of these settings, set CFLAGS and/or CPPFLAGS
+ in project makefile, before including $(IDF_PATH)/make/project.mk.
+
config OPTIMIZATION_LEVEL_DEBUG
bool "Debug"
config OPTIMIZATION_LEVEL_RELEASE
-Wl,-EL
# Set default CPPFLAGS, CFLAGS, CXXFLAGS
-#
# These are exported so that components can use them when compiling.
-#
# If you need your component to add CFLAGS/etc for it's own source compilation only, set CFLAGS += in your component's Makefile.
-#
# If you need your component to add CFLAGS/etc globally for all source
-# files, set CFLAGS += in your component's Makefile.projbuild
+# files, set CFLAGS += in your component's Makefile.projbuild
+# If you need to set CFLAGS/CPPFLAGS/CXXFLAGS at project level, set them in application Makefile
+# before including project.mk. Default flags will be added before the ones provided in application Makefile.
# CPPFLAGS used by C preprocessor
-CPPFLAGS = -DESP_PLATFORM
+# If any flags are defined in application Makefile, add them at the end.
+CPPFLAGS := -DESP_PLATFORM $(CPPFLAGS)
# Warnings-related flags relevant both for C and C++
COMMON_WARNING_FLAGS = -Wall -Werror \
OPTIMIZATION_FLAGS += -ggdb
# List of flags to pass to C compiler
-CFLAGS = -std=gnu99 $(strip $(OPTIMIZATION_FLAGS) $(COMMON_FLAGS) $(COMMON_WARNING_FLAGS))
+# If any flags are defined in application Makefile, add them at the end.
+CFLAGS := $(strip \
+ -std=gnu99 \
+ $(OPTIMIZATION_FLAGS) \
+ $(COMMON_FLAGS) \
+ $(COMMON_WARNING_FLAGS) \
+ $(CFLAGS))
# List of flags to pass to C++ compiler
-CXXFLAGS = -std=gnu++11 -fno-exceptions -fno-rtti $(strip $(OPTIMIZATION_FLAGS) $(COMMON_FLAGS) $(COMMON_WARNING_FLAGS))
+# If any flags are defined in application Makefile, add them at the end.
+CXXFLAGS := $(strip \
+ -std=gnu++11 \
+ -fno-exceptions \
+ -fno-rtti \
+ $(OPTIMIZATION_FLAGS) \
+ $(COMMON_FLAGS) \
+ $(COMMON_WARNING_FLAGS) \
+ $(CXXFLAGS))
export CFLAGS CPPFLAGS CXXFLAGS