add conditional to perform check-size only for supported architectures

master
Michael F. Lamb 2018-02-06 16:32:31 -08:00 committed by Jack Humbert
parent fae8132295
commit fca31693df
1 changed files with 5 additions and 0 deletions

View File

@ -370,6 +370,7 @@ show_path:
@echo SRC=$(SRC) @echo SRC=$(SRC)
@echo OBJ=$(OBJ) @echo OBJ=$(OBJ)
ifeq ($(CC),avr-gcc)
check-size: check-size:
$(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne '/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'`; echo $$(($$n)) || echo 0)) $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne '/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'`; echo $$(($$n)) || echo 0))
$(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi)) $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
@ -377,6 +378,10 @@ check-size:
$(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then $(PRINT_WARNING_PLAIN); $(SILENT) || printf " * $(MSG_FILE_TOO_BIG)" ; else $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; fi \ if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then $(PRINT_WARNING_PLAIN); $(SILENT) || printf " * $(MSG_FILE_TOO_BIG)" ; else $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; fi \
fi fi
else
check-size:
echo "(Firmware size check does not yet support $(MCU) microprocessors; skipping.)"
endif
# Create build directory # Create build directory
$(shell mkdir -p $(BUILD_DIR) 2>/dev/null) $(shell mkdir -p $(BUILD_DIR) 2>/dev/null)