选出参加工程编译的所有文件
2012-11-03 17:18
162 查看
1、找出所有参加编译的c文件、汇编文件
在内核源代码的目录下创建compiler目录,找到的c文件保存在cfile.txt,汇编文件分别为big_s-file.txt和little_s-file.txt
尖括号<>包含的文件保存在abs-header.txt、引号""包含的文件在rel-header.txt
2、找出所有被引号包含的文件
#!/bin/bash
#
# find the header files which are contained by relative path
#
#
#
#
header=`cat $1`
echo > total_rel_header.txt
for i in $header; do
sed -n '/^#/p' $i | grep include > cache
incl=`sed 's/ /@/g' cache`
for j in $incl; do
tmp=`dirname $i`
echo $j | grep "\"" 1>/dev/null && \
tmp=$tmp/`echo $j | cut -d"\"" -f2 ` && \
echo $tmp && \
echo $tmp >> total_rel_header.txt
tmp=
done
done
cat total_rel_header.txt | sort -u > cache
mv cache compiler/total_rel_header.txt
3、找出所有被尖括号包含的文件
#!/bin/bash
#
# find the total header files which locate in system include-paths
#
#
#
ARCH=arm
echo > total_abs_header.txt
sed 's/ /@/g' $1 > cache.1
sed 's/\t/@/g' cache.1 > cache.2
sed 's/</"/g' cache.2 > cache.3
sed 's/>/"/g' cache.3 > cache.4
mv cache.4 cache
rm -f cache.1 cache.2 cache.3 cache.4
header=`cat cache`
for i in $header; do
#echo $i
tmp=`echo $i | cut -d"\"" -f2`
if [ -f arch/$ARCH/include/$tmp ]
then
echo "arch/$ARCH/include/$tmp" >> total_abs_header.txt
else
if [ -f include/$tmp ]
then
echo "include/$tmp" >> total_abs_header.txt
else
echo "cannot find $tmp"
fi
fi
done
cat total_abs_header.txt | sort -u > cache
mv cache compiler/total_abs_header.txt
在内核源代码目录下依次运行以上三个脚本,就会在compiler目录下生产total_rel_header.txt,total_abs_header.txt和total-file.txt分别保存找到的包含文件和源文件
在内核源代码的目录下创建compiler目录,找到的c文件保存在cfile.txt,汇编文件分别为big_s-file.txt和little_s-file.txt
尖括号<>包含的文件保存在abs-header.txt、引号""包含的文件在rel-header.txt
#!/bin/bash # # find total .c files. .S files. .s files which will be compiled into image # # # echo "=============create store result files==========" rm -rf compiler mkdir -p compiler echo > cfile.txt; #find the .c files echo "=============finding .c files...==========" find -name *.c > tmp.txt files=`cat tmp.txt` for i in $files; do temp=${i/.c/.o}; # echo $temp; if [ -f $temp ]; then echo $i >> cfile.txt; fi done cfiles_counts=`cat cfile.txt | wc -l` echo "The total c files counts is $cfiles_counts" #find the .s files echo "=============finding .s files...==========" echo > little_s-file.txt find -name *.s > tmp.txt files=`cat tmp.txt` for i in $files; do temp=${i/.s/.o}; # echo $temp; if [ -f $temp ]; then echo $i >> little_s-file.txt; fi done sfiles_counts=`cat little_s-file.txt | wc -l` echo "The total s files counts is $sfiles_counts" #find the .S files echo "=============finding .S files...==========" echo > big_s-file.txt find -name *.S > tmp.txt files=`cat tmp.txt` for i in $files; do temp=${i/.S/.o}; # echo $temp; if [ -f $temp ]; then echo $i >> big_s-file.txt; fi done Sfiles_counts=`cat big_s-file.txt | wc -l` echo "The total S files counts is $Sfiles_counts" echo > total-file.txt cat cfile.txt >> total-file.txt cat little_s-file.txt >> total-file.txt cat big_s-file.txt >> total-file.txt echo "The total files are `expr $cfiles_counts + $sfiles_counts + $Sfiles_counts`" echo '=======================================' echo '| |' echo '|======find header files==============|' echo '| |' echo '=======================================' headers=`cat total-file.txt` echo > total-header.txt for i in $headers; do sed -n '/^#/p' $i | grep include >> total-header.txt done mv cfile.txt compiler mv little_s-file.txt compiler mv big_s-file.txt compiler mv total-file.txt compiler mv total-header.txt compiler cd compiler cp total-header.txt temp.txt sed -i '/"/d' temp.txt cat temp.txt | sort -u > cache mv cache abs-header.txt rm -f cache temp.txt cp total-header.txt temp.txt sed -i '/</d' temp.txt mv temp.txt rel-header.txt rm -f temp.txt #sed -n '/^#/p' tmpfile.txt > temp.cache #sed 's/ /@/g' temp.cache > tmpfile.txt #sed 's/</"/g' tmpfile.txt > temp.cache #sed 's/>/"/g' temp.cache > tmpfile.txt #echo > temp.cache #headers=`cat tmpfile.txt` #for i in $headers; do # echo $i | cut -d"\"" -f2 >>temp.cache #done #mv temp.cache headers.file #cat headers.file | sort -u > temp.cache #mv temp.cache headers.file #rm -f temp.cache
2、找出所有被引号包含的文件
#!/bin/bash
#
# find the header files which are contained by relative path
#
#
#
#
header=`cat $1`
echo > total_rel_header.txt
for i in $header; do
sed -n '/^#/p' $i | grep include > cache
incl=`sed 's/ /@/g' cache`
for j in $incl; do
tmp=`dirname $i`
echo $j | grep "\"" 1>/dev/null && \
tmp=$tmp/`echo $j | cut -d"\"" -f2 ` && \
echo $tmp && \
echo $tmp >> total_rel_header.txt
tmp=
done
done
cat total_rel_header.txt | sort -u > cache
mv cache compiler/total_rel_header.txt
3、找出所有被尖括号包含的文件
#!/bin/bash
#
# find the total header files which locate in system include-paths
#
#
#
ARCH=arm
echo > total_abs_header.txt
sed 's/ /@/g' $1 > cache.1
sed 's/\t/@/g' cache.1 > cache.2
sed 's/</"/g' cache.2 > cache.3
sed 's/>/"/g' cache.3 > cache.4
mv cache.4 cache
rm -f cache.1 cache.2 cache.3 cache.4
header=`cat cache`
for i in $header; do
#echo $i
tmp=`echo $i | cut -d"\"" -f2`
if [ -f arch/$ARCH/include/$tmp ]
then
echo "arch/$ARCH/include/$tmp" >> total_abs_header.txt
else
if [ -f include/$tmp ]
then
echo "include/$tmp" >> total_abs_header.txt
else
echo "cannot find $tmp"
fi
fi
done
cat total_abs_header.txt | sort -u > cache
mv cache compiler/total_abs_header.txt
在内核源代码目录下依次运行以上三个脚本,就会在compiler目录下生产total_rel_header.txt,total_abs_header.txt和total-file.txt分别保存找到的包含文件和源文件
相关文章推荐
- KE Keil工程每次编译都编译所有文件
- 用NMAKE创建VS2012 C++工程三 自动编译所有的cpp文件
- 删除工程下的所有.SVN文件
- 自己编译 tess-two几个库文件用于android OCR开发并合入你的工程项目
- 多文件目录下makefile文件递归执行编译所有c文件
- Makefile方法编译Linux下多文件工程
- vs2010修改一个文件,所有文件全部重新编译的解决方法
- 微信小程序反编译 文件逆向工程思路小记
- 用xcode打开工程,所有的工程源代码文件都不显示
- Android解析编译之后的所有文件(so,dex,xml,arsc)格式
- ant 编译java工程并导出jar文件
- linux交叉编译工程中,单独编译某个文件的方法
- VC 工程中包含 .c 或cpp文件编译时产生的.pch预编译头错误(C1853)
- 编译QT时的工程文件pro
- 解决android-ndk-r8c 总是编译所有文件问题
- 最近研究Android,发现对于外部导入的工程,编译的时候不能够正常生成R.java文件的解决办法
- VS2008 工程中部分文件不参与编译 从生成中排除【Worldsing笔记】
- iOS统计工程里所有大于2000行代码的文件
- vc++工程中添加lua代码调用-编译lua静态库文件
- 在VDSP中编译uClinux:工程文件发布