Tagsgen script rewritten in python

This commit is contained in:
Amit Mahajan
2009-11-26 23:45:25 +05:30
parent 0707376a54
commit efdd81330a
2 changed files with 54 additions and 22 deletions

View File

@@ -1,22 +0,0 @@
rm -f cscope.*
rm -f tags
# Put all sources into a file list.
find ./src -name '*.cc' > tagfilelist
find ./src -name '*.c' >> tagfilelist
find ./src -name '*.h' >> tagfilelist
find ./src -name '*.s' >> tagfilelist
find ./src -name '*.S' >> tagfilelist
find ./src -name '*.lds' >> tagfilelist
find ./include -name '*.h' >> tagfilelist
find ./include -name '*.s' >> tagfilelist
find ./include -name '*.S' >> tagfilelist
find ./include -name '*.lds' >> tagfilelist
# Use file list to include in tags.
ctags --languages=C,Asm --recurse -Ltagfilelist
cscope -q -k -R -i tagfilelist
# Remove file list.
rm -f tagfilelist

54
tools/tagsgen/tagsgen_kernel.py Executable file
View File

@@ -0,0 +1,54 @@
#! /usr/bin/env python2.6
# -*- mode: python; coding: utf-8; -*-
import os, sys
PROJRELROOT = '../../'
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), PROJRELROOT)))
from config.configuration import *
config = configuration_retrieve()
platform = config.platform
subarch = config.subarch
arch = config.arch
def main():
os.system("rm -f cscope.*")
os.system("rm -f tags")
# Type of files to be included
file_extn = ['*.cc', '*.c', '*.h', '*.s', '*.S', '*.lds']
# Kernel directories
src_dir_path = 'src'
include_dir_path = 'include/l4'
search_folder = \
['api', 'arch/'+ arch, 'arch/'+ arch + '/' + subarch, 'drivers', \
'generic', 'glue/' + arch, 'lib', 'platform/' + platform]
# Put all sources into a file list.
for extn in file_extn:
for dir in search_folder:
# Directory depth to be searched
if dir == 'drivers':
depth = 5
else:
depth = 1
os.system("find " + join(src_dir_path, dir) + \
" -maxdepth " + str(depth) + " -name '" + extn + "' >> tagfilelist")
os.system("find " + join(include_dir_path, dir) + \
" -maxdepth " + str(depth) + " -name '" + extn + "' >> tagfilelist")
# Use file list to include in tags.
os.system("ctags --languages=C,Asm --recurse -Ltagfilelist")
os.system("cscope -q -k -R -i tagfilelist")
# Remove file list.
os.system("rm -f tagfilelist")
if __name__ == "__main__":
main()