From 583a9e49502c6b2190a19e85ae33b2039782b2de Mon Sep 17 00:00:00 2001 From: Simon John Date: Sun, 15 Jun 2014 17:56:52 +0200 Subject: [PATCH 1/4] Fixed $MONITOR_PORT detection, thanks choffmann --- Arduino.mk | 2 +- HISTORY.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index 6439c04..3735b08 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -879,7 +879,7 @@ ifeq ($(CURRENT_OS), WINDOWS) DEVICE_PATH = /dev/ttyS$(shell awk 'BEGIN{ print $(COM_PORT_ID) - 1 }') endif -ifdef ARDUINO_PORT +ifdef MONITOR_PORT DEVICE_PATH = $(MONITOR_PORT) else # If no port is specified, try to guess it from wildcards. diff --git a/HISTORY.md b/HISTORY.md index c838a6b..bf97bdf 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -13,6 +13,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278) - Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278) - New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic) +- Fix: MONITOR_PORT detection (Issue #213) (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From e5b81254690bb82562bac329d5c52a185e4064f4 Mon Sep 17 00:00:00 2001 From: Simon John Date: Sat, 21 Jun 2014 12:32:34 +0200 Subject: [PATCH 2/4] Really fix $MONITOR_PORT detection Fixes issue #215 --- Arduino.mk | 7 ++++++- HISTORY.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 3735b08..183f633 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -866,6 +866,7 @@ LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEV SIZEFLAGS ?= --mcu=$(MCU) -C # for backwards compatibility, grab ARDUINO_PORT if the user has it set +# instead of MONITOR_PORT MONITOR_PORT ?= $(ARDUINO_PORT) ifeq ($(CURRENT_OS), WINDOWS) @@ -879,12 +880,16 @@ ifeq ($(CURRENT_OS), WINDOWS) DEVICE_PATH = /dev/ttyS$(shell awk 'BEGIN{ print $(COM_PORT_ID) - 1 }') endif -ifdef MONITOR_PORT +ifneq ($(strip $(MONITOR_PORT)),) + # set DEVICE_PATH based on user-defined MONITOR_PORT or ARDUINO_PORT DEVICE_PATH = $(MONITOR_PORT) + $(call show_config_variable,DEVICE_PATH,[COMPUTED],(from MONITOR_PORT)) else # If no port is specified, try to guess it from wildcards. + # Will only work if the Arduino is the only/first device matched. DEVICE_PATH = $(firstword $(wildcard \ /dev/ttyACM? /dev/ttyUSB? /dev/tty.usbserial* /dev/tty.usbmodem*)) + $(call show_config_variable,DEVICE_PATH,[AUTODETECTED]) endif # Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. diff --git a/HISTORY.md b/HISTORY.md index bf97bdf..a720f47 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -13,7 +13,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278) - Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278) - New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic) -- Fix: MONITOR_PORT detection (Issue #213) (https://github.com/sej7278) +- Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From 7618da7f5fa9b0ff70f22fb3353cfed41ff33dc0 Mon Sep 17 00:00:00 2001 From: Simon John Date: Sun, 29 Jun 2014 00:14:18 +0200 Subject: [PATCH 3/4] Added quotes around greps/cats to help alleviate possible problems with spaces in directory/file-names. Removed $TARGETS as it was an unsafe wildcard and was only used in "make clean" which itself has been simplified to just delete the $OBJDIR rather than waste time deleting individual files. --- Arduino.mk | 13 ++++++------- HISTORY.md | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 183f633..90cf9cf 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -299,7 +299,7 @@ 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 VERSION_FILE := $(ARDUINO_DIR)/lib/version.txt - AUTO_ARDUINO_VERSION := $(shell [ -e $(VERSION_FILE) ] && cat $(VERSION_FILE) | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/$$/0000/' | head -c3) + AUTO_ARDUINO_VERSION := $(shell [ -e "$(VERSION_FILE)" ] && cat "$(VERSION_FILE)" | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/$$/0000/' | head -c3) ifdef AUTO_ARDUINO_VERSION ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION) $(call show_config_variable,ARDUINO_VERSION,[AUTODETECTED]) @@ -331,7 +331,7 @@ ifndef ARDUINO_SKETCHBOOK ifneq ($(ARDUINO_PREFERENCES_PATH),) ARDUINO_SKETCHBOOK = $(shell grep --max-count=1 --regexp="sketchbook.path=" \ - $(ARDUINO_PREFERENCES_PATH) | \ + "$(ARDUINO_PREFERENCES_PATH)" | \ sed -e 's/sketchbook.path=//' ) endif @@ -520,7 +520,7 @@ endif ifndef PARSE_BOARD # result = $(call READ_BOARD_TXT, 'boardname', 'parameter') - PARSE_BOARD = $(shell grep -v "^\#" $(BOARDS_TXT) | grep $(1).$(2) | cut -d = -f 2 ) + PARSE_BOARD = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2 ) endif # If NO_CORE is set, then we don't have to parse boards.txt file @@ -752,7 +752,6 @@ endif TARGET_HEX = $(OBJDIR)/$(TARGET).hex TARGET_ELF = $(OBJDIR)/$(TARGET).elf TARGET_EEP = $(OBJDIR)/$(TARGET).eep -TARGETS = $(OBJDIR)/$(TARGET).* CORE_LIB = $(OBJDIR)/libcore.a # Names of executables - chipKIT needs to override all to set paths to PIC32 @@ -1255,13 +1254,13 @@ ifneq ($(strip $(AVRDUDE_ISP_FUSES_POST)),) endif clean: - $(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEPS) $(USER_LIB_OBJS) ${OBJDIR} + $(REMOVE) ./$(OBJDIR) size: $(TARGET_HEX) $(call avr_size,$(TARGET_ELF),$(TARGET_HEX)) show_boards: - @$(CAT) $(BOARDS_TXT) | grep -E "^[[:alnum:]]+.name" | sort -uf | sed 's/.name=/:/' | column -s: -t + @$(CAT) "$(BOARDS_TXT)" | grep -E "^[[:alnum:]]+.name" | sort -uf | sed 's/.name=/:/' | column -s: -t monitor: $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE) @@ -1286,7 +1285,7 @@ generated_assembly: generate_assembly @$(ECHO) "\"generated_assembly\" target is deprecated. Use \"generate_assembly\" target instead\n\n" help_vars: - @$(CAT) $(ARDMK_DIR)/arduino-mk-vars.md + @$(CAT) "$(ARDMK_DIR)/arduino-mk-vars.md" help: @$(ECHO) "\nAvailable targets:\n\ diff --git a/HISTORY.md b/HISTORY.md index a720f47..4b03b4f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -14,6 +14,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278) - New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic) - Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278) +- Tweak: Audited regexes/quoting/wildcards (Issue #192) (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278) From 437a0f54b55115dd9ac0ea02dc355306692ff5d8 Mon Sep 17 00:00:00 2001 From: Simon John Date: Mon, 30 Jun 2014 09:03:15 +0200 Subject: [PATCH 4/4] Build core objects in subdirectory, fixes issue #82 --- Arduino.mk | 8 ++++---- HISTORY.md | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 90cf9cf..21676ac 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -684,7 +684,7 @@ ifeq ($(strip $(NO_CORE)),) CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) $(CORE_AS_SRCS:.S=.o) CORE_OBJS = $(patsubst $(ARDUINO_CORE_PATH)/%, \ - $(OBJDIR)/%,$(CORE_OBJ_FILES)) + $(OBJDIR)/core/%,$(CORE_OBJ_FILES)) endif else $(call show_config_info,NO_CORE set so core library will not be built,[MANUAL]) @@ -1016,15 +1016,15 @@ $(OBJDIR)/%.s: %.ino $(COMMON_DEPS) | $(OBJDIR) # $(AS) -$(MCU_FLAG_NAME)=$(MCU) -alhnd $< > $@ # core files -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR) +$(OBJDIR)/core/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR) @$(MKDIR) $(dir $@) $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@ -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR) +$(OBJDIR)/core/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR) @$(MKDIR) $(dir $@) $(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.S $(COMMON_DEPS) | $(OBJDIR) +$(OBJDIR)/core/%.o: $(ARDUINO_CORE_PATH)/%.S $(COMMON_DEPS) | $(OBJDIR) @$(MKDIR) $(dir $@) $(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ diff --git a/HISTORY.md b/HISTORY.md index 4b03b4f..6d9ce63 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -15,6 +15,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic) - Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278) - Tweak: Audited regexes/quoting/wildcards (Issue #192) (https://github.com/sej7278) +- New: Build core objects in subdirectory (Issue #82) (https://github.com/sej7278) ### 1.3.3 (2014-04-12) - Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)