-noinst_LIBRARIES = libflash.a
-libflash_a_SOURCES = flash.c lpc2000.c cfi.c non_cfi.c at91sam7.c at91sam7_old.c str7x.c str9x.c aduc702x.c nand.c lpc3180_nand_controller.c \
- stellaris.c str9xpec.c stm32x.c tms470.c ecos.c \
- s3c24xx_nand.c s3c2410_nand.c s3c2412_nand.c s3c2440_nand.c s3c2443_nand.c lpc288x.c ocl.c mflash.c pic32mx.c
-noinst_HEADERS = flash.h lpc2000.h cfi.h non_cfi.h at91sam7.h at91sam7_old.h str7x.h str9x.h nand.h lpc3180_nand_controller.h \
- stellaris.h str9xpec.h stm32x.h tms470.h s3c24xx_nand.h s3c24xx_regs_nand.h lpc288x.h mflash.h \
- ocl.h pic32mx.h
+noinst_LTLIBRARIES = libflash.la
+libflash_la_SOURCES = \
+ $(FLASH_SRCS) \
+ $(NAND_SRCS) \
+ mflash.c
+
+FLASH_SRCS = \
+ cfi.c \
+ non_cfi.c \
+ faux.c \
+ $(FLASH_DEVICES_SRCS) \
+ flash.c
+
+FLASH_DEVICES_SRCS = \
+ aduc702x.c \
+ at91sam3.c \
+ at91sam7.c \
+ avrf.c \
+ ecos.c \
+ lpc2000.c \
+ lpc288x.c \
+ lpc2900.c \
+ ocl.c \
+ pic32mx.c \
+ stellaris.c \
+ stm32x.c \
+ str7x.c \
+ str9x.c \
+ str9xpec.c \
+ tms470.c
+
+NAND_SRCS = \
+ arm_nandio.c \
+ nand_ecc.c \
+ nand_ecc_kw.c \
+ $(NAND_DEVICES_SRCS) \
+ nand.c
+
+NAND_DEVICES_SRCS = \
+ davinci_nand.c \
+ lpc3180_nand_controller.c \
+ mx3_nand.c \
+ orion_nand.c \
+ s3c24xx_nand.c \
+ s3c2410_nand.c \
+ s3c2412_nand.c \
+ s3c2440_nand.c \
+ s3c2443_nand.c
+
+
+noinst_HEADERS = \
+ arm_nandio.h \
+ at91sam7.h \
+ at91sam3.h \
+ avrf.h \
+ cfi.h \
+ flash.h \
+ lpc2000.h \
+ lpc288x.h \
+ lpc2900.h \
+ lpc3180_nand_controller.h \
+ mflash.h \
+ mx3_nand.h \
+ non_cfi.h \
+ nand.h \
+ ocl.h \
+ pic32mx.h \
+ stellaris.h \
+ stm32x.h \
+ str7x.h \
+ str9x.h \
+ str9xpec.h \
+ tms470.h \
+ s3c24xx_nand.h \
+ s3c24xx_regs_nand.h
+
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in