fs: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
diff --git a/fs/ext2/Makefile b/fs/ext2/Makefile
index 8313cdc..712e348 100644
--- a/fs/ext2/Makefile
+++ b/fs/ext2/Makefile
@@ -30,10 +30,10 @@
 LIB	= $(obj)libext2fs.a
 
 AOBJS	=
-COBJS	= ext2fs.o dev.o
+COBJS-$(CONFIG_CMD_EXT2) := ext2fs.o dev.o
 
-SRCS	:= $(AOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS))
+SRCS	:= $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS-y))
 
 #CPPFLAGS +=
 
diff --git a/fs/ext2/dev.c b/fs/ext2/dev.c
index 1728b34..3b49650 100644
--- a/fs/ext2/dev.c
+++ b/fs/ext2/dev.c
@@ -25,8 +25,6 @@
 
 
 #include <common.h>
-#if defined(CONFIG_CMD_EXT2)
-
 #include <config.h>
 #include <ext2fs.h>
 
@@ -139,4 +137,3 @@
 	}
 	return (1);
 }
-#endif
diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c
index 7833551..436f4a4 100644
--- a/fs/ext2/ext2fs.c
+++ b/fs/ext2/ext2fs.c
@@ -24,8 +24,6 @@
  */
 
 #include <common.h>
-
-#if defined(CONFIG_CMD_EXT2)
 #include <ext2fs.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
@@ -874,5 +872,3 @@
 	ext2fs_root = NULL;
 	return (0);
 }
-
-#endif