make update
[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/bn",
31 "crypto/rsa",
32 "crypto/dsa",
33 "crypto/dso",
34 "crypto/dh",
35 "crypto/ec",
36 "crypto/ecdh",
37 "crypto/ecdsa",
38 "crypto/buffer",
39 "crypto/bio",
40 "crypto/stack",
41 "crypto/lhash",
42 "crypto/rand",
43 "crypto/err",
44 "crypto/objects",
45 "crypto/evp",
46 "crypto/asn1",
47 "crypto/pem",
48 "crypto/x509",
49 "crypto/x509v3",
50 "crypto/cms",
51 "crypto/conf",
52 "crypto/jpake",
53 "crypto/txt_db",
54 "crypto/pkcs7",
55 "crypto/pkcs12",
56 "crypto/comp",
57 "crypto/engine",
58 "crypto/ocsp",
59 "crypto/ui",
60 "crypto/krb5",
61 #"crypto/store",
62 "crypto/pqueue",
63 "crypto/whrlpool",
64 "crypto/ts",
65 "ssl",
66 "apps",
67 "engines",
68 "engines/ccgost",
69 "test",
70 "tools"
71 );
72
73 %top;
74
75 foreach (@dirs) {
76         &files_dir ($_, "Makefile");
77 }
78
79 exit(0);
80
81 sub files_dir
82 {
83 my ($dir, $makefile) = @_;
84
85 my %sym;
86
87 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
88
89 my $s="";
90
91 while (<IN>)
92         {
93         chop;
94         s/#.*//;
95         if (/^(\S+)\s*=\s*(.*)$/)
96                 {
97                 $o="";
98                 ($s,$b)=($1,$2);
99                 for (;;)
100                         {
101                         if ($b =~ /\\$/)
102                                 {
103                                 chop($b);
104                                 $o.=$b." ";
105                                 $b=<IN>;
106                                 chop($b);
107                                 }
108                         else
109                                 {
110                                 $o.=$b." ";
111                                 last;
112                                 }
113                         }
114                 $o =~ s/^\s+//;
115                 $o =~ s/\s+$//;
116                 $o =~ s/\s+/ /g;
117
118                 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
119                 $sym{$s}=($top{$s} or $o);
120                 }
121         }
122
123 print "RELATIVE_DIRECTORY=$dir\n";
124
125 foreach (sort keys %sym)
126         {
127         print "$_=$sym{$_}\n";
128         }
129 if ($dir eq "." && defined($sym{"BUILDENV"}))
130         {
131         foreach (split(' ',$sym{"BUILDENV"}))
132                 {
133                 /^(.+)=/;
134                 $top{$1}=$sym{$1};
135                 }
136         }
137
138 print "RELATIVE_DIRECTORY=\n";
139
140 close (IN);
141 }