summaryrefslogtreecommitdiff
path: root/util/cscope-find.py
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-09-08 19:22:25 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2006-09-08 19:22:25 -0400
commit9e6d12b0959544e0fad8f84644f2c6471a5ef272 (patch)
tree9b067acbcc35115a758f3a7a51195945bd15efba /util/cscope-find.py
parenta7e8a789585193903e5fd9d07d320f5ea89b927b (diff)
downloadgem5-9e6d12b0959544e0fad8f84644f2c6471a5ef272.tar.xz
Added cscope-find.py utility to generate file list for cscope.
--HG-- extra : convert_revision : 80f2db90f1c2406039d0447b84aa0442b7b974f8
Diffstat (limited to 'util/cscope-find.py')
-rwxr-xr-xutil/cscope-find.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/util/cscope-find.py b/util/cscope-find.py
new file mode 100755
index 000000000..1775f1864
--- /dev/null
+++ b/util/cscope-find.py
@@ -0,0 +1,38 @@
+#! /usr/bin/python
+
+# Generate list of files to index with cscope.
+
+# From the m5 directory, run:
+# util/cscope-find.py > cscope.files
+# cscope -b
+
+import os
+
+# absolute paths to skip
+skipdirs = [ 'src/unittest', 'src/doxygen' ]
+
+# suffixes of files to index
+suffixes = [ '.cc', '.hh', '.c', '.h' ]
+
+def oksuffix(f):
+ for s in suffixes:
+ if f.endswith(s):
+ return True
+ return False
+
+for dirpath,subdirs,files in os.walk('src'):
+ # filter out undesirable subdirectories
+ for i,dir in enumerate(subdirs):
+ if dir == 'SCCS':
+ del subdirs[i]
+ break
+
+ # filter out undesriable absolute paths
+ if dirpath in skipdirs:
+ del subdirs[:]
+ continue
+
+ # find C/C++ sources
+ okfiles = [f for f in files if oksuffix(f)]
+ if okfiles:
+ print '\n'.join([os.path.join(dirpath, f) for f in okfiles])