Clarify by adding (space-based) indentation.
Helps simplify understanding all the nested conditionals.
This commit is contained in:
parent
49cca1da11
commit
744cb5350d
1 changed files with 115 additions and 115 deletions
|
@ -266,28 +266,28 @@ $(call show_separator)
|
|||
$(info Arduino.mk Configuration:)
|
||||
|
||||
ifndef ARDUINO_DIR
|
||||
NIX_DEFAULT_ARDUINO_DIR := $(call dir_if_exists,/usr/share/arduino)
|
||||
ifdef NIX_DEFAULT_ARDUINO_DIR
|
||||
ARDUINO_DIR = $(NIX_DEFAULT_ARDUINO_DIR)
|
||||
endif
|
||||
NIX_DEFAULT_ARDUINO_DIR := $(call dir_if_exists,/usr/share/arduino)
|
||||
ifdef NIX_DEFAULT_ARDUINO_DIR
|
||||
ARDUINO_DIR = $(NIX_DEFAULT_ARDUINO_DIR)
|
||||
endif
|
||||
|
||||
MAC_DEFAULT_ARDUINO_DIR := $(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java)
|
||||
ifdef MAC_DEFAULT_ARDUINO_DIR
|
||||
ARDUINO_DIR = $(MAC_DEFAULT_ARDUINO_DIR)
|
||||
endif
|
||||
MAC_DEFAULT_ARDUINO_DIR := $(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java)
|
||||
ifdef MAC_DEFAULT_ARDUINO_DIR
|
||||
ARDUINO_DIR = $(MAC_DEFAULT_ARDUINO_DIR)
|
||||
endif
|
||||
|
||||
ifdef ARDUINO_DIR
|
||||
$(call show_config_info,ARDUINO_DIR,[AUTODETECTED])
|
||||
endif
|
||||
ifdef ARDUINO_DIR
|
||||
$(call show_config_info,ARDUINO_DIR,[AUTODETECTED])
|
||||
endif
|
||||
|
||||
else
|
||||
$(call show_config_info,ARDUINO_DIR)
|
||||
$(call show_config_info,ARDUINO_DIR)
|
||||
endif
|
||||
########################################################################
|
||||
#
|
||||
# Default TARGET to cwd (ex Daniele Vergini)
|
||||
ifndef TARGET
|
||||
TARGET = $(notdir $(CURDIR))
|
||||
TARGET = $(notdir $(CURDIR))
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
|
@ -296,18 +296,18 @@ endif
|
|||
# Arduino version number
|
||||
ifndef ARDUINO_VERSION
|
||||
|
||||
# Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes.
|
||||
# Works for 1.0 and 1.0.1
|
||||
AUTO_ARDUINO_VERSION := $(shell cat $(ARDUINO_DIR)/lib/version.txt | sed -e 's/[.]//g' -e 's/$$/0000/' | head --bytes=3)
|
||||
ifdef AUTO_ARDUINO_VERSION
|
||||
ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION)
|
||||
$(call show_config_info,ARDUINO_VERSION,[AUTODETECTED])
|
||||
# Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes.
|
||||
# Works for 1.0 and 1.0.1
|
||||
AUTO_ARDUINO_VERSION := $(shell cat $(ARDUINO_DIR)/lib/version.txt | sed -e 's/[.]//g' -e 's/$$/0000/' | head --bytes=3)
|
||||
ifdef AUTO_ARDUINO_VERSION
|
||||
ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION)
|
||||
$(call show_config_info,ARDUINO_VERSION,[AUTODETECTED])
|
||||
else
|
||||
ARDUINO_VERSION = 100
|
||||
$(call show_config_info,ARDUINO_VERSION,[DEFAULT])
|
||||
endif
|
||||
else
|
||||
ARDUINO_VERSION = 100
|
||||
$(call show_config_info,ARDUINO_VERSION,[DEFAULT])
|
||||
endif
|
||||
else
|
||||
$(call show_config_info,ARDUINO_VERSION)
|
||||
$(call show_config_info,ARDUINO_VERSION)
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
|
@ -315,45 +315,45 @@ endif
|
|||
#
|
||||
ifdef ARDUINO_DIR
|
||||
|
||||
ifndef AVR_TOOLS_DIR
|
||||
ifndef AVR_TOOLS_DIR
|
||||
|
||||
BUNDLED_AVR_TOOLS_DIR := $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/avr)
|
||||
ifdef BUNDLED_AVR_TOOLS_DIR
|
||||
AVR_TOOLS_DIR = $(BUNDLED_AVR_TOOLS_DIR)
|
||||
# The avrdude bundled with Arduino can't find it's config
|
||||
AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
|
||||
$(call show_config_info,AVR_TOOLS_DIR,[BUNDLED],(in Arduino distribution))
|
||||
BUNDLED_AVR_TOOLS_DIR := $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/avr)
|
||||
ifdef BUNDLED_AVR_TOOLS_DIR
|
||||
AVR_TOOLS_DIR = $(BUNDLED_AVR_TOOLS_DIR)
|
||||
# The avrdude bundled with Arduino can't find it's config
|
||||
AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
|
||||
$(call show_config_info,AVR_TOOLS_DIR,[BUNDLED],(in Arduino distribution))
|
||||
|
||||
else
|
||||
|
||||
SYSTEMPATH_AVR_TOOLS_DIR := $(call dir_if_exists,$(abspath $(dir $(shell which avr-gcc))/..))
|
||||
ifdef SYSTEMPATH_AVR_TOOLS_DIR
|
||||
AVR_TOOLS_DIR = $(SYSTEMPATH_AVR_TOOLS_DIR)
|
||||
$(call show_config_info,AVR_TOOLS_DIR,[AUTODETECTED],(found in $$PATH))
|
||||
endif # SYSTEMPATH_AVR_TOOLS_DIR
|
||||
|
||||
endif # BUNDLED_AVR_TOOLS_DIR
|
||||
|
||||
else
|
||||
|
||||
$(call show_config_info,AVR_TOOLS_DIR)
|
||||
endif #ndef AVR_TOOLS_DIR
|
||||
|
||||
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
|
||||
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
|
||||
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/arduino/variants
|
||||
|
||||
else
|
||||
|
||||
SYSTEMPATH_AVR_TOOLS_DIR := $(call dir_if_exists,$(abspath $(dir $(shell which avr-gcc))/..))
|
||||
ifdef SYSTEMPATH_AVR_TOOLS_DIR
|
||||
AVR_TOOLS_DIR = $(SYSTEMPATH_AVR_TOOLS_DIR)
|
||||
$(call show_config_info,AVR_TOOLS_DIR,[AUTODETECTED],(found in $$PATH))
|
||||
endif # SYSTEMPATH_AVR_TOOLS_DIR
|
||||
|
||||
endif # BUNDLED_AVR_TOOLS_DIR
|
||||
|
||||
else
|
||||
|
||||
$(call show_config_info,AVR_TOOLS_DIR)
|
||||
endif #ndef AVR_TOOLS_DIR
|
||||
|
||||
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
|
||||
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
|
||||
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/arduino/variants
|
||||
|
||||
else
|
||||
|
||||
echo $(error "ARDUINO_DIR is not defined")
|
||||
echo $(error "ARDUINO_DIR is not defined")
|
||||
|
||||
endif
|
||||
|
||||
ifdef AVR_TOOLS_DIR
|
||||
|
||||
ifndef AVR_TOOLS_PATH
|
||||
AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
|
||||
endif
|
||||
ifndef AVR_TOOLS_PATH
|
||||
AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
@ -361,19 +361,19 @@ endif
|
|||
# Makefile distribution path
|
||||
#
|
||||
ifdef ARDMK_DIR
|
||||
$(call show_config_info,ARDMK_DIR)
|
||||
$(call show_config_info,ARDMK_DIR)
|
||||
|
||||
ifndef ARDMK_PATH
|
||||
ARDMK_PATH = $(ARDMK_DIR)/bin
|
||||
$(call show_config_info,ARDMK_PATH,[COMPUTED],(relative to ARDMK_DIR))
|
||||
ifndef ARDMK_PATH
|
||||
ARDMK_PATH = $(ARDMK_DIR)/bin
|
||||
$(call show_config_info,ARDMK_PATH,[COMPUTED],(relative to ARDMK_DIR))
|
||||
|
||||
else
|
||||
$(call show_config_info,ARDMK_PATH)
|
||||
endif
|
||||
else
|
||||
$(call show_config_info,ARDMK_PATH)
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
echo $(error "ARDMK_DIR is not defined")
|
||||
echo $(error "ARDMK_DIR is not defined")
|
||||
|
||||
endif
|
||||
|
||||
|
@ -381,14 +381,14 @@ endif
|
|||
# Miscellanea
|
||||
#
|
||||
ifndef ARDUINO_SKETCHBOOK
|
||||
ARDUINO_SKETCHBOOK = $(HOME)/sketchbook
|
||||
ARDUINO_SKETCHBOOK = $(HOME)/sketchbook
|
||||
endif
|
||||
|
||||
ifndef USER_LIB_PATH
|
||||
USER_LIB_PATH = $(ARDUINO_SKETCHBOOK)/libraries
|
||||
$(call show_config_info,USER_LIB_PATH,[DEFAULT],(in user sketchbook))
|
||||
USER_LIB_PATH = $(ARDUINO_SKETCHBOOK)/libraries
|
||||
$(call show_config_info,USER_LIB_PATH,[DEFAULT],(in user sketchbook))
|
||||
else
|
||||
$(call show_config_info,USER_LIB_PATH)
|
||||
$(call show_config_info,USER_LIB_PATH)
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
|
@ -399,87 +399,87 @@ endif
|
|||
# for more information (search for 'character special device').
|
||||
#
|
||||
ifndef MONITOR_BAUDRATE
|
||||
MONITOR_BAUDRATE = 9600
|
||||
MONITOR_BAUDRATE = 9600
|
||||
endif
|
||||
|
||||
ifndef MONITOR_CMD
|
||||
MONITOR_CMD = screen
|
||||
MONITOR_CMD = screen
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# Reset
|
||||
ifndef RESET_CMD
|
||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino $(ARD_RESET_OPTS)
|
||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino $(ARD_RESET_OPTS)
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# boards.txt parsing
|
||||
#
|
||||
ifndef BOARD_TAG
|
||||
BOARD_TAG = uno
|
||||
$(call show_config_info,BOARD_TAG,[DEFAULT])
|
||||
BOARD_TAG = uno
|
||||
$(call show_config_info,BOARD_TAG,[DEFAULT])
|
||||
else
|
||||
$(call show_config_info,BOARD_TAG)
|
||||
$(call show_config_info,BOARD_TAG)
|
||||
endif
|
||||
|
||||
ifndef BOARDS_TXT
|
||||
BOARDS_TXT = $(ARDUINO_DIR)/hardware/arduino/boards.txt
|
||||
BOARDS_TXT = $(ARDUINO_DIR)/hardware/arduino/boards.txt
|
||||
endif
|
||||
|
||||
ifndef PARSE_BOARD
|
||||
PARSE_BOARD = $(ARDMK_PATH)/ard-parse-boards
|
||||
PARSE_BOARD = $(ARDMK_PATH)/ard-parse-boards
|
||||
endif
|
||||
|
||||
ifndef PARSE_BOARD_OPTS
|
||||
PARSE_BOARD_OPTS = --boards_txt=$(BOARDS_TXT)
|
||||
PARSE_BOARD_OPTS = --boards_txt=$(BOARDS_TXT)
|
||||
endif
|
||||
|
||||
ifndef PARSE_BOARD_CMD
|
||||
PARSE_BOARD_CMD = $(PARSE_BOARD) $(PARSE_BOARD_OPTS)
|
||||
PARSE_BOARD_CMD = $(PARSE_BOARD) $(PARSE_BOARD_OPTS)
|
||||
endif
|
||||
|
||||
# Which variant ? This affects the include path
|
||||
ifndef VARIANT
|
||||
VARIANT = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.variant)
|
||||
VARIANT = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.variant)
|
||||
endif
|
||||
|
||||
# processor stuff
|
||||
ifndef MCU
|
||||
MCU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.mcu)
|
||||
MCU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.mcu)
|
||||
endif
|
||||
|
||||
ifndef F_CPU
|
||||
F_CPU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.f_cpu)
|
||||
F_CPU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.f_cpu)
|
||||
endif
|
||||
|
||||
# normal programming info
|
||||
ifndef AVRDUDE_ARD_PROGRAMMER
|
||||
AVRDUDE_ARD_PROGRAMMER = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.protocol)
|
||||
AVRDUDE_ARD_PROGRAMMER = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.protocol)
|
||||
endif
|
||||
|
||||
ifndef AVRDUDE_ARD_BAUDRATE
|
||||
AVRDUDE_ARD_BAUDRATE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.speed)
|
||||
AVRDUDE_ARD_BAUDRATE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.speed)
|
||||
endif
|
||||
|
||||
# fuses if you're using e.g. ISP
|
||||
ifndef ISP_LOCK_FUSE_PRE
|
||||
ISP_LOCK_FUSE_PRE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.unlock_bits)
|
||||
ISP_LOCK_FUSE_PRE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.unlock_bits)
|
||||
endif
|
||||
|
||||
ifndef ISP_LOCK_FUSE_POST
|
||||
ISP_LOCK_FUSE_POST = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.lock_bits)
|
||||
ISP_LOCK_FUSE_POST = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.lock_bits)
|
||||
endif
|
||||
|
||||
ifndef ISP_HIGH_FUSE
|
||||
ISP_HIGH_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.high_fuses)
|
||||
ISP_HIGH_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.high_fuses)
|
||||
endif
|
||||
|
||||
ifndef ISP_LOW_FUSE
|
||||
ISP_LOW_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.low_fuses)
|
||||
ISP_LOW_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.low_fuses)
|
||||
endif
|
||||
|
||||
ifndef ISP_EXT_FUSE
|
||||
ISP_EXT_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.extended_fuses)
|
||||
ISP_EXT_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.extended_fuses)
|
||||
endif
|
||||
|
||||
# Everything gets built in here
|
||||
|
@ -504,21 +504,21 @@ DEPS = $(LOCAL_OBJS:.o=.d)
|
|||
|
||||
# core sources
|
||||
ifeq ($(strip $(NO_CORE)),)
|
||||
ifdef ARDUINO_CORE_PATH
|
||||
CORE_C_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.c)
|
||||
CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
|
||||
ifdef ARDUINO_CORE_PATH
|
||||
CORE_C_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.c)
|
||||
CORE_CPP_SRCS = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
|
||||
|
||||
ifneq ($(strip $(NO_CORE_MAIN_CPP)),)
|
||||
CORE_CPP_SRCS := $(filter-out %main.cpp, $(CORE_CPP_SRCS))
|
||||
$(call show_config_info,CORE_CPP_SRCS,[MODIFIED],(Modified by the variable NO_CORE_MAIN_CPP))
|
||||
endif
|
||||
ifneq ($(strip $(NO_CORE_MAIN_CPP)),)
|
||||
CORE_CPP_SRCS := $(filter-out %main.cpp, $(CORE_CPP_SRCS))
|
||||
$(call show_config_info,CORE_CPP_SRCS,[MODIFIED],(Modified by the variable NO_CORE_MAIN_CPP))
|
||||
endif
|
||||
|
||||
CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o)
|
||||
CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, \
|
||||
$(OBJDIR)/%,$(CORE_OBJ_FILES))
|
||||
endif
|
||||
CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o)
|
||||
CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, \
|
||||
$(OBJDIR)/%,$(CORE_OBJ_FILES))
|
||||
endif
|
||||
else
|
||||
$(call show_config_info,CORE_CPP_SRCS,[MODIFIED],(Modified by the variable NO_CORE))
|
||||
$(call show_config_info,CORE_CPP_SRCS,[MODIFIED],(Modified by the variable NO_CORE))
|
||||
endif
|
||||
|
||||
|
||||
|
@ -575,31 +575,31 @@ LDFLAGS = -mmcu=$(MCU) -Wl,--gc-sections -Os
|
|||
ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT)))
|
||||
|
||||
ifndef SIZE_UTILITY_TYPE
|
||||
# Command for avr_size: do $(call avr_size,elffile,hexfile)
|
||||
ifneq (,$(findstring AVR,$(shell $(SIZE) --help)))
|
||||
SIZE_UTILITY_TYPE = AVR_ENHANCED
|
||||
else
|
||||
SIZE_UTILITY_TYPE = BASIC
|
||||
endif
|
||||
$(call show_config_info,SIZE_UTILITY_TYPE,[AUTODETECTED])
|
||||
# Command for avr_size: do $(call avr_size,elffile,hexfile)
|
||||
ifneq (,$(findstring AVR,$(shell $(SIZE) --help)))
|
||||
SIZE_UTILITY_TYPE = AVR_ENHANCED
|
||||
else
|
||||
SIZE_UTILITY_TYPE = BASIC
|
||||
endif
|
||||
$(call show_config_info,SIZE_UTILITY_TYPE,[AUTODETECTED])
|
||||
|
||||
else
|
||||
$(call show_config_info,SIZE_UTILITY_TYPE,[MANUAL OVERRIDE],Warning - Manually overriding this is not recommended!)
|
||||
$(call show_config_info,SIZE_UTILITY_TYPE,[MANUAL OVERRIDE],Warning - Manually overriding this is not recommended!)
|
||||
endif
|
||||
|
||||
ifeq ($(SIZE_UTILITY_TYPE),BASIC)
|
||||
# We have a plain-old binutils version - just give it the hex.
|
||||
avr_size = $(SIZE) $(2)
|
||||
# We have a plain-old binutils version - just give it the hex.
|
||||
avr_size = $(SIZE) $(2)
|
||||
endif
|
||||
|
||||
ifeq ($(SIZE_UTILITY_TYPE),AVR_ENHANCED)
|
||||
# We have a patched version of binutils that mentions AVR - pass the MCU
|
||||
# and the elf to get nice output.
|
||||
avr_size = $(SIZE) --mcu=$(MCU) --format=avr $(1)
|
||||
# We have a patched version of binutils that mentions AVR - pass the MCU
|
||||
# and the elf to get nice output.
|
||||
avr_size = $(SIZE) --mcu=$(MCU) --format=avr $(1)
|
||||
endif
|
||||
|
||||
ifndef avr_size
|
||||
$(error "We told you not to override SIZE_UTILITY_TYPE!")
|
||||
$(error "We told you not to override SIZE_UTILITY_TYPE!")
|
||||
endif
|
||||
|
||||
# end of config output
|
||||
|
@ -709,18 +709,18 @@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf
|
|||
# Avrdude
|
||||
#
|
||||
ifndef AVRDUDE
|
||||
AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
|
||||
AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
|
||||
endif
|
||||
|
||||
AVRDUDE_COM_OPTS = -q -V -p $(MCU)
|
||||
ifdef AVRDUDE_CONF
|
||||
AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF)
|
||||
AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF)
|
||||
endif
|
||||
|
||||
AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(ARD_PORT)
|
||||
|
||||
ifndef ISP_PROG
|
||||
ISP_PROG = -c stk500v2
|
||||
ISP_PROG = -c stk500v2
|
||||
endif
|
||||
|
||||
AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG)
|
||||
|
|
Loading…
Reference in a new issue