eccodes/definitions/make_makefile_am.pl

82 lines
1.1 KiB
Perl
Raw Permalink Normal View History

2013-03-25 12:04:10 +00:00
#!/usr/bin/perl
use strict;
my @sub;
push @sub , ".";
navigate(".");
foreach my $d ( sort @sub )
{
process($d);
2013-03-25 12:04:10 +00:00
}
2014-06-18 16:14:01 +00:00
print "EXTRA_DIST=CMakeLists.txt\n\n";
2013-03-25 12:04:10 +00:00
print "include \$(DEVEL_RULES)\n";
sub navigate {
my ($dir) = @_;
opendir(DIR,$dir);
foreach my $d ( readdir(DIR) )
{
next if($d =~ /^\./);
if(-d "$dir/$d")
{
push @sub , "$dir/$d";
navigate("$dir/$d");
}
}
closedir(DIR);
}
sub process {
my ($dir) = @_;
my @files;
opendir(DIR,$dir);
foreach my $d ( readdir(DIR) )
{
next if($d =~ /^\./);
unless (-d $d) {
push @files, $d if($d =~ /\.(txt|list|table|def|grib|sh)$/);
2013-03-25 12:04:10 +00:00
}
}
closedir(DIR);
if(@files)
{
my $name;
if($dir eq ".")
{
$name = "";
print "#This file is generated by make_makefile_am.pl\n";
print "# DON'T EDIT!!!\n";
print "definitionsdir = \@ECCODES_DEFINITION_PATH\@\n";
2013-03-25 12:04:10 +00:00
}
else
{
$dir =~ s/^\.\///;
$name = "$dir";
$name =~ s/\W/_/g;
print "definitions${name}dir = \@ECCODES_DEFINITION_PATH\@/$dir\n";
2013-03-25 12:04:10 +00:00
}
print "dist_definitions${name}_DATA = ";
foreach my $f ( sort @files )
{
print "\\\n\t$dir/$f";
}
print "\n";
print "\n";
}
}