2014年6月17日 星期二

script to generate cscope and ctags files

因為工作需要,所以寫了一個簡單的shell script來幫忙產生新的ctags以及cscope檔案



# put this script to the top directory of source code
CSCOPE_PATH=`pwd`
CTAGS_PATH=`pwd`
# remove cscope files
echo "remove cscpoe.out"
if [ -f $CSCOPE_PATH/cscope.out ]; then
    rm cscope.out
fi
echo "remove cscpoe.in.out"
if [ -f $CSCOPE_PATH/cscope.in.out ]; then
    rm cscope.in.out
fi
echo "remove cscpoe.po.out"
if [ -f $CSCOPE_PATH/cscope.po.out ]; then
    rm cscope.po.out
fi
# remove ctags files
echo "remove tags"
if [ -f $CTAGS_PATH/tags ]; then
    rm tags
fi
# recreate cscpoe files
cscope -Rbkq
ctags -R
# use the following script instead of 'cscpoe -Rbkq' to add .cc into cscope
#find . -name "*.h" -o -name "*.c"-o -name "*.cc" > cscope.files
#cscope -bkq -i cscope.files

其實用for loop來寫比較簡潔,不過這樣寫比較容易懂,所以算了 XD

另外好像應該找一個可以模擬script的css來用比較好讀

沒有留言:

張貼留言