Perl批量编译GCC源代码

2015-12-14 0 789
Perl批量编译GCC源代码
#!/usr/bin/perl
#use Cwd;
sub CompileAll(){
	local($dir) = @_;
	opendir(DIR,"$dir"|| die "can't open $dir");
	local @files =readdir(DIR);
	closedir(DIR);
	for $file (@files){
		next if($file=~m/\.$/ || $file =~m/\.\.$/);
		if ($file =~/\.(c|cpp)$/i){
			$file2=$file;
			$file =~ s/(.*)\.(.*)/$1/;
			system "gcc \"$dir\/$file2\" -o \"$dir\/$file\"";
		}
		elsif(-d "$dir/$file"){
			CompileAll("$dir/$file" );
		}
	}
}
&CompileAll(getcwd);

遇见资源网 perl Perl批量编译GCC源代码 http://www.ox520.com/13178.html

上一篇:

已经没有上一篇了!

下一篇:

已经没有下一篇了!

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务