Refactor optimization flag in Makefile

Introduce `O_FLAG` variable for `-Os` to centralize optimization setting
for CFLAGS and LDFLAGS.
This commit is contained in:
2025-05-17 14:23:22 +02:00
parent 906dfa91f0
commit 2a2cb42b0b
+4 -3
View File
@@ -8,15 +8,16 @@ LD = $(CC)
OC = avr-objcopy
RM = rm -f
O_FLAG = -Os
BUILD_DIR = build
OBJ_DIR = $(BUILD_DIR)/obj
SRCS_C = source/adc.c source/moisture.c source/main.c source/pump.c
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(SRCS_C:.c=.o)))
CFLAGS = -Wall -Os -DF_CPU=$(F_CPU) -mmcu=$(MCU) -Iinclude
LDFLAGS = -Wall -Os -mmcu=$(MCU)
CFLAGS = -Wall $(O_FLAG) -DF_CPU=$(F_CPU) -mmcu=$(MCU) -Iinclude
LDFLAGS = -Wall $(O_FLAG) -mmcu=$(MCU)
LIBS = -lm
EXEC = atmega