2022-03-22 08:03:26 +00:00
|
|
|
OS := $(shell uname -s)
|
|
|
|
|
2020-10-07 09:37:43 +00:00
|
|
|
# Compiller
|
|
|
|
ifeq ($(TOOLCHAIN), arm)
|
|
|
|
PREFIX = arm-none-eabi-
|
|
|
|
ifdef GCC_PATH
|
2022-04-13 20:50:25 +00:00
|
|
|
PREFIX := $(GCC_PATH)/$(PREFIX)
|
2020-10-07 09:37:43 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2022-04-13 20:50:25 +00:00
|
|
|
CCACHE := $(shell which ccache)
|
|
|
|
|
|
|
|
CC = $(CCACHE) $(PREFIX)gcc -std=gnu17
|
|
|
|
CPP = $(CCACHE) $(PREFIX)g++ -std=gnu++17
|
2020-11-14 16:24:38 +00:00
|
|
|
LD = $(PREFIX)g++
|
2020-10-07 09:37:43 +00:00
|
|
|
AS = $(PREFIX)gcc -x assembler-with-cpp
|
|
|
|
CP = $(PREFIX)objcopy
|
|
|
|
SZ = $(PREFIX)size
|
|
|
|
HEX = $(CP) -O ihex
|
|
|
|
BIN = $(CP) -O binary -S
|
|
|
|
|
2022-04-13 20:50:25 +00:00
|
|
|
|
2022-03-22 08:03:26 +00:00
|
|
|
ifeq ($(OS), Darwin)
|
|
|
|
GDB = gdb
|
|
|
|
else
|
|
|
|
GDB = $(PREFIX)gdb-py
|
|
|
|
endif
|
|
|
|
|
2020-10-07 09:37:43 +00:00
|
|
|
DEBUG ?= 1
|
2021-05-12 07:59:20 +00:00
|
|
|
COMPACT ?= 0
|
2020-10-07 09:37:43 +00:00
|
|
|
ifeq ($(DEBUG), 1)
|
2021-11-04 17:26:41 +00:00
|
|
|
CFLAGS += -DFURI_DEBUG -DNDEBUG -Og -g
|
2021-05-12 07:59:20 +00:00
|
|
|
else ifeq ($(COMPACT), 1)
|
2021-12-24 18:47:48 +00:00
|
|
|
CFLAGS += -DFURI_NDEBUG -DNDEBUG -Os -g
|
2020-10-07 09:37:43 +00:00
|
|
|
else
|
2021-12-24 18:47:48 +00:00
|
|
|
CFLAGS += -DFURI_NDEBUG -DNDEBUG -Og -g
|
2020-10-07 09:37:43 +00:00
|
|
|
endif
|
|
|
|
|
2022-05-12 11:38:33 +00:00
|
|
|
CFLAGS += -fdata-sections -ffunction-sections -fno-math-errno -fstack-usage -MMD -MP -MF "$(@:%.o=%.d)"
|
2021-05-12 07:59:20 +00:00
|
|
|
CPPFLAGS += -fno-threadsafe-statics -fno-use-cxa-atexit -fno-exceptions -fno-rtti
|
2022-03-22 08:03:26 +00:00
|
|
|
LDFLAGS += -Wl,-Map=$(OBJ_DIR)/$(PROJECT).map,--cref -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -n
|