summaryrefslogtreecommitdiff
path: root/tools/building.py
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-06-19 17:57:22 +0800
committerGrissiom <[email protected]>2013-06-19 18:02:03 +0800
commit3ee4a1850635f7d36bbbc78eecbf15364ecb14e6 (patch)
tree91232da4c7ef4aa5ca4dae435e33b1290dc7114f /tools/building.py
parentce176ee1d6ff3bc0902335601af8b1a17cdac3ff (diff)
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.
Diffstat (limited to 'tools/building.py')
-rw-r--r--tools/building.py9
1 files changed, 9 insertions, 0 deletions
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: