From aed4be332eb88f53cdaa8ce21c9e9d1ce4c54347 Mon Sep 17 00:00:00 2001
From: Kaspar Schleiser <kaspar@schleiser.de>
Date: Mon, 11 May 2015 15:42:59 +0200
Subject: [PATCH] make: introduce RIOT_FILE_NOPATH and RIOT_FILE_RELATIVE

---
 Makefile.base | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile.base b/Makefile.base
index 7d0e89aa07..9b1bc4c044 100644
--- a/Makefile.base
+++ b/Makefile.base
@@ -57,10 +57,16 @@ CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
 # compile and generate dependency info
 
 $(OBJC): $(BINDIR)$(MODULE)/%.o: %.c
-	$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
+	$(AD)$(CC) \
+		-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
+		-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
+		$(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
 
 $(OBJCXX): $(BINDIR)$(MODULE)/%.o: %.cpp
-	$(AD)$(CXX) $(CXXFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
+	$(AD)$(CXX) \
+		-DRIOT_FILE_RELATIVE=\"$(patsubst $(RIOTBASE)/%,%,$(abspath $<))\" \
+		-DRIOT_FILE_NOPATH=\"$(notdir $<)\" \
+		$(CXXFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
 
 $(ASMOBJ): $(BINDIR)$(MODULE)/%.o: %.s
 	$(AD)$(AS) $(ASFLAGS) -o $@ $(abspath $<)
-- 
GitLab