From 1bd3f7bb86dd5aa53858fdcc454a9974c011e3d8 Mon Sep 17 00:00:00 2001
From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
Date: Wed, 26 Feb 2014 09:18:42 +0100
Subject: [PATCH] pipe through sed instead

addresses: https://github.com/RIOT-OS/RIOT/pull/778#discussion_r10041955
---
 Makefile.base       | 8 ++++----
 cpu/native/Makefile | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile.base b/Makefile.base
index cdc3efd752..9b32b31d8f 100644
--- a/Makefile.base
+++ b/Makefile.base
@@ -29,12 +29,12 @@ $(BINDIR)$(MODULE).a: $(OBJ) $(ASMOBJ)
 # pull in dependency info for *existing* .o files
 -include $(OBJ:.o=.d)
 
-# compile and generate dependency info
+# compile and generate dependency info,
+# prepend path to dependency info file
 $(BINDIR)%.o: %.c
 	$(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
-	$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
-	@# prepend path to dependency info file
-	$(AD)sed -i -e "1s|^|$(BINDIR)|" $(BINDIR)$*.d
+	$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c |\
+		sed -e "1s|^|$(BINDIR)|" > $(BINDIR)$*.d
 
 $(BINDIR)%.o: %.s
 	$(AD)$(AS) $(ASFLAGS) $*.s -o $(BINDIR)$*.o
diff --git a/cpu/native/Makefile b/cpu/native/Makefile
index 48c3808100..44cc8928a3 100644
--- a/cpu/native/Makefile
+++ b/cpu/native/Makefile
@@ -15,8 +15,8 @@ include $(RIOTBASE)/Makefile.base
 
 $(BINDIR)%.o: %.c
 	$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -c $*.c -o $(BINDIR)$*.o
-	$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c > $(BINDIR)$*.d
-	@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
+	$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c |\
+		sed -e "1s|^|$(BINDIR)|" > $(BINDIR)$*.d
 
 
 clean::
-- 
GitLab