Harmonize do_rehash_rule with updated test/recipies/25-test_verify.t.
[openssl.git] / util / mkfiles.pl
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
9 my @dirs = (
10 ".",
11 "crypto",
12 "crypto/md2",
13 "crypto/md4",
14 "crypto/md5",
15 "crypto/sha",
16 "crypto/mdc2",
17 "crypto/hmac",
18 "crypto/ripemd",
19 "crypto/des",
20 "crypto/rc2",
21 "crypto/rc4",
22 "crypto/rc5",
23 "crypto/idea",
24 "crypto/bf",
25 "crypto/cast",
26 "crypto/aes",
27 "crypto/camellia",
28 "crypto/seed",
29 "crypto/modes",
30 "crypto/cmac",
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/store",
62 "crypto/pqueue",
63 "crypto/whrlpool",
64 "crypto/ts",
65 "crypto/srp",
66 "crypto/ct",
67 "ssl",
68 "apps",
69 "engines",
70 "engines/ccgost",
71 "test",
72 "tools"
73 );
74
75 %top;
76
77 my $fipscanisteronly = 0;
78
79 foreach (@dirs) {
80         next if ($fipscanisteronly && !(-d $_));
81         &files_dir ($_, "Makefile");
82 }
83
84 exit(0);
85
86 sub files_dir
87 {
88 my ($dir, $makefile) = @_;
89
90 my %sym;
91
92 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
93
94 my $s="";
95
96 while (<IN>)
97         {
98         chop;
99         s/#.*//;
100         if (/^([^\s=]+)\s*=\s*(.*)$/)
101                 {
102                 $o="";
103                 ($s,$b)=($1,$2);
104                 for (;;)
105                         {
106                         if ($b =~ /\\$/)
107                                 {
108                                 chop($b);
109                                 $o.=$b." ";
110                                 $b=<IN>;
111                                 chop($b);
112                                 }
113                         else
114                                 {
115                                 $o.=$b." ";
116                                 last;
117                                 }
118                         }
119                 $o =~ s/^\s+//;
120                 $o =~ s/\s+$//;
121                 $o =~ s/\s+/ /g;
122
123                 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
124                 $sym{$s}=($top{$s} or $o);
125                 }
126         }
127
128 print "RELATIVE_DIRECTORY=$dir\n";
129
130 foreach (sort keys %sym)
131         {
132         print "$_=$sym{$_}\n";
133         }
134 if ($dir eq "." && defined($sym{"BUILDENV"}))
135         {
136         foreach (split(' ',$sym{"BUILDENV"}))
137                 {
138                 /^(.+)=/;
139                 $top{$1}=$sym{$1};
140                 }
141         }
142
143 print "RELATIVE_DIRECTORY=\n";
144
145 close (IN);
146 if ($dir eq "." && $sym{FIPSCANISTERONLY} eq "y")
147         {
148         $fipscanisteronly = 1;
149         }
150 }