1#!/usr/local/bin/perl
2#
3# This is a hacked version of files.pl for systems that can't do a 'make files'.
4# Do a perl util/mkminfo.pl >MINFO to build MINFO
5# Written by Steve Henson 1999.
6
7# List of directories to process
8
9my @dirs = (
10".",
11"crypto",
12"crypto/md2",
13"crypto/md4",
14"crypto/md5",
15"crypto/sha",
16"crypto/mdc2",
17"crypto/hmac",
18"crypto/cmac",
19"crypto/ripemd",
20"crypto/des",
21"crypto/rc2",
22"crypto/rc4",
23"crypto/rc5",
24"crypto/idea",
25"crypto/bf",
26"crypto/cast",
27"crypto/aes",
28"crypto/camellia",
29"crypto/seed",
30"crypto/modes",
31"crypto/bn",
32"crypto/rsa",
33"crypto/dsa",
34"crypto/dso",
35"crypto/dh",
36"crypto/ec",
37"crypto/ecdh",
38"crypto/ecdsa",
39"crypto/buffer",
40"crypto/bio",
41"crypto/stack",
42"crypto/lhash",
43"crypto/rand",
44"crypto/err",
45"crypto/objects",
46"crypto/evp",
47"crypto/asn1",
48"crypto/pem",
49"crypto/x509",
50"crypto/x509v3",
51"crypto/cms",
52"crypto/conf",
53"crypto/jpake",
54"crypto/txt_db",
55"crypto/pkcs7",
56"crypto/pkcs12",
57"crypto/comp",
58"crypto/engine",
59"crypto/ocsp",
60"crypto/ui",
61"crypto/krb5",
62#"crypto/store",
63"crypto/pqueue",
64"crypto/whrlpool",
65"crypto/ts",
66"crypto/srp",
67"ssl",
68"apps",
69"engines",
70"engines/ccgost",
71"test",
72"tools"
73);
74
75%top;
76
77foreach (@dirs) {
78	&files_dir ($_, "Makefile");
79}
80
81exit(0);
82
83sub files_dir
84{
85my ($dir, $makefile) = @_;
86
87my %sym;
88
89open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
90
91my $s="";
92
93while (<IN>)
94	{
95	chop;
96	s/#.*//;
97	if (/^(\S+)\s*=\s*(.*)$/)
98		{
99		$o="";
100		($s,$b)=($1,$2);
101		for (;;)
102			{
103			if ($b =~ /\\$/)
104				{
105				chop($b);
106				$o.=$b." ";
107				$b=<IN>;
108				chop($b);
109				}
110			else
111				{
112				$o.=$b." ";
113				last;
114				}
115			}
116		$o =~ s/^\s+//;
117		$o =~ s/\s+$//;
118		$o =~ s/\s+/ /g;
119
120		$o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
121		$sym{$s}=($top{$s} or $o);
122		}
123	}
124
125print "RELATIVE_DIRECTORY=$dir\n";
126
127foreach (sort keys %sym)
128	{
129	print "$_=$sym{$_}\n";
130	}
131if ($dir eq "." && defined($sym{"BUILDENV"}))
132	{
133	foreach (split(' ',$sym{"BUILDENV"}))
134		{
135		/^(.+)=/;
136		$top{$1}=$sym{$1};
137		}
138	}
139
140print "RELATIVE_DIRECTORY=\n";
141
142close (IN);
143}
144