Incorporate yaffs2 into U-boot

To use YAFFS2 define CONFIG_YAFFS2

Signed-off-by: William Juul <william.juul@tandberg.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
diff --git a/fs/yaffs2/direct/Makefile b/fs/yaffs2/direct/Makefile
index 6315117..0ee18e5 100644
--- a/fs/yaffs2/direct/Makefile
+++ b/fs/yaffs2/direct/Makefile
@@ -17,50 +17,46 @@
 # $Id: Makefile,v 1.15 2007/07/18 19:40:38 charles Exp $
 
 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
+include $(TOPDIR)/config.mk
 
-CFLAGS =    -Wall -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -g $(EXTRA_COMPILE_FLAGS) -DNO_Y_INLINE
-CFLAGS+=    -fstack-check -O0
+LIB = $(obj)libyaffs2.a
 
-#CFLAGS+=   -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
-#CFLAGS+=   -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
+COBJS-$(CONFIG_YAFFS2) := \
+	yaffscfg.o yaffs_ecc.o yaffsfs.o yaffs_guts.o yaffs_packedtags1.o \
+	yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o \
+	yaffs_nand.o yaffs_checkptrw.o yaffs_qsort.o yaffs_mtdif.o \
+	yaffs_mtdif2.o
 
-
-DIRECTTESTOBJS = dtest.o yaffscfg2k.o yaffs_ecc.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
-		 yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
-		 yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \
-		 yaffs_checkptrw.o  yaffs_qsort.o \
-#		 yaffs_checkptrwtest.o\
-		 
-
-BOOTTESTOBJS = bootldtst.o yboot.o yaffs_fileem.o nand_ecc.o
-
-#ALLOBJS =  dtest.o nand_ecc.o yaffscfg.o yaffs_fileem.o yaffsfs.o yaffs_ramdisk.o bootldtst.o yboot.o yaffs_ramem2k.o
-
-ALLOBJS = $(DIRECTTESTOBJS) $(BOOTTESTOBJS)
+SRCS    := $(COBJS-y:.o=.c)
+OBJS    := $(addprefix $(obj),$(COBJS-y))
 
 SYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
           yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h  yaffs_nandemul2k.h \
-          yaffs_nand.c yaffs_nand.h \
+          yaffs_nand.c yaffs_nand.h yaffs_mtdif.c yaffs_mtdif.h \
           yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
-          yaffs_qsort.c yaffs_qsort.h
+          yaffs_qsort.c yaffs_qsort.h yaffs_mtdif2.c yaffs_mtdif2.h
 
-#all: directtest2k boottest
+# -DCONFIG_YAFFS_NO_YAFFS1
+CFLAGS +=    -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE -DLINUX_VERSION_CODE=0x20616 
 
-all: directtest2k
+all:  $(LIB)
 
-$(ALLOBJS): %.o: %.c
-	gcc -c $(CFLAGS) $< -o $@
+$(LIB): $(obj).depend $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
 
-$(SYMLINKS):
-	ln -s ../$@ $@
-
-directtest2k: $(SYMLINKS) $(DIRECTTESTOBJS)
-	gcc -o $@ $(DIRECTTESTOBJS)
-
-
-boottest: $(SYMLINKS) $(BOOTTESTOBJS)
-	gcc -o $@ $(BOOTTESTOBJS)
-
-
+.PHONY: clean distclean
 clean:
-	rm -f $(ALLOBJS) core
+	rm -f $(OBJS)
+
+distclean:  clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
+