fs: Move conditional compilation to Makefile
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sun, 31 Aug 2008 02:24:56 +0000 (04:24 +0200)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sun, 31 Aug 2008 02:24:56 +0000 (04:24 +0200)
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
30 files changed:
fs/Makefile
fs/cramfs/Makefile
fs/cramfs/cramfs.c
fs/cramfs/uncompress.c
fs/ext2/Makefile
fs/ext2/dev.c
fs/ext2/ext2fs.c
fs/fat/Makefile
fs/fat/fat.c
fs/fat/file.c
fs/fdos/Makefile
fs/fdos/dev.c
fs/fdos/fat.c
fs/fdos/fdos.c
fs/fdos/fs.c
fs/fdos/subdir.c
fs/fdos/vfat.c
fs/jffs2/Makefile
fs/jffs2/compr_lzari.c
fs/jffs2/compr_lzo.c
fs/jffs2/compr_rtime.c
fs/jffs2/compr_rubin.c
fs/jffs2/compr_zlib.c
fs/jffs2/jffs2_1pass.c
fs/jffs2/jffs2_nand_1pass.c
fs/jffs2/mini_inflate.c
fs/reiserfs/Makefile
fs/reiserfs/dev.c
fs/reiserfs/mode_string.c
fs/reiserfs/reiserfs.c

index 95ac0e9..8bbd563 100644 (file)
 #
 #
 
-SUBDIRS        := jffs2 cramfs fdos fat reiserfs ext2 yaffs2
+subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
+subdirs-$(CONFIG_CMD_EXT2) += ext2
+subdirs-$(CONFIG_CMD_FAT) += fat
+subdirs-$(CONFIG_CMD_FDOS) += fdos
+subdirs-$(CONFIG_CMD_JFFS2) += jffs2
+subdirs-$(CONFIG_CMD_REISER) += reiserfs
+subdirs-$(CONFIG_YAFFS2) += yaffs2
+
+SUBDIRS        := $(subdirs-y)
 
 $(obj).depend all:
        @for dir in $(SUBDIRS) ; do \
index 13c043f..7b6cc0a 100644 (file)
@@ -26,10 +26,11 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)libcramfs.a
 
 AOBJS  =
-COBJS  = cramfs.o uncompress.o
+COBJS-$(CONFIG_CMD_CRAMFS) := cramfs.o
+COBJS-$(CONFIG_CMD_CRAMFS) += uncompress.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 +=
 
index e53c783..2956d39 100644 (file)
@@ -26,9 +26,6 @@
 
 #include <common.h>
 #include <malloc.h>
-
-#if defined(CONFIG_CMD_CRAMFS)
-
 #include <asm/byteorder.h>
 #include <linux/stat.h>
 #include <jffs2/jffs2.h>
@@ -343,5 +340,3 @@ int cramfs_check (struct part_info *info)
        }
        return 1;
 }
-
-#endif /* CFG_FS_CRAMFS */
index cf67967..39dd275 100644 (file)
@@ -25,8 +25,6 @@
 #include <watchdog.h>
 #include <zlib.h>
 
-#if defined(CONFIG_CMD_CRAMFS)
-
 static z_stream stream;
 
 void *zalloc(void *, unsigned, unsigned);
@@ -86,5 +84,3 @@ int cramfs_uncompress_exit (void)
        inflateEnd (&stream);
        return 0;
 }
-
-#endif /* CFG_FS_CRAMFS */
index 8313cdc..712e348 100644 (file)
@@ -30,10 +30,10 @@ include $(TOPDIR)/config.mk
 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 +=
 
index 1728b34..3b49650 100644 (file)
@@ -25,8 +25,6 @@
 
 
 #include <common.h>
-#if defined(CONFIG_CMD_EXT2)
-
 #include <config.h>
 #include <ext2fs.h>
 
@@ -139,4 +137,3 @@ int ext2fs_devread (int sector, int byte_offset, int byte_len, char *buf) {
        }
        return (1);
 }
