From c7de150ec329d3f645453f37f833c68e30595cf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= <gaetan.harter@fu-berlin.de>
Date: Tue, 5 Jun 2018 10:12:03 +0200
Subject: [PATCH] pkg/fatfs: fix declaration of periph_rtc optional dependency

* Declare optional dependency to periph_rtc
* Move CFLAGS definition to Makefile.include
---
 pkg/fatfs/Makefile.dep     | 10 ++--------
 pkg/fatfs/Makefile.include |  7 +++++++
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/pkg/fatfs/Makefile.dep b/pkg/fatfs/Makefile.dep
index 73eca11fe6..812803ae1e 100644
--- a/pkg/fatfs/Makefile.dep
+++ b/pkg/fatfs/Makefile.dep
@@ -2,11 +2,5 @@ USEMODULE += fatfs_diskio_mtd
 USEMODULE += auto_init_storage
 USEMODULE += mtd
 
-include $(RIOTBASE)/boards/$(BOARD)/Makefile.features
-
-#if periph_rtc is available use it. Otherwise use static timestamps
-ifneq (, $(filter periph_rtc, $(FEATURES_PROVIDED)))
-  CFLAGS += -DFATFS_FFCONF_OPT_FS_NORTC=0
-else
-  CFLAGS += -DFATFS_FFCONF_OPT_FS_NORTC=1
-endif
+# Use RTC for timestamps if available
+FEATURES_OPTIONAL += periph_rtc
diff --git a/pkg/fatfs/Makefile.include b/pkg/fatfs/Makefile.include
index 918fe83c88..7fe6cb9347 100644
--- a/pkg/fatfs/Makefile.include
+++ b/pkg/fatfs/Makefile.include
@@ -9,6 +9,13 @@ ifneq (,$(filter fatfs_vfs,$(USEMODULE)))
   DIRS += $(RIOTBASE)/pkg/fatfs/fatfs_vfs
 endif
 
+#if periph_rtc is available use it. Otherwise use static timestamps
+ifneq (,$(filter periph_rtc,$(USEMODULE)))
+  CFLAGS += -DFATFS_FFCONF_OPT_FS_NORTC=0
+else
+  CFLAGS += -DFATFS_FFCONF_OPT_FS_NORTC=1
+endif
+
 ifeq ($(shell uname -s),Darwin)
   CFLAGS += -Wno-empty-body
 endif
-- 
GitLab