File: make_makefile_am.pl

package info (click to toggle)
eccodes 2.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 480,184 kB
  • sloc: ansic: 163,815; makefile: 21,266; sh: 8,507; python: 6,026; f90: 5,762; perl: 2,891; yacc: 818; lex: 356; cpp: 305; fortran: 116; awk: 66
file content (81 lines) | stat: -rwxr-xr-x 1,159 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/perl
use strict;

my @sub;
push @sub , ".";
navigate(".");
foreach my $d ( sort @sub )
{
  process($d);
}
print "EXTRA_DIST=CMakeLists.txt\n\n";
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)$/);
		}

	}
	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";
		}
		else
		{
			$dir  =~ s/^\.\///;
			$name = "$dir";
			$name =~ s/\W/_/g;
			print "definitions${name}dir = \@ECCODES_DEFINITION_PATH\@/$dir\n";
		}


		print "dist_definitions${name}_DATA = ";

		foreach my $f ( sort @files )
		{
			print "\\\n\t$dir/$f";
		}

		print "\n";
		print "\n";

	}


}