-#endif
index 7833551..436f4a4 100644 (file)
@@ -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 @@ fail:
        ext2fs_root = NULL;
        return (0);
 }
-
-#endif
index 87af73b..b711460 100644 (file)
@@ -24,10 +24,10 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)libfat.a
 
 AOBJS  =
-COBJS  = fat.o file.o
+COBJS-$(CONFIG_CMD_FAT)        := fat.o file.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))
 
 all:   $(LIB) $(AOBJS)
 
index 49c78ed..2f0bd8c 100644 (file)
@@ -31,8 +31,6 @@
 #include <asm/byteorder.h>
 #include <part.h>
 
-#if defined(CONFIG_CMD_FAT)
-
 /*
  * Convert a string to lowercase.
  */
@@ -1024,5 +1022,3 @@ file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
        printf("reading %s\n",filename);
        return do_fat_read(filename, buffer, maxsize, LS_NO);
 }
-
-#endif
index 514dbae..e870734 100644 (file)
@@ -32,8 +32,6 @@
 #include <linux/stat.h>
 #include <linux/time.h>
 
-#if defined(CONFIG_CMD_FAT)
-
 /* Supported filesystems */
 static const struct filesystem filesystems[] = {
        { file_fat_detectfs,  file_fat_ls,  file_fat_read,  "FAT" },
@@ -204,5 +202,3 @@ file_read(const char *filename, void *buffer, unsigned long maxsize)
 
        return filesystems[current_filesystem].read(arg, buffer, maxsize);
 }
-
-#endif
index 2dba0fb..fce2032 100644 (file)
@@ -31,10 +31,10 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)libfdos.a
 
 AOBJS  =
-COBJS  = fat.o vfat.o dev.o fdos.o fs.o subdir.o
+COBJS-$(CONFIG_CMD_FDOS) := fat.o vfat.o dev.o fdos.o fs.o subdir.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 +=
 
index 271d0e7..b55b6ed 100644 (file)
@@ -28,8 +28,6 @@
 #include "dos.h"
 #include "fdos.h"
 
-#if defined(CONFIG_CMD_FDOS)
-
 #define NB_HEADS        2
 #define NB_TRACKS       80
 #define NB_SECTORS      18
@@ -190,6 +188,3 @@ int check_dev (BootSector_t *boot, Fs_t *fs)
 
     return (0);
 }
-
-
-#endif
index 2e2d2b8..5707c19 100644 (file)
@@ -26,8 +26,6 @@
 #include <config.h>
 #include <malloc.h>
 
-#if defined(CONFIG_CMD_FDOS)
-
 #include "dos.h"
 #include "fdos.h"
 
@@ -138,5 +136,3 @@ int read_fat (BootSector_t *boot, Fs_t *fs)
     }
     return (0);
 }
-
-#endif
index 5be6a96..db58562 100644 (file)
@@ -24,9 +24,8 @@
 
 #include <common.h>
 #include <config.h>
-
-#if defined(CONFIG_CMD_FDOS)
 #include <malloc.h>
+
 #include "dos.h"
 #include "fdos.h"
 
@@ -171,5 +170,3 @@ int dos_dir (void)
     free (name);
     return (0);
 }
-
-#endif
index aded670..5acf123 100644 (file)
@@ -26,8 +26,6 @@
 #include <config.h>
 #include <malloc.h>
 
-#if defined(CONFIG_CMD_FDOS)
-
 #include "dos.h"
 #include "fdos.h"
 
@@ -114,5 +112,3 @@ int fs_init (Fs_t *fs)
     free (boot);
     return (0);
 }
-
-#endif
index 497f554..5e96b0a 100644 (file)
@@ -26,8 +26,6 @@
 #include <config.h>
 #include <malloc.h>
 
-#if defined(CONFIG_CMD_FDOS)
-
 #include "dos.h"
 #include "fdos.h"
 
