make update (1.1.0-dev)
[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/krb5",
62 #"crypto/store",
63 "crypto/pqueue",
64 "crypto/whrlpool",
65 "crypto/ts",
66 "crypto/srp",
67 "fips",
68 "fips/aes",
69 "fips/des",
70 "fips/dsa",
71 "fips/dh",
72 "fips/ecdsa",
73 "fips/hmac",
74 "fips/rand",
75 "fips/rsa",
76 "fips/utl",
77 "fips/sha",
78 "ssl",
79 "apps",
80 "engines",
81 "engines/ccgost",
82 "test",
83 "tools"
84 );
85
86 %top;
87
88 my $fipscanisteronly = 0;
89
90 foreach (@dirs) {
91         next if ($fipscanisteronly && !(-d $_));
92         &files_dir ($_, "Makefile");
93 }
94
95 exit(0);
96
97 sub files_dir
98 {
99 my ($dir, $makefile) = @_;
100
101 my %sym;
102
103 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
104
105 my $s="";
106
107 while (<IN>)
108         {
109         chop;
110         s/#.*//;
111         if (/^(\S+)\s*=\s*(.*)$/)
112                 {
113                 $o="";
114                 ($s,$b)=($1,$2);
115                 for (;;)
116                         {
117                         if ($b =~ /\\$/)
118                                 {
119                                 chop($b);
120                                 $o.=$b." ";
121                                 $b=<IN>;
122                                 chop($b);
123                                 }
124                         else
125                                 {
126                                 $o.=$b." ";
127                                 last;
128                                 }
129                         }
130                 $o =~ s/^\s+//;
131                 $o =~ s/\s+$//;
132                 $o =~ s/\s+/ /g;
133
134                 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
135                 $sym{$s}=($top{$s} or $o);
136                 }
137         }
138
139 print "RELATIVE_DIRECTORY=$dir\n";
140
141 foreach (sort keys %sym)
142         {
143         print "$_=$sym{$_}\n";
144         }
145 if ($dir eq "." && defined($sym{"BUILDENV"}))
146         {
147         foreach (split(' ',$sym{"BUILDENV"}))
148                 {
149                 /^(.+)=/;
150                 $top{$1}=$sym{$1};
151                 }
152         }
153
154 print "RELATIVE_DIRECTORY=\n";
155
156 close (IN);
157 if ($dir eq "." && $sym{CONFIGURE_ARGS} =~ /fipscanisteronly/)
158         {
159         $fipscanisteronly = 1;
160         }
161 }