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 +=