您的位置:首页 > 运维架构

公布生成cscope.out, cscope.files, tags的脚本文件

2012-05-11 13:38 387 查看
通过VIM搭建一个IDE,网上的文章有很多,这里就不献丑了。

下面记录下生成tags,cscope.out, cscope.files的脚本文件

一、windows版本(.bat)

del cscope.out cscope.files tags
echo del "cscope.out cscope.files tags" successful!

echo "ctags create"
ctags --languages=c --langmap=c:+.h --extra=+q -R

echo "cscope create"
dir /s /b *.c *.h > cscope.files
cscope -bCkR -i cscope.files


注意:

1. 执行上面的脚本前,请确保正确安装了ctags.exe和cscope.exe,并配置到了环境变量PATH下。

2. windows下生成的cscope.files中的路径是绝对路径

针对lvr的生成脚本:

@echo off

goto start

1. 获取当前路径
2. 得到cscope.files的全路径
3. 删除原来生成的文件
4. 将lib的源文件加入cscope.files
5. 将lvr的源文件加入cscope.files
6. 利用cscope建立索引数据库

:start

set curpath=%cd%
set csfile=%curpath%\cscope.files

del tags cscope.out cscope.files
ctags --languages=c --langmap=c:+.h --extra=+q -R

set libpath=%curpath%\..\..\lib_new_gui
cd %libpath%\trunk\platform_x2
dir /s /b *.c *.h > %csfile%

cd %curpath%
dir /s /b *.c *.h >> %csfile%

cscope -bCkR -i %csfile% -I%libpath%


-----------------------------------------------------------------------------------------------------------------------------


二、Linux版本(.sh)

#!/bin/bash
echo "delete cscope.files, cscope.out, tags"
rm -f cscope.files cscope.out tags

echo "create cscope.files"
find . -name '*.h' -o -name '*.c' > cscope.files

echo "cscope add cscope.files"
cscope -bCkR -i cscope.files

echo "create tags"
ctags --languages=c --langmap=c:+.h --extra=+q -R


注意:

linux下生成的cscope.files中的路径是相对路径,由find后的路径决定,所以一般在vim的配置中不使用"set autochdir"!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  脚本 tags windows path vim ide