Make it possible to choose between the POSIX and the Coffee backend for CFS on the native platform.
@@ -5,9 +5,22 @@ endif
CONTIKI_TARGET_DIRS = . dev
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
+CONTIKI_TARGET_SOURCEFILES += platform.c clock.c xmem.c buttons.c
-CONTIKI_TARGET_SOURCEFILES += platform.c clock.c xmem.c
-CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c buttons.c
+# The different options
+MAKE_CFS_POSIX = 1
+MAKE_CFS_COFFEE = 2
+
+# Use CFS POSIX the default CFS backend.
+MAKE_CFS ?= MAKE_CFS_POSIX
+
+ifeq ($(MAKE_CFS),MAKE_CFS_POSIX)
+ CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c
+else ifeq ($(MAKE_CFS),MAKE_CFS_COFFEE)
+ MODULES += $(CONTIKI_NG_STORAGE_DIR)/cfs
+else
+ ${error Invalid MAKE_CFS configuration: "$(MAKE_CFS)"}
+endif
ifeq ($(HOST_OS),Windows)
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
