From 47b2dca1efbee57218d5a3942f8614974136c0ed Mon Sep 17 00:00:00 2001 From: Sudar Date: Fri, 31 May 2013 17:05:47 +0530 Subject: [PATCH] Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo. Fixes #43 and fixes #51 --- HISTORY.md | 3 +++ arduino-mk/Arduino.mk | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index d5fa3fc..f40fa04 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,9 @@ A Makefile for Arduino Sketches The following is the rough list of changes that went into different versions. I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list. +### 0.10.5 (in development) +- Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo. + ### 0.10.4 (2013-05-31) @matthijskooijman - Improved BAUD_RATE detection logic - Added logic to check if there is only .ino or .pde file 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