From 1377022b1873b9befb2b0819b6e6d1e3718b2b43 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Fri, 3 Apr 2015 14:26:18 +0000 Subject: [PATCH] [DFS] Use SConscript of each file system to build. --- components/dfs/SConscript | 215 ++----------------- components/dfs/filesystems/SConscript | 15 ++ components/dfs/filesystems/devfs/SConscript | 11 + components/dfs/filesystems/elmfat/SConscript | 26 +++ components/dfs/filesystems/jffs2/SConscript | 50 +++++ components/dfs/filesystems/nfs/SConscript | 11 + components/dfs/filesystems/ramfs/SConscript | 2 +- components/dfs/filesystems/romfs/SConscript | 15 ++ components/dfs/filesystems/uffs/SConscript | 11 + include/rtcomponents.h | 79 ------- 10 files changed, 153 insertions(+), 282 deletions(-) create mode 100644 components/dfs/filesystems/SConscript create mode 100644 components/dfs/filesystems/devfs/SConscript create mode 100644 components/dfs/filesystems/elmfat/SConscript create mode 100644 components/dfs/filesystems/jffs2/SConscript create mode 100644 components/dfs/filesystems/nfs/SConscript create mode 100644 components/dfs/filesystems/romfs/SConscript create mode 100644 components/dfs/filesystems/uffs/SConscript delete mode 100644 include/rtcomponents.h diff --git a/components/dfs/SConscript b/components/dfs/SConscript index 132f237f8b..e13ed292dc 100644 --- a/components/dfs/SConscript +++ b/components/dfs/SConscript @@ -1,207 +1,18 @@ -Import('RTT_ROOT') -Import('rtconfig') from building import * # The set of source files associated with this SConscript file. -dfs = Split(""" -src/dfs.c -src/dfs_fs.c -src/dfs_file.c -src/dfs_posix.c -""") - -# DFS-ELMFAT options -elmfat = Split(""" -filesystems/elmfat/dfs_elm.c -filesystems/elmfat/ff.c -""") - -# DFS-ROMFS options -romfs = Split(""" -filesystems/romfs/dfs_romfs.c -""") -if not GetDepend('DFS_ROMFS_ROOT'): - romfs = romfs + Split('filesystems/romfs/romfs.c') - -# DFS-RAMFS options -ramfs = Split(""" -filesystems/ramfs/dfs_ramfs.c -""") - -# DFS-DeviceFS options -devfs = Split(""" -filesystems/devfs/devfs.c -filesystems/devfs/console.c -""") - -# DFS-YAFFS2 options -yaffs2_src = Split(""" -filesystems/yaffs2/dfs_yaffs2.c -filesystems/yaffs2/yaffs_osglue.c -filesystems/yaffs2/yaffs_nandcfg.c - -filesystems/yaffs2/yaffs/yaffs_allocator.c -filesystems/yaffs2/yaffs/yaffs_bitmap.c -filesystems/yaffs2/yaffs/yaffs_checkptrw.c -filesystems/yaffs2/yaffs/yaffs_ecc.c -filesystems/yaffs2/yaffs/yaffs_guts.c -filesystems/yaffs2/yaffs/yaffs_nameval.c -filesystems/yaffs2/yaffs/yaffs_nand.c -filesystems/yaffs2/yaffs/yaffs_packedtags1.c -filesystems/yaffs2/yaffs/yaffs_packedtags2.c -filesystems/yaffs2/yaffs/yaffs_summary.c -filesystems/yaffs2/yaffs/yaffs_tagscompat.c -filesystems/yaffs2/yaffs/yaffs_verify.c -filesystems/yaffs2/yaffs/yaffs_yaffs1.c -filesystems/yaffs2/yaffs/yaffs_yaffs2.c - -filesystems/yaffs2/yaffs/direct/yaffs_attribs.c -filesystems/yaffs2/yaffs/direct/yaffs_hweight.c -filesystems/yaffs2/yaffs/direct/yaffs_nandif.c -filesystems/yaffs2/yaffs/direct/yaffs_qsort.c -filesystems/yaffs2/yaffs/direct/yaffsfs.c - -""") - -nfs = Split(''' -filesystems/nfs/mount_clnt.c -filesystems/nfs/mount_xdr.c -filesystems/nfs/nfs_clnt.c -filesystems/nfs/nfs_xdr.c -filesystems/nfs/dfs_nfs.c -filesystems/nfs/rpc/auth_none.c -filesystems/nfs/rpc/clnt_generic.c -filesystems/nfs/rpc/clnt_udp.c -filesystems/nfs/rpc/rpc_prot.c -filesystems/nfs/rpc/pmap.c -filesystems/nfs/rpc/xdr.c -filesystems/nfs/rpc/xdr_mem.c -''') - -uffs = Split(''' -filesystems/uffs/src/uffs/uffs_badblock.c -filesystems/uffs/src/uffs/uffs_blockinfo.c -filesystems/uffs/src/uffs/uffs_buf.c -filesystems/uffs/src/uffs/uffs_debug.c -filesystems/uffs/src/uffs/uffs_device.c -filesystems/uffs/src/uffs/uffs_ecc.c -filesystems/uffs/src/uffs/uffs_crc.c -filesystems/uffs/src/uffs/uffs_fd.c -filesystems/uffs/src/uffs/uffs_find.c -filesystems/uffs/src/uffs/uffs_flash.c -filesystems/uffs/src/uffs/uffs_fs.c -filesystems/uffs/src/uffs/uffs_init.c -filesystems/uffs/src/uffs/uffs_mem.c -filesystems/uffs/src/uffs/uffs_mtb.c -filesystems/uffs/src/uffs/uffs_pool.c -filesystems/uffs/src/uffs/uffs_public.c -filesystems/uffs/src/uffs/uffs_tree.c -filesystems/uffs/src/uffs/uffs_utils.c -filesystems/uffs/src/uffs/uffs_version.c - -filesystems/uffs/dfs_uffs.c -filesystems/uffs/uffs_nandif.c -filesystems/uffs/uffs_rtthread.c -''') - -jffs2 = Split(''' -filesystems/jffs2/dfs_jffs2.c -filesystems/jffs2/porting.c - -filesystems/jffs2/cyg/compress/src/adler32.c -filesystems/jffs2/cyg/compress/src/compress.c -filesystems/jffs2/cyg/compress/src/deflate.c -filesystems/jffs2/cyg/compress/src/infback.c -filesystems/jffs2/cyg/compress/src/inffast.c -filesystems/jffs2/cyg/compress/src/inflate.c -filesystems/jffs2/cyg/compress/src/inftrees.c -filesystems/jffs2/cyg/compress/src/trees.c -filesystems/jffs2/cyg/compress/src/uncompr.c -filesystems/jffs2/cyg/compress/src/zutil.c - -filesystems/jffs2/cyg/crc/crc16.c -filesystems/jffs2/cyg/crc/crc32.c -filesystems/jffs2/cyg/crc/posix_crc.c -filesystems/jffs2/kernel/rbtree.c -filesystems/jffs2/src/build.c -filesystems/jffs2/src/compr.c -filesystems/jffs2/src/compr_rtime.c -filesystems/jffs2/src/compr_rubin.c -filesystems/jffs2/src/compr_zlib.c -filesystems/jffs2/src/debug.c -filesystems/jffs2/src/dir-ecos.c -filesystems/jffs2/src/erase.c -filesystems/jffs2/src/flashio.c -filesystems/jffs2/src/fs-ecos.c -filesystems/jffs2/src/gc.c -filesystems/jffs2/src/gcthread.c -filesystems/jffs2/src/malloc-ecos.c -filesystems/jffs2/src/nodelist.c -filesystems/jffs2/src/nodemgmt.c -filesystems/jffs2/src/read.c -filesystems/jffs2/src/readinode.c -filesystems/jffs2/src/scan.c -filesystems/jffs2/src/write.c -''') - -src_local = dfs -CPPDEFINES = [] - -# The set of source files associated with this SConscript file. -path = [RTT_ROOT + '/components/dfs', RTT_ROOT + '/components/dfs/include'] - -if GetDepend('RT_USING_DFS_YAFFS2'): - src_local = src_local + yaffs2_src - path = path + [RTT_ROOT + '/components/dfs/filesystems/yaffs2/yaffs', \ - RTT_ROOT + '/components/dfs/filesystems/yaffs2/yaffs/direct' ] - -if GetDepend('RT_USING_DFS_ELMFAT'): - if GetDepend('RT_DFS_ELM_USE_LFN'): - if GetDepend('RT_DFS_ELM_CODE_PAGE_FILE'): - elmfat += ['filesystems/elmfat/option/ccfile.c'] - else: - if GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 932: - elmfat += ['filesystems/elmfat/option/cc932.c'] - elif GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 936: - elmfat += ['filesystems/elmfat/option/cc936.c'] - elif GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 949: - elmfat += ['filesystems/elmfat/option/cc949.c'] - elif GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 950: - elmfat += ['filesystems/elmfat/option/cc950.c'] - else: - elmfat += ['filesystems/elmfat/option/ccsbcs.c'] - src_local = src_local + elmfat - -if GetDepend(['RT_USING_DFS_NFS', 'RT_USING_LWIP']): - src_local = src_local + nfs - path = path + [RTT_ROOT + '/components/dfs/filesystems/nfs'] - -if GetDepend('RT_USING_DFS_ROMFS'): - src_local = src_local + romfs - path = path + [RTT_ROOT + '/components/dfs/filesystems/romfs'] - -if GetDepend('RT_USING_DFS_RAMFS'): - src_local = src_local + ramfs - path = path + [RTT_ROOT + '/components/dfs/filesystems/ramfs'] - -if GetDepend('RT_USING_DFS_DEVFS'): - src_local = src_local + devfs - path = path + [RTT_ROOT + '/components/dfs/filesystems/devfs'] - -if GetDepend('RT_USING_DFS_UFFS'): - src_local = src_local + uffs - path = path + [RTT_ROOT + '/components/dfs/filesystems/uffs/src/inc', \ - RTT_ROOT + '/components/dfs/filesystems/uffs'] #, \ - # RTT_ROOT + '/components/dfs/filesystems/uffs/flash'] - -if GetDepend('RT_USING_DFS_JFFS2'): - src_local = src_local + jffs2 - path = path + [RTT_ROOT + '/components/dfs/filesystems/jffs2/src', \ - RTT_ROOT + '/components/dfs/filesystems/jffs2/kernel', \ - RTT_ROOT + '/components/dfs/filesystems/jffs2/include', \ - RTT_ROOT + '/components/dfs/filesystems/jffs2', \ - RTT_ROOT + '/components/dfs/filesystems/jffs2/cyg/compress'] - -group = DefineGroup('Filesystem', src_local, depend = ['RT_USING_DFS'], CPPPATH = path, CPPDEFINES = CPPDEFINES) +src = Glob('src/*.c') +cwd = GetCurrentDir() +CPPPATH = [cwd + "/include"] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS'], CPPPATH = CPPPATH) + +if GetDepend('RT_USING_DFS'): + # search in the file system implementation + list = os.listdir(cwd) + + for item in list: + if os.path.isfile(os.path.join(cwd, item, 'SConscript')): + group = group + SConscript(os.path.join(item, 'SConscript')) Return('group') diff --git a/components/dfs/filesystems/SConscript b/components/dfs/filesystems/SConscript new file mode 100644 index 0000000000..4c815c49b8 --- /dev/null +++ b/components/dfs/filesystems/SConscript @@ -0,0 +1,15 @@ +# RT-Thread building script for bridge + +import os +from building import * + +cwd = GetCurrentDir() +objs = [] +list = os.listdir(cwd) + +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + objs = objs + SConscript(os.path.join(d, 'SConscript')) + +Return('objs') diff --git a/components/dfs/filesystems/devfs/SConscript b/components/dfs/filesystems/devfs/SConscript new file mode 100644 index 0000000000..898b04a234 --- /dev/null +++ b/components/dfs/filesystems/devfs/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_DEVFS'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/filesystems/elmfat/SConscript b/components/dfs/filesystems/elmfat/SConscript new file mode 100644 index 0000000000..8b7ec02d43 --- /dev/null +++ b/components/dfs/filesystems/elmfat/SConscript @@ -0,0 +1,26 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +if GetDepend('RT_DFS_ELM_USE_LFN'): + if GetDepend('RT_DFS_ELM_CODE_PAGE_FILE'): + src += ['option/ccfile.c'] + else: + if GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 932: + src += ['option/cc932.c'] + elif GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 936: + src += ['option/cc936.c'] + elif GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 949: + src += ['option/cc949.c'] + elif GetConfigValue('RT_DFS_ELM_CODE_PAGE') == 950: + src += ['option/cc950.c'] + else: + src += ['option/ccsbcs.c'] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_ELMFAT'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/filesystems/jffs2/SConscript b/components/dfs/filesystems/jffs2/SConscript new file mode 100644 index 0000000000..47854393e3 --- /dev/null +++ b/components/dfs/filesystems/jffs2/SConscript @@ -0,0 +1,50 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Split(''' +dfs_jffs2.c +porting.c + +cyg/compress/src/adler32.c +cyg/compress/src/compress.c +cyg/compress/src/deflate.c +cyg/compress/src/infback.c +cyg/compress/src/inffast.c +cyg/compress/src/inflate.c +cyg/compress/src/inftrees.c +cyg/compress/src/trees.c +cyg/compress/src/uncompr.c +cyg/compress/src/zutil.c + +cyg/crc/crc16.c +cyg/crc/crc32.c +cyg/crc/posix_crc.c +kernel/rbtree.c +src/build.c +src/compr.c +src/compr_rtime.c +src/compr_rubin.c +src/compr_zlib.c +src/debug.c +src/dir-ecos.c +src/erase.c +src/flashio.c +src/fs-ecos.c +src/gc.c +src/gcthread.c +src/malloc-ecos.c +src/nodelist.c +src/nodemgmt.c +src/read.c +src/readinode.c +src/scan.c +src/write.c +''') + +CPPPATH = [cwd, cwd + '/include', cwd + '/src', cwd + '/cyg', cwd + '/kernel', cwd + '/cyg/compress'] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_JFFS2'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/filesystems/nfs/SConscript b/components/dfs/filesystems/nfs/SConscript new file mode 100644 index 0000000000..3a5a665b30 --- /dev/null +++ b/components/dfs/filesystems/nfs/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_NFS'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/filesystems/ramfs/SConscript b/components/dfs/filesystems/ramfs/SConscript index 637ee2d9bc..1304f59629 100644 --- a/components/dfs/filesystems/ramfs/SConscript +++ b/components/dfs/filesystems/ramfs/SConscript @@ -4,6 +4,6 @@ cwd = GetCurrentDir() src = Glob('*.c') CPPPATH = [cwd] -group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_MEMHEAP'], CPPPATH = CPPPATH) +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_MEMHEAP', 'RT_USING_DFS_RAMFS'], CPPPATH = CPPPATH) Return('group') diff --git a/components/dfs/filesystems/romfs/SConscript b/components/dfs/filesystems/romfs/SConscript new file mode 100644 index 0000000000..bfd633ce91 --- /dev/null +++ b/components/dfs/filesystems/romfs/SConscript @@ -0,0 +1,15 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +if GetDepend('DFS_ROMFS_ROOT'): + # A new ROMFS root has been defined, we should remove the romfs.c + SrcRemove(src, ['romfs.c']) + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS','RT_USING_DFS_ROMFS'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/dfs/filesystems/uffs/SConscript b/components/dfs/filesystems/uffs/SConscript new file mode 100644 index 0000000000..f822cf5d73 --- /dev/null +++ b/components/dfs/filesystems/uffs/SConscript @@ -0,0 +1,11 @@ +# RT-Thread building script for component + +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd, cwd + '/src/inc'] + +group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_UFFS'], CPPPATH = CPPPATH) + +Return('group') diff --git a/include/rtcomponents.h b/include/rtcomponents.h deleted file mode 100644 index 70accb99d1..0000000000 --- a/include/rtcomponents.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * File : rtcomponents.h - * header for RT-Thread components - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2012-2015, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2012-09-20 Bernard Change the name to components.h - * And all components related header files. - * 2015-02-06 Bernard Rename the components.h to rtcom.h - */ - -#ifndef RTCOM_H__ -#define RTCOM_H__ - -#ifdef RT_USING_FINSH -#include -#include -#endif - -#ifdef RT_USING_LWIP -#include -#include -#endif - -#ifdef RT_USING_DFS -#include -#include -#ifdef RT_USING_DFS_ELMFAT -#include -#endif -#if defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS) -#include -#endif -#ifdef RT_USING_DFS_ROMFS -#include -#endif -#ifdef RT_USING_DFS_DEVFS -#include -#endif -#ifdef RT_USING_DFS_UFFS -#include -#endif -#ifdef RT_USING_DFS_JFFS2 -#include -#endif -#ifdef RT_USING_DFS_YAFFS2 -#include -#endif -#ifdef RT_USING_DFS_ROMFS -#include -#endif -#endif - -#ifdef RT_USING_PTHREADS -#include -#endif - -#ifdef RT_USING_MODULE -#include -#endif - -#endif - -- GitLab