@@ -345,4 +343,3 @@ int read_file (Fs_t *fs,
     }
     return (read);
 }
-#endif
index 0e7883b..9f357a6 100644 (file)
@@ -24,8 +24,6 @@
 
 #include <common.h>
 #include <config.h>
-
-#if defined(CONFIG_CMD_FDOS)
 #include <linux/ctype.h>
 
 #include "dos.h"
@@ -352,6 +350,3 @@ static char *conv_name (char *name, char *ext, char Case, char *ans)
     }
     return (ans);
 }
-
-
-#endif
index a071af1..fd6a105 100644 (file)
@@ -26,13 +26,15 @@ include $(TOPDIR)/config.mk
 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)
index f64bc74..6a29608 100644 (file)
@@ -50,8 +50,6 @@ All rights reserved. Permission granted for non-commercial use.
 
 
 #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 @@ int lzari_decompress(unsigned char *data_in, unsigned char *cpage_out,
 {
     return Decode(data_in, cpage_out, srclen, destlen);
 }
-#endif
index a32b993..e648ec4 100644 (file)
@@ -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 @@ int lzo_decompress(unsigned char *data_in, unsigned char *cpage_out,
        lzo_uint outlen = destlen;
        return lzo1x_decompress (data_in, srclen, cpage_out, &outlen, NULL);
 }
-
-#endif
index 144263c..89b9f2f 100644 (file)
@@ -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 @@ void rtime_decompress(unsigned char *data_in, unsigned char *cpage_out,
                }
        }
 }
-
-#endif
index f6f3fa1..9ff2217 100644 (file)
@@ -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 @@ void dynrubin_decompress(unsigned char *data_in, unsigned char *cpage_out,
 
        rubin_do_decompress(bits, data_in+8, cpage_out, dstlen);
 }
-
-#endif
index 29dfe1b..d306b6d 100644 (file)
@@ -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 @@ long zlib_decompress(unsigned char *data_in, unsigned char *cpage_out,
     return (decompress_block(cpage_out, data_in + 2, (void *) ldr_memcpy));
 
 }
-
-#endif
index b5e7ab8..5d22dd7 100644 (file)
 #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 @@ jffs2_1pass_info(struct part_info * part)
        }
        return 1;
 }
-
-#endif
index 9f6de7d..e288d5a 100644 (file)
@@ -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>
index 4c50fc3..bd40a57 100644 (file)
@@ -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 @@ long decompress_block(unsigned char *dest, unsigned char *source,
 #endif
        return stream.error ? -stream.error : stream.decoded;
 }
-
-#endif
index e8711a4..9cef8ee 100644 (file)
@@ -30,10 +30,10 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)libreiserfs.a
 
 AOBJS  =
-COBJS  = reiserfs.o dev.o mode_string.o
+COBJS-$(CONFIG_CMD_REISER) := reiserfs.o dev.o mode_string.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 +=
 
index 46dc414..1facfaf 100644 (file)
@@ -19,8 +19,6 @@
 
 
 #include <common.h>
-#if defined(CONFIG_CMD_REISER)
-
 #include <config.h>
 #include <reiserfs.h>
 
@@ -119,5 +117,3 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
 
        return 1;
 }
-
-#endif
index 3e57ee4..801263d 100644 (file)
@@ -25,7 +25,6 @@
 
 
 #include <common.h>
-#if defined(CONFIG_CMD_REISER)
 #include <linux/stat.h>
 
 #if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \
@@ -137,5 +136,3 @@ const char *bb_mode_string(int mode)
 }
 
 #endif
-
-#endif
index aa96361..d84fb20 100644 (file)
@@ -29,8 +29,6 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_CMD_REISER)
-
 #include <malloc.h>
 #include <linux/ctype.h>
 #include <linux/time.h>
@@ -982,5 +980,3 @@ reiserfs_open (char *filename)
        }
        return filemax;
 }
-
-#endif