Aim
We would like to use cscope and gtags to create tags for c++ development.
prepareSpacemacsTags.sh
#!/bin/bash buildPath="$PWD" # remove old tags rm ${buildPath}/GPATH rm ${buildPath}/GRTAGS rm ${buildPath}/GTAGS rm ${buildPath}/cscope.files rm ${buildPath}/cscope.out rm ${buildPath}/cscope.in.out rm ${buildPath}/cscope.po.out # make tags echo "######### make GTag" gtags echo "######### make cscope" find . -name "*.cc" -o -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" > cscope.files cscope -q -R -b -k -i cscope.files
Usage
$ cd /path/to/project/root $ prepareSpacemacsTags.sh
prepareTags.YourProject.sh
#!/bin/bash basePath=`pwd` tempTagPath="$basePath/../tempTagFolder" appFolders=("APPFolderName") # filter out # move all folders beyond root if [ ! -d "$tempTagPath" ]; then mkdir "$tempTagPath" fi if [ ! -d "$tempTagPath/app" ]; then mkdir "$tempTagPath/app" fi for folder in ${appFolders[@]}; do nextFolder="$basePath/app/$folder" mv $nextFolder $tempTagPath/app done prepareSpacemacsTags.sh mv $tempTagPath/app/* ./app if [ -d "$tempTagPath/app" ] && [ -z "$(ls -A $tempTagPath/app/)" ]; then rm -rf $tempTagPath/app else echo "No need to have further action $tempTagPath/app" fi if [ -d "$tempTagPath" ] && [ -z "$(ls -A $tempTagPath)" ]; then rm -rf $tempTagPath else echo "No need to have further action $tempTagPath" fi
Usage
$ cd /path/to/project/root $ ls ./app ./lib $ prepareTags.YourProject.sh
沒有留言:
發佈留言