From 3ee4a1850635f7d36bbbc78eecbf15364ecb14e6 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Wed, 19 Jun 2013 17:57:22 +0800 Subject: tools: add an option to generate cscope database When --cscope option is given to Scons, it will generate a cscope cross-reference database in current directory, which is useful in Vim(and other cscope-aware text editors). For example, `scons -s --cscope` will do nothing except generating the database. You can use this option with other options together. It is inspired by the `make cscope` of Linux. --- tools/building.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools/building.py') diff --git a/tools/building.py b/tools/building.py index a90ad69c1d..6b752674b5 100644 --- a/tools/building.py +++ b/tools/building.py @@ -83,6 +83,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ action='store_true', default=False, help='copy header of rt-thread directory to local.') + AddOption('--cscope', + dest='cscope', + action='store_true', + default=False, + help='Build Cscope cross reference database. Requires cscope installed.') # add build library option AddOption('--buildlib', @@ -341,6 +346,10 @@ def EndBuilding(target, program = None): if GetOption('copy-header') and program != None: MakeCopyHeader(program) + if GetOption('cscope'): + from cscope import CscopeDatabase + CscopeDatabase(Projects) + def SrcRemove(src, remove): if type(src[0]) == type('str'): for item in src: -- cgit v1.3.1