From 47b2dca1efbee57218d5a3942f8614974136c0ed Mon Sep 17 00:00:00 2001 From: Sudar Date: Fri, 31 May 2013 17:05:47 +0530 Subject: Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo. Fixes #43 and fixes #51 --- arduino-mk/Arduino.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 8d43c9b..e5d9c76 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -428,11 +428,11 @@ endif ifeq ($(VARIANT),leonardo) # USB IDs for the Leonardo ifndef USB_VID -USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid) +USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid 2>/dev/null) endif ifndef USB_PID -USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid) +USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid 2>/dev/null) endif endif @@ -624,8 +624,13 @@ DEPS = $(LOCAL_OBJS:.o=.d) $(LIB_OBJS:.o=.d) $(USER_LIB_OBJS:.o=.d) $ CPPFLAGS += -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \ -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ $(SYS_INCLUDES) $(USER_INCLUDES) -g -Os -Wall \ - -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID) \ -ffunction-sections -fdata-sections + +# USB IDs for the Leonardo +ifeq ($(VARIANT),leonardo) + CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID) +endif + CFLAGS += -std=gnu99 $(EXTRA_FLAGS) $(EXTRA_CFLAGS) CXXFLAGS += -fno-exceptions $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS) ASFLAGS += -mmcu=$(MCU) -I. -x assembler-with-cpp -- cgit v1.2.3