diff --git a/Arduino.mk b/Arduino.mk
index aabe8e7..322ca38 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -19,7 +19,7 @@
 #
 # Original Arduino adaptation by mellis, eighthave, oli.keller
 #
-# Current version: 1.5
+# Current version: 1.5.1
 #
 # Refer to HISTORY.md file for complete history of changes
 #
@@ -45,11 +45,16 @@
 # that things are canonically arranged beneath the directories defined
 # above.
 #
-# On the Mac you might want to set:
+# On the Mac with IDE 1.0 you might want to set:
 #
 #   ARDUINO_DIR   = /Applications/Arduino.app/Contents/Resources/Java
 #   ARDMK_DIR     = /usr/local
 #
+# On the Mac with IDE 1.5+ you might want to set:
+#
+#   ARDUINO_DIR   = /Applications/Arduino.app/Contents/Java
+#   ARDMK_DIR     = /usr/local
+#
 # On Linux, you might prefer:
 #
 #   ARDUINO_DIR   = /usr/share/arduino
@@ -266,7 +271,9 @@ endif
 # Default TARGET to pwd (ex Daniele Vergini)
 
 ifndef TARGET
-    TARGET  = $(notdir $(CURDIR))
+    space :=
+    space +=
+    TARGET = $(notdir $(subst $(space),_,$(CURDIR)))
 endif
 
 ########################################################################
@@ -317,11 +324,11 @@ endif
 
 ########################################################################
 # 1.5.x vendor - defaults to arduino
-ifndef VENDOR
-	VENDOR = arduino
-    $(call show_config_variable,VENDOR,[DEFAULT])
+ifndef ARDMK_VENDOR
+	ARDMK_VENDOR = arduino
+    $(call show_config_variable,ARDMK_VENDOR,[DEFAULT])
 else
-    $(call show_config_variable,VENDOR,[USER])
+    $(call show_config_variable,ARDMK_VENDOR,[USER])
 endif
 
 ########################################################################
@@ -450,11 +457,12 @@ ifndef AVR_TOOLS_DIR
 else
     $(call show_config_variable,AVR_TOOLS_DIR,[USER])
 
-    # Check in Windows as Cygwin is being used, that the configuration file for the AVRDUDE is set
-    # Check if it works on MAC
-    ifeq ($(CURRENT_OS),WINDOWS)
-        ifndef AVRDUDE_CONF
-            AVRDUDE_CONF  = $(AVR_TOOLS_DIR)/etc/avrdude.conf
+    # ensure we can still find avrdude.conf
+    ifndef AVRDUDE_CONF
+        ifeq ($(shell expr $(ARDUINO_VERSION) '>' 157), 1)
+            AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
+        else
+            AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf
         endif
     endif
 
@@ -471,7 +479,7 @@ $(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
 ifndef ARDUINO_PLATFORM_LIB_PATH
     ifeq ($(shell expr $(ARDUINO_VERSION) '>' 150), 1)
         # only for 1.5
-        ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/libraries
+        ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/libraries
         $(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
     endif
 else
@@ -508,14 +516,14 @@ ifdef ALTERNATE_CORE_PATH
 else
 
     ifndef ARDUINO_VAR_PATH
-        ARDUINO_VAR_PATH  = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/variants
+        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/$(VENDOR)/$(ARCHITECTURE)/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])
@@ -560,7 +568,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 "^[ \t]*$(1).$(2)=" | cut -d = -f 2)
 endif
 
 # If NO_CORE is set, then we don't have to parse boards.txt file
@@ -701,16 +709,16 @@ else
     $(call show_config_variable,OBJDIR,[USER])
 endif
 
-# Now that we have ARDUINO_DIR, VENDOR, ARCHITECTURE and CORE,
+# Now that we have ARDUINO_DIR, ARDMK_VENDOR, ARCHITECTURE and CORE,
 # we can set ARDUINO_CORE_PATH.
 ifndef ARDUINO_CORE_PATH
     ifeq ($(strip $(CORE)),)
-        ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/cores/arduino
+        ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/cores/arduino
         $(call show_config_variable,ARDUINO_CORE_PATH,[DEFAULT])
     else
         ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(CORE)
         ifeq ($(wildcard $(ARDUINO_CORE_PATH)),)
