From abad0738c047e503819e174b970f2317c3541cf2 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 5 Jul 2012 12:45:05 -0500 Subject: [PATCH] Deduce whether we have an avr-patched version of size, and use it. --- arduino-mk/Arduino.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index f3c22e4..11c7cf0 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -548,6 +548,14 @@ LDFLAGS = -mmcu=$(MCU) -Wl,--gc-sections -Os # Expand and pick the first port ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT))) +# Command for avr_size: do $(call avr_size,elffile,hexfile) +SIZE_ACCEPTS_MCU = $(shell $(SIZE) --help | grep 'AVR' && echo TRUE || true) +ifdef SIZE_ACCEPTS_MCU +avr_size = $(SIZE) --mcu=$(MCU) --format=avr $(1) +else +avr_size = $(SIZE) $(2) +endif + # Implicit rules for building everything (needed to get everything in # the right directory) # @@ -722,7 +730,7 @@ depends: $(DEPS) cat $(DEPS) > $(DEP_FILE) size: $(OBJDIR) $(TARGET_HEX) - $(SIZE) $(TARGET_HEX) + $(call avr_size,$(TARGET_ELF),$(TARGET_HEX)) show_boards: $(PARSE_BOARD_CMD) --boards