LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 693|回复: 1

请问谁能提供一个提取内核Makefile文件的脚本?

[复制链接]
发表于 2005-12-9 22:30:08 | 显示全部楼层 |阅读模式
最近在看内核的Makefile,想单独提出来研究。
比如内核中有a/b/c/Makefile、e/f/Makefile,运行脚本后(假设名称为getmakefile),比如getmakefile mydir,则会在mydir目录下依次a/b/c、e/f目录,然后将相应目录的Makefile复制进来。
我的脚本水平实在很次,谁能帮我?谢谢!
 楼主| 发表于 2005-12-10 13:21:55 | 显示全部楼层
呵呵,发现mkdir -p的功能后,挺简单的

#!/bin/sh

if [ $# != 3 ]
then
echo "To get the file for the source directory, stores them in the destination directory."
echo "Keeping the structure of directory"
echo "Usage: $0 src_dir dest_dir file_name"
exit
fi

mkdir -p $2
cd $1
for i in $(find -name $3)
do
        echo $i
        mkdir -p $2/`dirname $i`
        cp $i $2/$i
done
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表