-            ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/cores/$(CORE)
+            ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/cores/$(CORE)
             $(call show_config_variable,ARDUINO_CORE_PATH,[COMPUTED],(from ARDUINO_DIR, BOARD_TAG and boards.txt))
         else
             $(call show_config_variable,ARDUINO_CORE_PATH,[COMPUTED],(from ALTERNATE_CORE_PATH, BOARD_TAG and boards.txt))
@@ -763,9 +771,9 @@ LOCAL_AS_SRCS   ?= $(wildcard *.S)
 LOCAL_SRCS      = $(LOCAL_C_SRCS)   $(LOCAL_CPP_SRCS) \
 		$(LOCAL_CC_SRCS)   $(LOCAL_PDE_SRCS) \
 		$(LOCAL_INO_SRCS) $(LOCAL_AS_SRCS)
-LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o)   $(LOCAL_CPP_SRCS:.cpp=.o) \
-		$(LOCAL_CC_SRCS:.cc=.o)   $(LOCAL_PDE_SRCS:.pde=.o) \
-		$(LOCAL_INO_SRCS:.ino=.o) $(LOCAL_AS_SRCS:.S=.o)
+LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.c.o)   $(LOCAL_CPP_SRCS:.cpp=.cpp.o) \
+		$(LOCAL_CC_SRCS:.cc=.cc.o)   $(LOCAL_PDE_SRCS:.pde=.pde.o) \
+		$(LOCAL_INO_SRCS:.ino=.ino.o) $(LOCAL_AS_SRCS:.S=.S.o)
 LOCAL_OBJS      = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
 
 ifeq ($(words $(LOCAL_SRCS)), 0)
