Search in BOARDS_TXT for chip or cpu submenu

Using new Arduino IDE and ATTinyCore board module he need to search var
various vars not in cpu submenu but in chip. Changed the makefile in
order to search chip or cpu using regular expression.
This commit is contained in:
straccio 2016-06-22 10:55:43 +02:00
parent 6c5589bd3c
commit 8addd6c469

View file

@ -568,7 +568,7 @@ endif
ifndef PARSE_BOARD ifndef PARSE_BOARD
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter') # result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
PARSE_BOARD = $(shell grep -v '^\#' $(BOARDS_TXT) | grep "^[ \t]*$(1).$(2)=" | cut -d = -f 2) PARSE_BOARD = $(shell grep -Ev '^\#' $(BOARDS_TXT) | grep -E "^[ \t]*$(1).$(2)=" | cut -d = -f 2)
endif endif
# If NO_CORE is set, then we don't have to parse boards.txt file # If NO_CORE is set, then we don't have to parse boards.txt file
@ -587,7 +587,7 @@ ifeq ($(strip $(NO_CORE)),)
# Which variant ? This affects the include path # Which variant ? This affects the include path
ifndef VARIANT ifndef VARIANT
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.variant) VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.variant)
ifndef VARIANT ifndef VARIANT
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),build.variant) VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),build.variant)
endif endif
@ -597,7 +597,7 @@ ifeq ($(strip $(NO_CORE)),)
endif endif
# see if we are a caterina device like leonardo or micro # see if we are a caterina device like leonardo or micro
CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.file)) CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.file))
ifndef CATERINA ifndef CATERINA
# 1.5+ method if not a submenu # 1.5+ method if not a submenu
CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),bootloader.file)) CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),bootloader.file))
@ -609,14 +609,14 @@ ifeq ($(strip $(NO_CORE)),)
# processor stuff # processor stuff
ifndef MCU ifndef MCU
MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.mcu) MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.mcu)
ifndef MCU ifndef MCU
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu) MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
endif endif
endif endif
ifndef F_CPU ifndef F_CPU
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.f_cpu) F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.f_cpu)
ifndef F_CPU ifndef F_CPU
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu) F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu)
endif endif
@ -635,14 +635,14 @@ ifeq ($(strip $(NO_CORE)),)
# normal programming info # normal programming info
ifndef AVRDUDE_ARD_PROGRAMMER ifndef AVRDUDE_ARD_PROGRAMMER
AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.protocol) AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.protocol)
ifndef AVRDUDE_ARD_PROGRAMMER ifndef AVRDUDE_ARD_PROGRAMMER
AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),upload.protocol) AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),upload.protocol)
endif endif
endif endif
ifndef AVRDUDE_ARD_BAUDRATE ifndef AVRDUDE_ARD_BAUDRATE
AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.speed) AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.speed)
ifndef AVRDUDE_ARD_BAUDRATE ifndef AVRDUDE_ARD_BAUDRATE
AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),upload.speed) AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),upload.speed)
endif endif
@ -654,21 +654,21 @@ ifeq ($(strip $(NO_CORE)),)
endif endif
ifndef ISP_HIGH_FUSE ifndef ISP_HIGH_FUSE
ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.high_fuses) ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.high_fuses)
ifndef ISP_HIGH_FUSE ifndef ISP_HIGH_FUSE
ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.high_fuses) ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.high_fuses)
endif endif
endif endif
ifndef ISP_LOW_FUSE ifndef ISP_LOW_FUSE
ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.low_fuses) ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.low_fuses)
ifndef ISP_LOW_FUSE ifndef ISP_LOW_FUSE
ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.low_fuses) ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.low_fuses)
endif endif
endif endif
ifndef ISP_EXT_FUSE ifndef ISP_EXT_FUSE
ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.extended_fuses) ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.extended_fuses)
ifndef ISP_EXT_FUSE ifndef ISP_EXT_FUSE
ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.extended_fuses) ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.extended_fuses)
endif endif
@ -679,7 +679,7 @@ ifeq ($(strip $(NO_CORE)),)
endif endif
ifndef BOOTLOADER_FILE ifndef BOOTLOADER_FILE
BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.file) BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.file)
ifndef BOOTLOADER_FILE ifndef BOOTLOADER_FILE
BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.file) BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.file)
endif endif
@ -690,7 +690,7 @@ ifeq ($(strip $(NO_CORE)),)
endif endif
ifndef HEX_MAXIMUM_SIZE ifndef HEX_MAXIMUM_SIZE
HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.maximum_size) HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.maximum_size)
ifndef HEX_MAXIMUM_SIZE ifndef HEX_MAXIMUM_SIZE
HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),upload.maximum_size) HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),upload.maximum_size)
endif endif
@ -1496,7 +1496,7 @@ show_boards:
@$(CAT) $(BOARDS_TXT) | grep -E '^[a-zA-Z0-9_\-]+.name' | sort -uf | sed 's/.name=/:/' | column -s: -t @$(CAT) $(BOARDS_TXT) | grep -E '^[a-zA-Z0-9_\-]+.name' | sort -uf | sed 's/.name=/:/' | column -s: -t
show_submenu: show_submenu:
@$(CAT) $(BOARDS_TXT) | grep -E '[a-zA-Z0-9_\-]+.menu.cpu.[a-zA-Z0-9_\-]+=' | sort -uf | sed 's/.menu.cpu./:/' | sed 's/=/:/' | column -s: -t @$(CAT) $(BOARDS_TXT) | grep -E '[a-zA-Z0-9_\-]+.menu.(cpu|chip).[a-zA-Z0-9_\-]+=' | sort -uf | sed 's/.menu.(cpu|chip)./:/' | sed 's/=/:/' | column -s: -t
monitor: monitor:
ifeq ($(MONITOR_CMD), 'putty') ifeq ($(MONITOR_CMD), 'putty')