fs: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile
index a071af1..fd6a105 100644
--- a/fs/jffs2/Makefile
+++ b/fs/jffs2/Makefile
@@ -26,13 +26,15 @@
 LIB	= $(obj)libjffs2.a
 
 AOBJS	=
-COBJS-y += jffs2_1pass.o
+ifdef CONFIG_CMD_JFFS2
+COBJS-$(CONFIG_JFFS2_LZO_LZARI) += compr_lzari.o
+COBJS-$(CONFIG_JFFS2_LZO_LZARI) += compr_lzo.o
 COBJS-y += compr_rtime.o
 COBJS-y += compr_rubin.o
 COBJS-y += compr_zlib.o
+COBJS-y += jffs2_1pass.o
 COBJS-y += mini_inflate.o
-COBJS-y += compr_lzo.o
-COBJS-y += compr_lzari.o
+endif
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(AOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/fs/jffs2/compr_lzari.c b/fs/jffs2/compr_lzari.c
index f64bc74..6a29608 100644
--- a/fs/jffs2/compr_lzari.c
+++ b/fs/jffs2/compr_lzari.c
@@ -50,8 +50,6 @@
 
 
 #include <config.h>
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_LZO_LZARI)
-
 #include <linux/stddef.h>
 #include <jffs2/jffs2.h>
 
@@ -259,4 +257,3 @@
 {
     return Decode(data_in, cpage_out, srclen, destlen);
 }
-#endif
diff --git a/fs/jffs2/compr_lzo.c b/fs/jffs2/compr_lzo.c
index a32b993..e648ec4 100644
--- a/fs/jffs2/compr_lzo.c
+++ b/fs/jffs2/compr_lzo.c
@@ -67,8 +67,6 @@
 
 
 #include <config.h>
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_LZO_LZARI)
-
 #include <linux/stddef.h>
 #include <jffs2/jffs2.h>
 #include <jffs2/compr_rubin.h>
@@ -401,5 +399,3 @@
 	lzo_uint outlen = destlen;
 	return lzo1x_decompress (data_in, srclen, cpage_out, &outlen, NULL);
 }
-
-#endif
diff --git a/fs/jffs2/compr_rtime.c b/fs/jffs2/compr_rtime.c
index 144263c..89b9f2f 100644
--- a/fs/jffs2/compr_rtime.c
+++ b/fs/jffs2/compr_rtime.c
@@ -46,8 +46,6 @@
  */
 
 #include <config.h>
-#if defined(CONFIG_CMD_JFFS2)
-
 #include <jffs2/jffs2.h>
 
 void rtime_decompress(unsigned char *data_in, unsigned char *cpage_out,
@@ -87,5 +85,3 @@
 		}
 	}
 }
-
-#endif
diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c
index f6f3fa1..9ff2217 100644
--- a/fs/jffs2/compr_rubin.c
+++ b/fs/jffs2/compr_rubin.c
@@ -39,8 +39,6 @@
  */
 
 #include <config.h>
-#if defined(CONFIG_CMD_JFFS2)
-
 #include <jffs2/jffs2.h>
 #include <jffs2/compr_rubin.h>
 
@@ -122,5 +120,3 @@
 
 	rubin_do_decompress(bits, data_in+8, cpage_out, dstlen);
 }
-
-#endif
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c
index 29dfe1b..d306b6d 100644
--- a/fs/jffs2/compr_zlib.c
+++ b/fs/jffs2/compr_zlib.c
@@ -37,8 +37,6 @@
 
 #include <common.h>
 #include <config.h>
-#if defined(CONFIG_CMD_JFFS2)
-
 #include <jffs2/jffs2.h>
 #include <jffs2/mini_inflate.h>
 
@@ -48,5 +46,3 @@
     return (decompress_block(cpage_out, data_in + 2, (void *) ldr_memcpy));
 
 }
-
-#endif
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index b5e7ab8..5d22dd7 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -117,9 +117,6 @@
 #include <linux/stat.h>
 #include <linux/time.h>
 #include <watchdog.h>
-
-#if defined(CONFIG_CMD_JFFS2)
-
 #include <jffs2/jffs2.h>
 #include <jffs2/jffs2_1pass.h>
 
@@ -1394,5 +1391,3 @@
 	}
 	return 1;
 }
-
-#endif
diff --git a/fs/jffs2/jffs2_nand_1pass.c b/fs/jffs2/jffs2_nand_1pass.c
index 9f6de7d..e288d5a 100644
--- a/fs/jffs2/jffs2_nand_1pass.c
+++ b/fs/jffs2/jffs2_nand_1pass.c
@@ -1,6 +1,6 @@
 #include <common.h>
 
-#if !defined(CONFIG_NAND_LEGACY) && defined(CONFIG_CMD_JFFS2)
+#if !defined(CONFIG_NAND_LEGACY)
 
 #include <malloc.h>
 #include <linux/stat.h>
diff --git a/fs/jffs2/mini_inflate.c b/fs/jffs2/mini_inflate.c
index 4c50fc3..bd40a57 100644
--- a/fs/jffs2/mini_inflate.c
+++ b/fs/jffs2/mini_inflate.c
@@ -24,9 +24,6 @@
  */
 
 #include <config.h>
-
-#if defined(CONFIG_CMD_JFFS2)
-
 #include <jffs2/mini_inflate.h>
 
 /* The order that the code lengths in section 3.2.7 are in */
@@ -392,5 +389,3 @@
 #endif
 	return stream.error ? -stream.error : stream.decoded;
 }
-
-#endif