create file list in android platform

来源:互联网 发布:翟欣欣大学男友 知乎 编辑:程序博客网 时间:2024/05/22 03:05

#/bin/bash
#
#su xinmin  2013/2/5
#
# create kernel , android c c++ , android java file list.
#

_PWD=`pwd`

if [ ${_PWD##*/} != 'android' ]
then
   echo "this shell should be in android directory."
   exit 1;
fi

#make kernel file list.
cd kernel

_DIR=`find -maxdepth 2 -name Documentation`

cd ${_DIR%Documentation}

if [ ! -f collect-src.sh ]
then
    cp ~/script/collect-src.sh .
fi

./collect-src.sh

if [ ! -f src.list ]
then
   echo "src.list is not exist"
   exit 1;
fi

_KPWD=`pwd`

KPREFIX="\/\/109.105.1.93\/bstdev93"${_KPWD#/home}"\/"
APREFIX="\/\/109.105.1.93\/bstdev93"${_PWD#/home}"\/"

sed -e "s#^#$KPREFIX#g" src.list | sed -e 's#\/#\\#g' > src1.list

mv src1.list kf.list
rm -rf src*.list

##mk file list
cd $_PWD

find -name *.mk >> mk.list
find -name *.mak >> mk.list
find -name Makefile* >> mk.list
find -name makefile* >> mk.list
find -name *makefile >> mk.list
find -name Kconfig* >> mk.list
find -name *config >> mk.list

sed -e "s#^#$APREFIX#g" -e 's#\.\/##g' -e 's#\/#\\#g' mk.list > mk1.list
mv mk1.list mk.list
rm -rf mk1.list

##android c c++ file list
for f in `find -name *.P`;
    do sed -e '/\.o:/d' $f | sed -e "s#$PWD#\.#g" >> file.list ;
done

sed -e 's#:##g' -e 's#\\##g' -e 's#^ *##g' -e 's# *$##g' file.list | sort | uniq > file1.list
sed -e 's# #\n#g' -e '/^[ \t]*$/d' file1.list | sort | uniq > file2.list
sed -e "s#^#$APREFIX#g" -e 's#\/#\\#g' file2.list > file3.list

mv file3.list cf.list
rm -rf file*.list

##android java file list
find -name *.java > java.list
sed -e "s#^#$APREFIX#g" -e 's#\.\/##g' -e 's#\/#\\#g' java.list > java1.list

mv java1.list jf.list
rm -rf java*.list
 

原创粉丝点击