Update some util files to recognize new FIPS directories.
[oweals/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/bn",
30 "crypto/rsa",
31 "crypto/dsa",
32 "crypto/dso",
33 "crypto/dh",
34 "crypto/ec",
35 "crypto/ecdh",
36 "crypto/ecdsa",
37 "crypto/buffer",
38 "crypto/bio",
39 "crypto/stack",
40 "crypto/lhash",
41 "crypto/rand",
42 "crypto/err",
43 "crypto/objects",
44 "crypto/evp",
45 "crypto/asn1",
46 "crypto/pem",
47 "crypto/x509",
48 "crypto/x509v3",
49 "crypto/conf",
50 "crypto/txt_db",
51 "crypto/pkcs7",
52 "crypto/pkcs12",
53 "crypto/comp",
54 "crypto/engine",
55 "crypto/ocsp",
56 "crypto/ui",
57 "crypto/krb5",
58 "crypto/store",
59 "crypto/pqueue",
60 "crypto/cms",
61 "fips",
62 "fips/aes",
63 "fips/des",
64 "fips/dsa",
65 "fips/dh",
66 "fips/hmac",
67 "fips/rand",
68 "fips/rsa",
69 "fips/sha",
70 "ssl",
71 "apps",
72 "engines",
73 "test",
74 "tools"
75 );
76
77 foreach (@dirs) {
78         &files_dir ($_, "Makefile");
79 }
80
81 exit(0);
82
83 sub files_dir
84 {
85 my ($dir, $makefile) = @_;
86
87 my %sym;
88
89 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
90
91 my $s="";
92
93 while (<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/\$[({]([^)}]+)[)}]/$sym{$1}/g;
121                 $sym{$s}=$o;
122                 }
123         }
124
125 print "RELATIVE_DIRECTORY=$dir\n";
126
127 foreach (sort keys %sym)
128         {
129         print "$_=$sym{$_}\n";
130         }
131 print "RELATIVE_DIRECTORY=\n";
132
133 close (IN);
134 }