@@ -797,13 +805,14 @@ ifeq ($(strip $(NO_CORE)),)
         CORE_C_SRCS     = $(wildcard $(ARDUINO_CORE_PATH)/*.c)
         CORE_C_SRCS    += $(wildcard $(ARDUINO_CORE_PATH)/avr-libc/*.c)
         CORE_CPP_SRCS   = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
+        CORE_AS_SRCS    = $(wildcard $(ARDUINO_CORE_PATH)/*.S)
 
         ifneq ($(strip $(NO_CORE_MAIN_CPP)),)
             CORE_CPP_SRCS := $(filter-out %main.cpp, $(CORE_CPP_SRCS))
             $(call show_config_info,NO_CORE_MAIN_CPP set so core library will not include main.cpp,[MANUAL])
         endif
 
-        CORE_OBJ_FILES  = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o) $(CORE_AS_SRCS:.S=.o)
+        CORE_OBJ_FILES  = $(CORE_C_SRCS:.c=.c.o) $(CORE_CPP_SRCS:.cpp=.cpp.o) $(CORE_AS_SRCS:.S=.S.o)
         CORE_OBJS       = $(patsubst $(ARDUINO_CORE_PATH)/%,  \
                 $(OBJDIR)/core/%,$(CORE_OBJ_FILES))
     endif
@@ -811,6 +820,7 @@ else
     $(call show_config_info,NO_CORE set so core library will not be built,[MANUAL])
 endif
 
+
 ########################################################################
 # Determine ARDUINO_LIBS automatically
 
@@ -953,21 +963,21 @@ LIB_AS_SRCS         := $(foreach lib, $(SYS_LIBS),  $(call get_library_files,$(l
 USER_LIB_CPP_SRCS   := $(foreach lib, $(USER_LIBS), $(call get_library_files,$(lib),cpp))
 USER_LIB_C_SRCS     := $(foreach lib, $(USER_LIBS), $(call get_library_files,$(lib),c))
 USER_LIB_AS_SRCS    := $(foreach lib, $(USER_LIBS), $(call get_library_files,$(lib),S))
-LIB_OBJS            = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SRCS)) \
-                      $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_CPP_SRCS)) \
-                      $(patsubst $(ARDUINO_LIB_PATH)/%.S,$(OBJDIR)/libs/%.o,$(LIB_AS_SRCS))
-USER_LIB_OBJS       = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/userlibs/%.o,$(USER_LIB_CPP_SRCS)) \
-                      $(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/userlibs/%.o,$(USER_LIB_C_SRCS)) \
-                      $(patsubst $(USER_LIB_PATH)/%.S,$(OBJDIR)/userlibs/%.o,$(USER_LIB_AS_SRCS))
+LIB_OBJS            = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.c.o,$(LIB_C_SRCS)) \
+                      $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.cpp.o,$(LIB_CPP_SRCS)) \
+                      $(patsubst $(ARDUINO_LIB_PATH)/%.S,$(OBJDIR)/libs/%.S.o,$(LIB_AS_SRCS))
+USER_LIB_OBJS       = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/userlibs/%.cpp.o,$(USER_LIB_CPP_SRCS)) \
+                      $(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/userlibs/%.c.o,$(USER_LIB_C_SRCS)) \
+                      $(patsubst $(USER_LIB_PATH)/%.S,$(OBJDIR)/userlibs/%.S.o,$(USER_LIB_AS_SRCS))
 
 ifdef ARDUINO_PLATFORM_LIB_PATH
     PLATFORM_INCLUDES     := $(foreach lib, $(PLATFORM_LIBS), $(call get_library_includes,$(lib)))
     PLATFORM_LIB_CPP_SRCS := $(foreach lib, $(PLATFORM_LIBS), $(call get_library_files,$(lib),cpp))
     PLATFORM_LIB_C_SRCS   := $(foreach lib, $(PLATFORM_LIBS), $(call get_library_files,$(lib),c))
     PLATFORM_LIB_AS_SRCS  := $(foreach lib, $(PLATFORM_LIBS), $(call get_library_files,$(lib),S))
-    PLATFORM_LIB_OBJS     := $(patsubst $(ARDUINO_PLATFORM_LIB_PATH)/%.cpp,$(OBJDIR)/platformlibs/%.o,$(PLATFORM_LIB_CPP_SRCS)) \
-                             $(patsubst $(ARDUINO_PLATFORM_LIB_PATH)/%.c,$(OBJDIR)/platformlibs/%.o,$(PLATFORM_LIB_C_SRCS)) \
-                             $(patsubst $(ARDUINO_PLATFORM_LIB_PATH)/%.S,$(OBJDIR)/platformlibs/%.o,$(PLATFORM_LIB_AS_SRCS))
+    PLATFORM_LIB_OBJS     := $(patsubst $(ARDUINO_PLATFORM_LIB_PATH)/%.cpp,$(OBJDIR)/platformlibs/%.cpp.o,$(PLATFORM_LIB_CPP_SRCS)) \
+                             $(patsubst $(ARDUINO_PLATFORM_LIB_PATH)/%.c,$(OBJDIR)/platformlibs/%.c.o,$(PLATFORM_LIB_C_SRCS)) \
+                             $(patsubst $(ARDUINO_PLATFORM_LIB_PATH)/%.S,$(OBJDIR)/platformlibs/%.S.o,$(PLATFORM_LIB_AS_SRCS))
 
 endif
 
@@ -989,7 +999,7 @@ ifndef DEBUG_FLAGS
 endif
 
 # SoftwareSerial requires -Os (some delays are tuned for this optimization level)
-%SoftwareSerial.o : OPTIMIZATION_FLAGS = -Os
+%SoftwareSerial.cpp.o : OPTIMIZATION_FLAGS = -Os
 
 ifndef MCU_FLAG_NAME
     MCU_FLAG_NAME = mmcu
@@ -1116,7 +1126,7 @@ endif
 
 # either calculate parent dir from arduino dir, or user-defined path
 ifndef BOOTLOADER_PARENT
-    BOOTLOADER_PARENT = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/bootloaders
+    BOOTLOADER_PARENT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/$(ARCHITECTURE)/bootloaders
     $(call show_config_variable,BOOTLOADER_PARENT,[COMPUTED],(from ARDUINO_DIR))
 else
     $(call show_config_variable,BOOTLOADER_PARENT,[USER])
@@ -1142,39 +1152,39 @@ $(call show_separator)
 # easy to change the build options in future
 
 # library sources
-$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c
+$(OBJDIR)/libs/%.c.o: $(ARDUINO_LIB_PATH)/%.c
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
-$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp
+$(OBJDIR)/libs/%.cpp.o: $(ARDUINO_LIB_PATH)/%.cpp
 	@$(MKDIR) $(dir $@)
 	$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
-$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.S
+$(OBJDIR)/libs/%.S.o: $(ARDUINO_LIB_PATH)/%.S
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
 
-$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.c
+$(OBJDIR)/platformlibs/%.c.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.c
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
-$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.cpp
+$(OBJDIR)/platformlibs/%.cpp.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.cpp
 	@$(MKDIR) $(dir $@)
 	$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
-$(OBJDIR)/platformlibs/%.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.S
+$(OBJDIR)/platformlibs/%.S.o: $(ARDUINO_PLATFORM_LIB_PATH)/%.S
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
 
-$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.cpp
+$(OBJDIR)/userlibs/%.cpp.o: $(USER_LIB_PATH)/%.cpp
 	@$(MKDIR) $(dir $@)
 	$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
-$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.c
+$(OBJDIR)/userlibs/%.c.o: $(USER_LIB_PATH)/%.c
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
-$(OBJDIR)/userlibs/%.o: $(USER_LIB_PATH)/%.S
+$(OBJDIR)/userlibs/%.S.o: $(USER_LIB_PATH)/%.S
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
 
@@ -1185,33 +1195,33 @@ else
 endif
 
 # normal local sources
-$(OBJDIR)/%.o: %.c $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.c.o: %.c $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
-$(OBJDIR)/%.o: %.cc $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.cc.o: %.cc $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
-$(OBJDIR)/%.o: %.cpp $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.cpp.o: %.cpp $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
-$(OBJDIR)/%.o: %.S $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.S.o: %.S $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
 
-$(OBJDIR)/%.o: %.s $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.s.o: %.s $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
 
 # the pde -> o file
-$(OBJDIR)/%.o: %.pde $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.pde.o: %.pde $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
 # the ino -> o file
-$(OBJDIR)/%.o: %.ino $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/%.ino.o: %.ino $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
@@ -1229,15 +1239,15 @@ $(OBJDIR)/%.s: %.cpp $(COMMON_DEPS) | $(OBJDIR)
 	$(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
 # core files
-$(OBJDIR)/core/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/core/%.c.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
 
-$(OBJDIR)/core/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/core/%.cpp.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
-$(OBJDIR)/core/%.o: $(ARDUINO_CORE_PATH)/%.S $(COMMON_DEPS) | $(OBJDIR)
+$(OBJDIR)/core/%.S.o: $(ARDUINO_CORE_PATH)/%.S $(COMMON_DEPS) | $(OBJDIR)
 	@$(MKDIR) $(dir $@)
 	$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
 
@@ -1348,10 +1358,8 @@ endif
 
 # Bootloader file settings
 ifndef AVRDUDE_ISP_BURN_BOOTLOADER
-    ifneq ($(strip $(BOOTLOADER_PATH)),)
-        ifneq ($(strip $(BOOTLOADER_FILE)),)
-            AVRDUDE_ISP_BURN_BOOTLOADER += -U flash:w:$(BOOTLOADER_PARENT)/$(BOOTLOADER_PATH)/$(BOOTLOADER_FILE):i
-        endif
+    ifneq ($(strip $(BOOTLOADER_FILE)),)
+        AVRDUDE_ISP_BURN_BOOTLOADER += -U flash:w:$(BOOTLOADER_PARENT)/$(BOOTLOADER_PATH)/$(BOOTLOADER_FILE):i
     endif
 endif
 
@@ -1368,7 +1376,7 @@ endif
 AVRDUDE_ISP_OPTS = -c $(ISP_PROG) -b $(AVRDUDE_ISP_BAUDRATE)
 
 ifndef $(ISP_PORT)
-    ifneq ($(strip $(ISP_PROG)),$(filter $(ISP_PROG), usbasp usbtiny gpio linuxgpio avrispmkii))
+    ifneq ($(strip $(ISP_PROG)),$(filter $(ISP_PROG), usbasp usbtiny gpio linuxgpio avrispmkii dragon_isp dragon_dw))
         AVRDUDE_ISP_OPTS += -P $(call get_isp_port)
     endif
 else
@@ -1405,7 +1413,7 @@ pre-build:
 		$(call runscript_if_exists,$(PRE_BUILD_HOOK))
 
 $(TARGET_ELF): 	$(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
-		$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm
+		$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm $(LINKER_SCRIPTS)
 
 $(CORE_LIB):	$(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)
 		$(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)
@@ -1485,7 +1493,10 @@ size:	$(TARGET_HEX)
 		$(call avr_size,$(TARGET_ELF),$(TARGET_HEX))
 
 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:
+	@$(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
 
 monitor:
 ifeq ($(MONITOR_CMD), 'putty')
@@ -1535,6 +1546,7 @@ help:
   make reset             - reset the Arduino by tickling DTR or changing baud\n\
                            rate on the serial port.\n\
   make show_boards       - list all the boards defined in boards.txt\n\
+  make show_submenu      - list all board submenus defined in boards.txt\n\
   make monitor           - connect to the Arduino's serial port\n\
   make size              - show the size of the compiled output (relative to\n\
                            resources, if you have a patched avr-size).\n\
diff --git a/HISTORY.md b/HISTORY.md
index 6f830d2..13dde6e 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -4,17 +4,28 @@ A Makefile for Arduino Sketches
 The following is the rough list of changes that went into different versions.
 I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
 
-### In Development
+### 1.5.1 (Debian version: 1.5-3) (2016-02-22)
 
+- New: Add show_submenu target (https://github.com/drewhutchison)
+- New: Add AVR Dragon to list of ISP's without a port (https://github.com/mtnocean)
 - New: Add more board examples to Blink demo (https://github.com/sej7278)
 - New: Add option to split avrdude MCU from avr-gcc MCU (Issue #357) (https://github.com/hhgarnes)
 - New: Add support for /dev/tty.wchusbserial* (comes with cheap clones - DCCduino) (https://github.com/biesiad)
-- New: Add support for picocom as serial monitor(https://github.com/biesiad)
+- New: Add support for picocom as serial monitor (https://github.com/biesiad)
+- Tweak: Add support for Adafruit trinket3/trinket5/protrinket3/protrinket5 by improved BOARDS_TXT parsing (Issue #393) (https://github/com/zabereer)
 - Tweak: Looks for submenu items first when parsing BOARDS_TXT (Issue #347) (https://github.com/sej7278)
 - Tweak: Various spelling/grammar/typo fixes (https://github.com/dcousens)
 - Tweak: Clarified some 1.5+ issues in docs (Issue #352) (https://github.com/sej7278)
 - Tweak: Added some more Continuous Integration tests (https://github.com/sej7278)
 - Tweak: Updated Fedora instructions (https://github.com/sej7278)
+- Fix: Preserve original extension for object files, support asm sources in core, fixes pulseInASM (Issue #255, #364) (https://github.com/sej7278)
+- Fix: Make sure TARGET is set correctly when CURDIR contains spaces (https://github.com/svendahlstrand)
+- Fix: Ensure AVRDUDE_CONF is set when AVR_TOOLS_DIR is, not just on Windows (Issue #381) (https://github.com/sej7278)
+- Fix: Rename VENDOR to ARDMK_VENDOR to workaround tcsh issue (Issue #386) (https://github.com/sej7278)
+- Fix: Document OSX 1.0/1.6 ARDUINO_DIR differences (https://github.com/thomaskilian)
+- Fix: Fix regex to support BOARD_TAGs with hyphens e.g. attiny44-20 (https://github.com/sej7278)
+- Fix: Remove check for BOOTLOADER_PATH, just check for BOOTLOADER_FILE (Issue #402) (https://github.com/sej7278)
+- Fix: Port ard-reset-arduino to pyserial 3.0 (#407, #408) (https://github.com/gauteh)
 
 ### 1.5 (2015-04-07)
 - New: Add support for new 1.5.x library layout (Issue #275) (https://github.com/lukasz-e)
diff --git a/README.md b/README.md
index 120d1da..bf59185 100644
--- a/README.md
+++ b/README.md
@@ -134,7 +134,7 @@ whilst [Blink](examples/Blink/Makefile) demonstrates the minimal settings requir
 
 Download a copy of this repo some where in your system or install it through a package.
 
-On the Mac you might want to set:
+On the Mac with IDE 1.0 you might want to set:
 
 ```make
     ARDUINO_DIR   = /Applications/Arduino.app/Contents/Resources/Java
@@ -144,6 +144,12 @@ On the Mac you might want to set:
     BOARD_TAG     = mega2560
 ```
 
+On the Mac with IDE 1.5+ it's like above but with
+
+```
+    ARDUINO_DIR   = /Applications/Arduino.app/Contents/Java
+```
+
 On Linux (if you have installed through package), you shouldn't need to set anything other than your board type and port:
 
 ```make
@@ -242,7 +248,7 @@ See examples/BlinkTeensy for example usage.
 
 ## Versioning
 
-The current version of the makefile is `1.5`. You can find the full history in the [HISTORY.md](HISTORY.md) file
+The current version of the makefile is `1.5.1`. You can find the full history in the [HISTORY.md](HISTORY.md) file
 
 This project adheres to Semantic [Versioning 2.0](http://semver.org/).
 
diff --git a/Teensy.mk b/Teensy.mk
index 8a441e7..3676c78 100644
--- a/Teensy.mk
+++ b/Teensy.mk
@@ -33,9 +33,9 @@ endif
 # include Common.mk now we know where it is
 include $(ARDMK_DIR)/Common.mk
 
-VENDOR              = teensy
+ARDMK_VENDOR        = teensy
 ARDUINO_CORE_PATH   = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3
-BOARDS_TXT          = $(ARDUINO_DIR)/hardware/$(VENDOR)/boards.txt
+BOARDS_TXT          = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/boards.txt
 
 ifndef F_CPU
     F_CPU=96000000
diff --git a/ard-reset-arduino.1 b/ard-reset-arduino.1
index d7b2eb1..b897869 100644
--- a/ard-reset-arduino.1
+++ b/ard-reset-arduino.1
@@ -1,4 +1,4 @@
-.TH ARD-RESET-ARDUINO "1" "April 2015" "ard-reset-arduino 1.5" "Arduino CLI Reset"
+.TH ARD-RESET-ARDUINO "1" "February 2016" "ard-reset-arduino 1.5.1" "Arduino CLI Reset"
 
 .SH NAME
 ard-reset-arduino - Reset Arduino board
diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md
index e509bb4..9a925e0 100644
--- a/arduino-mk-vars.md
+++ b/arduino-mk-vars.md
@@ -166,7 +166,7 @@ ARCHITECTURE = sam
 
 ----
 
-### VENDOR
+### ARDMK_VENDOR
 
 **Description:**
 
@@ -177,7 +177,7 @@ Defaults to `arduino`
 **Example:**
 
 ```Makefile
-VENDOR = sparkfun
+ARDMK_VENDOR = sparkfun
 ```
 
 **Requirement:** *Optional*
@@ -281,7 +281,7 @@ BOARD_TAG = uno or mega2560
 
 **Description:**
 
-1.5+ submenu as listed in `boards.txt`
+1.5+ submenu as listed in `boards.txt` or `make show_submenu`.
 
 **Example:**
 
@@ -378,6 +378,26 @@ OBJDIR = /path/to/my/project-directory/bin
 
 ----
 
+### TARGET
+
+**Description:**
+
+What name you would like for generated target files.
+
+Defaults to the name of your current working directory, but with underscores (_) instead of spaces.
+
+**Example:**
+
+```Makefile
+TARGET = my-project
+```
+
+Will generate targets like `my-project.hex` and `my-project.elf`.
+
+**Requirement:** *Optional*
+
+----
+
 ### ALTERNATE_CORE
 
 **Description:**
diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino
index 3e43486..1f2c7e9 100755
--- a/bin/ard-reset-arduino
+++ b/bin/ard-reset-arduino
@@ -6,6 +6,12 @@ import os.path
 import argparse
 from time import sleep
 
+pyserial_version = None
+try:
+  pyserial_version = int(serial.VERSION[0])
+except:
+  pyserial_version = 2  # less than 2.3
+
 parser = argparse.ArgumentParser(description='Reset an Arduino')
 parser.add_argument('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.')
 parser.add_argument('--verbose', action='store_true', help="Watch what's going on on STDERR.")
@@ -17,7 +23,12 @@ if args.caterina:
     if args.verbose: print('Forcing reset using 1200bps open/close on port %s' % args.port[0])
     ser = serial.Serial(args.port[0], 57600)
     ser.close()
-    ser.setBaudrate(1200)
+
+    if pyserial_version < 3:
+      ser.setBaudrate (1200)
+    else:
+      ser.baudrate = 1200
+
     ser.open()
     ser.setRTS(True)  # RTS line needs to be held high and DTR low
     ser.setDTR(False) # (see Arduino IDE source code)
diff --git a/chipKIT.mk b/chipKIT.mk
index 06d85e3..298ac96 100644
--- a/chipKIT.mk
+++ b/chipKIT.mk
@@ -81,7 +81,11 @@ ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE)
 ARDUINO_PREFERENCES_PATH = $(MPIDE_PREFERENCES_PATH)
 ARDUINO_DIR = $(MPIDE_DIR)
 
-CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S
+CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S \
+			   $(ARDUINO_CORE_PATH)/cpp-startup.S \
+			   $(ARDUINO_CORE_PATH)/crti.S \
+			   $(ARDUINO_CORE_PATH)/crtn.S \
+			   $(ARDUINO_CORE_PATH)/pic32_software_reset.S
 
 ARDUINO_VERSION = 23
 
@@ -107,9 +111,11 @@ LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript)
 LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
 
 MCU_FLAG_NAME=mprocessor
-LDFLAGS  += -T$(ARDUINO_CORE_PATH)/$(LDSCRIPT)
-LDFLAGS  += -T$(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld
-CPPFLAGS += -mno-smart-io -fno-short-double
+LDFLAGS  += -mdebugger -mno-peripheral-libs -nostartfiles -Wl,--gc-sections
+LINKER_SCRIPTS  += -T $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
+LINKER_SCRIPTS  += -T $(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld
+CPPFLAGS += -mno-smart-io -fno-short-double -fframe-base-loclist \
+			-g3 -Wcast-align -D_BOARD_MEGA_
 CFLAGS_STD =
 
 include $(ARDMK_DIR)/Arduino.mk
diff --git a/examples/MakefileExample/Makefile-example.mk b/examples/MakefileExample/Makefile-example.mk
index 9b6a118..34c080f 100644
--- a/examples/MakefileExample/Makefile-example.mk
+++ b/examples/MakefileExample/Makefile-example.mk
@@ -15,7 +15,7 @@ ARDMK_DIR         = $(PROJECT_DIR)/Arduino-Makefile
 ### ARDUINO_DIR
 ### Path to the Arduino application and resources directory.
 ### On OS X:
-ARDUINO_DIR       = /Applications/Arduino.app/Contents/Resources/Java
+ARDUINO_DIR       = /Applications/Arduino.app/Contents/Java
 ### or on Linux: (remove the one you don't want)
 ARDUINO_DIR       = /usr/share/arduino
 
@@ -38,12 +38,12 @@ AVR_TOOLS_DIR     = /usr/local
 ### or on Linux: (remove the one you don't want)
 AVR_TOOLS_DIR     = /usr
 
-### AVRDDUDE
+### AVRDUDE
 ### Path to avrdude directory.
 ### On OS X with `homebrew`:
-AVRDDUDE          = /usr/local/bin/avrdude
+AVRDUDE          = /usr/local/bin/avrdude
 ### or on Linux: (remove the one you don't want)
-AVRDDUDE          = /usr/bin/avrdude
+AVRDUDE          = /usr/bin/avrdude
 
 ### CFLAGS_STD
 ### Set the C standard to be used during compilation. Documentation (https://github.com/WeAreLeka/Arduino-Makefile/blob/std-flags/arduino-mk-vars.md#cflags_std)
diff --git a/packaging/fedora/arduino-mk.spec b/packaging/fedora/arduino-mk.spec
index ef870bb..30b7a09 100644
--- a/packaging/fedora/arduino-mk.spec
+++ b/packaging/fedora/arduino-mk.spec
@@ -1,5 +1,5 @@
 Name:			arduino-mk
-Version:		1.5
+Version:		1.5.1
 Release:		1%{dist}
 Summary:		Program your Arduino from the command line
 Packager:		Simon John <git@the-jedi.co.uk>
diff --git a/tests/script/bootstrap/common.sh b/tests/script/bootstrap/common.sh
index a6b6415..c3cd90e 100644
--- a/tests/script/bootstrap/common.sh
+++ b/tests/script/bootstrap/common.sh
@@ -184,7 +184,6 @@ if [ -z $COMMON_SOURCED ]; then
         PIP_SUDO_CMD=$SUDO_CMD
     fi
 
-    $PIP_SUDO_CMD pip install --upgrade setuptools
     $PIP_SUDO_CMD pip install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt
 
     COMMON_SOURCED=1