summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Gratton <angus@espressif.com>2018-06-04 11:24:15 +1000
committerDamien George <damien.p.george@gmail.com>2018-06-05 13:05:12 +1000
commitbc92206f89bfa82b96aaf1f93f41d7a4bc40140c (patch)
tree26743753d26c693fa556e50d028f5b3b692d7849
parentdf13ecde06c1d9a4f6c46cedc9d9da179178cd7f (diff)
esp32/Makefile: Extract common C & C++ flags for consistent compilation.
-rw-r--r--ports/esp32/Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile
index c8e2f67d3..d6a748bfd 100644
--- a/ports/esp32/Makefile
+++ b/ports/esp32/Makefile
@@ -94,13 +94,20 @@ INC_ESPCOMP += -I$(ESPCOMP)/app_trace/include
INC_ESPCOMP += -I$(ESPCOMP)/app_update/include
INC_ESPCOMP += -I$(ESPCOMP)/pthread/include
-CFLAGS_BASE = -std=gnu99 -Os -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -DESP_PLATFORM
+# these flags are common to C and C++ compilation
+CFLAGS_COMMON = -Os -ffunction-sections -fdata-sections -fstrict-volatile-bitfields \
+ -mlongcalls -nostdlib \
+ -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable \
+ -Wno-error=unused-variable -Wno-error=deprecated-declarations \
+ -DESP_PLATFORM
+
+CFLAGS_BASE = -std=gnu99 $(CFLAGS_COMMON) -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H
CFLAGS = $(CFLAGS_BASE) $(INC) $(INC_ESPCOMP)
CFLAGS += -DIDF_VER=\"$(IDF_VER)\"
CFLAGS += $(CFLAGS_MOD)
# this is what ESPIDF uses for c++ compilation
-CXXFLAGS = -std=gnu++11 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -DESP_PLATFORM $(INC) $(INC_ESPCOMP)
+CXXFLAGS = -std=gnu++11 $(CFLAGS_COMMON) $(INC) $(INC_ESPCOMP)
LDFLAGS = -nostdlib -Map=$(@:.elf=.map) --cref
LDFLAGS += --gc-sections -static -EL