From 2c9c8bf2e0f11a1e30034cbab076e2a3e0e85d1b Mon Sep 17 00:00:00 2001
From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
Date: Sat, 27 Sep 2014 09:09:39 +0200
Subject: [PATCH] make: remove dependency from flash to all

* print message when no hex file is found instead
* add objcopy for native so that flash can succeed
---
 Makefile.include               | 11 ++++++++++-
 boards/native/Makefile.include |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile.include b/Makefile.include
index 1144efbd5a..8e1854f7b2 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -178,7 +178,16 @@ distclean:
 	-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTBASE)/pkg/$$i distclean ; done
 	-@rm -rf $(BINDIRBASE)
 
-flash: all
+flash: $(filter all all-%, $(MAKECMDGOALS))
+	@if [ ! -f $${HEXFILE} ]; then \
+		echo ""; \
+		echo ""; \
+		echo "You need to create a hex file before you can flash it."; \
+		echo "Unless you know otherwise, 'make all' usually does what you want."; \
+		echo ""; \
+		echo ""; \
+		exit 1; \
+	fi
 	$(FLASHER) $(FFLAGS)
 
 term:
diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include
index ef82dbef3d..1c4f5e963c 100644
--- a/boards/native/Makefile.include
+++ b/boards/native/Makefile.include
@@ -16,7 +16,7 @@ export AR ?= $(PREFIX)ar
 export AS ?= $(PREFIX)as
 export LINK ?= $(PREFIX)gcc
 export SIZE ?= $(PREFIX)size
-export OBJCOPY = true
+export OBJCOPY = $(PREFIX)objcopy
 
 export DEBUGGER = gdb
 export TERMPROG = $(ELF)
-- 
GitLab