Moved the BOARDS_TXT section and stop if BOARDS_TXT is not a file.
The section of Arduino.mk that calculates BOARDS_TXT was moved to just before the point where it gets used for the first time (a call to PARSE_BOARD). An error gets generated if BOARDS_TXT is not pointing to a valid file, directly after the BOARDS_TXT calculation. In addition, the PARSE_BOARD macro will now be bypassed if the BOARDS_TXT variable points to a non-existing file. If a user makefile uses PARSE_BOARD before including Arduino.mk, and the BOARDS_TXT is wrong, the error will only be caught in the Arduino.mk file, which is probably acceptable.
This commit is contained in:
parent
e44540043e
commit
62d23d66a2
2 changed files with 56 additions and 46 deletions
94
Arduino.mk
94
Arduino.mk
|
@ -388,6 +388,55 @@ endif
|
||||||
########################################################################
|
########################################################################
|
||||||
# Arduino and system paths
|
# Arduino and system paths
|
||||||
|
|
||||||
|
# Third party hardware and core like ATtiny or ATmega 16
|
||||||
|
ifdef ALTERNATE_CORE
|
||||||
|
$(call show_config_variable,ALTERNATE_CORE,[USER])
|
||||||
|
|
||||||
|
ifndef ALTERNATE_CORE_PATH
|
||||||
|
ALTERNATE_CORE_PATH = $(ARDUINO_SKETCHBOOK)/hardware/$(ALTERNATE_CORE)/$(ARCHITECTURE)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef ALTERNATE_CORE_PATH
|
||||||
|
|
||||||
|
ifdef ALTERNATE_CORE
|
||||||
|
$(call show_config_variable,ALTERNATE_CORE_PATH,[COMPUTED], (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE))
|
||||||
|
else
|
||||||
|
$(call show_config_variable,ALTERNATE_CORE_PATH,[USER])
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef ARDUINO_VAR_PATH
|
||||||
|
ARDUINO_VAR_PATH = $(ALTERNATE_CORE_PATH)/variants
|
||||||
|
$(call show_config_variable,ARDUINO_VAR_PATH,[COMPUTED],(from ALTERNATE_CORE_PATH))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef BOARDS_TXT
|
||||||
|
BOARDS_TXT = $(ALTERNATE_CORE_PATH)/boards.txt
|
||||||
|
$(call show_config_variable,BOARDS_TXT,[COMPUTED],(from ALTERNATE_CORE_PATH))
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
ifndef ARDUINO_VAR_PATH
|
||||||
|
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/variants
|
||||||
|
$(call show_config_variable,ARDUINO_VAR_PATH,[COMPUTED],(from ARDUINO_DIR))
|
||||||
|
else
|
||||||
|
$(call show_config_variable,ARDUINO_VAR_PATH,[USER])
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef BOARDS_TXT
|
||||||
|
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/boards.txt
|
||||||
|
$(call show_config_variable,BOARDS_TXT,[COMPUTED],(from ARDUINO_DIR))
|
||||||
|
else
|
||||||
|
$(call show_config_variable,BOARDS_TXT,[USER])
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (,$(wildcard $(BOARDS_TXT)))
|
||||||
|
$(error Currently BOARDS_TXT='$(BOARDS_TXT)', which is not an existing file or an invalid filename.)
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef TOOL_PREFIX
|
ifndef TOOL_PREFIX
|
||||||
TOOL_PREFIX = avr
|
TOOL_PREFIX = avr
|
||||||
endif
|
endif
|
||||||
|
@ -557,51 +606,6 @@ else
|
||||||
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[USER])
|
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[USER])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Third party hardware and core like ATtiny or ATmega 16
|
|
||||||
ifdef ALTERNATE_CORE
|
|
||||||
$(call show_config_variable,ALTERNATE_CORE,[USER])
|
|
||||||
|
|
||||||
ifndef ALTERNATE_CORE_PATH
|
|
||||||
ALTERNATE_CORE_PATH = $(ARDUINO_SKETCHBOOK)/hardware/$(ALTERNATE_CORE)/$(ARCHITECTURE)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef ALTERNATE_CORE_PATH
|
|
||||||
|
|
||||||
ifdef ALTERNATE_CORE
|
|
||||||
$(call show_config_variable,ALTERNATE_CORE_PATH,[COMPUTED], (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE))
|
|
||||||
else
|
|
||||||
$(call show_config_variable,ALTERNATE_CORE_PATH,[USER])
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef ARDUINO_VAR_PATH
|
|
||||||
ARDUINO_VAR_PATH = $(ALTERNATE_CORE_PATH)/variants
|
|
||||||
$(call show_config_variable,ARDUINO_VAR_PATH,[COMPUTED],(from ALTERNATE_CORE_PATH))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef BOARDS_TXT
|
|
||||||
BOARDS_TXT = $(ALTERNATE_CORE_PATH)/boards.txt
|
|
||||||
$(call show_config_variable,BOARDS_TXT,[COMPUTED],(from ALTERNATE_CORE_PATH))
|
|
||||||
endif
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
ifndef ARDUINO_VAR_PATH
|
|
||||||
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/variants
|
|
||||||
$(call show_config_variable,ARDUINO_VAR_PATH,[COMPUTED],(from ARDUINO_DIR))
|
|
||||||
else
|
|
||||||
$(call show_config_variable,ARDUINO_VAR_PATH,[USER])
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef BOARDS_TXT
|
|
||||||
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/boards.txt
|
|
||||||
$(call show_config_variable,BOARDS_TXT,[COMPUTED],(from ARDUINO_DIR))
|
|
||||||
else
|
|
||||||
$(call show_config_variable,BOARDS_TXT,[USER])
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,13 @@ dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
|
||||||
|
|
||||||
ifndef PARSE_BOARD
|
ifndef PARSE_BOARD
|
||||||
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
|
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
|
||||||
PARSE_BOARD = $(shell grep -Ev '^\#' $(BOARDS_TXT) | grep -E "^[ \t]*$(1).$(2)=" | cut -d = -f 2 | cut -d : -f 2)
|
PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \
|
||||||
|
then \
|
||||||
|
grep -Ev '^\#' $(BOARDS_TXT) | \
|
||||||
|
grep -E "^[ \t]*$(1).$(2)=" | \
|
||||||
|
cut -d = -f 2 | \
|
||||||
|
cut -d : -f 2; \
|
||||||
|
fi)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Run a shell script if it exists. Stops make on error.
|
# Run a shell script if it exists. Stops make on error.
|
||||||
|
|
Loading…
Reference in a new issue