之前写过一篇使用 使用scsh编写脚本收集编译的代码(http://blog.csdn.net/joans123/article/details/7475046), 之所以再写这边文章是因为scsh不常见,以及之前那种方法的扩张性不行. 由于代码编译有Makefile管理的,所以用Makefile来搜集所编译的代码是相当方便及容易扩张的.
下面的collect-src脚本先生成一个Makefile,然后通过运行makefile来搜集编译过的源文件列表并保存到一个文件,最后通过cscope生成代码索引数据库. 具体使用步骤:
1. 编译内核代码(或者是busybox,uboot等): make uImage
2. 运行脚本: ./collect-src -f (-f 选项的作用是生成列表文件为绝对路径,source insight识别使用)
3. 用source insight导入源文件列表( src.list )
#!/bin/sh
###############################################################################
# File : collect-src
# Description: script to find all the compiled source file and header file
#
# You must first compile the source and generate *.o files.
#
# For kernel and busybox , the *.o.cmd file will be generated to find the header file.
# For u-boot, the .depend file will be generated to find the header file.
# Others, please concate with me for support!
#
###############################################################################
#
# Usage:
#
# collect-src [-i list_file ]
#
#