Skip to content

Commit 0ea1886

Browse files
committed
Add support for custom defines
1 parent b2d1ff2 commit 0ea1886

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Arduino.mk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ else
10591059
endif
10601060

10611061
# Using += instead of =, so that CPPFLAGS can be set per sketch level
1062-
CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) \
1062+
override CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) \
10631063
-I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \
10641064
$(SYS_INCLUDES) $(PLATFORM_INCLUDES) $(USER_INCLUDES) -Wall -ffunction-sections \
10651065
-fdata-sections
@@ -1068,19 +1068,23 @@ CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_V
10681068
# By placing it before the user-provided CPPFLAGS rather than after, we allow the
10691069
# the user to disable it if they like, by adding the negation of the flag
10701070
# (-U__PROG_TYPES_COMPAT__) to the user-provided CPPFLAGS.
1071-
CPPFLAGS := -D__PROG_TYPES_COMPAT__ $(CPPFLAGS)
1071+
override CPPFLAGS := -D__PROG_TYPES_COMPAT__ $(CPPFLAGS)
10721072

10731073
ifdef DEBUG
10741074
OPTIMIZATION_FLAGS= $(DEBUG_FLAGS)
10751075
else
10761076
OPTIMIZATION_FLAGS = -O$(OPTIMIZATION_LEVEL)
10771077
endif
10781078

1079-
CPPFLAGS += $(OPTIMIZATION_FLAGS)
1079+
override CPPFLAGS += $(OPTIMIZATION_FLAGS)
10801080

10811081
# USB IDs for the Caterina devices like leonardo or micro
10821082
ifneq ($(CATERINA),)
1083-
CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID)
1083+
override CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID)
1084+
endif
1085+
1086+
ifdef CUSTOM_DEFINES
1087+
override CPPFLAGS += $(CUSTOM_DEFINES)
10841088
endif
10851089

10861090
# avr-gcc version that we can do maths on

0 commit comments

Comments
 (0)