Win32 fixes... add new directory to build system. Fix warnings.
[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/cms",
50 "crypto/conf",
51 "crypto/jpake",
52 "crypto/txt_db",
53 "crypto/pkcs7",
54 "crypto/pkcs12",
55 "crypto/comp",
56 "crypto/engine",
57 "crypto/ocsp",
58 "crypto/ui",
59 "crypto/krb5",
60 #"crypto/store",
61 "crypto/pqueue",
62 "crypto/whrlpool",
63 "crypto/ts",
64 "ssl",
65 "apps",
66 "engines",
67 "engines/ccgost",
68 "test",
69 "tools"
70 );
71
72 %top;
73
74 foreach (@dirs) {
75         &files_dir ($_, "Makefile");
76 }
77
78 exit(0);
79
80 sub files_dir
81 {
82 my ($dir, $makefile) = @_;
83
84 my %sym;
85
86 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
87
88 my $s="";
89
90 while (<IN>)
91         {
92         chop;
93         s/#.*//;
94         if (/^(\S+)\s*=\s*(.*)$/)
95                 {
96                 $o="";
97                 ($s,$b)=($1,$2);
98                 for (;;)
99                         {
100                         if ($b =~ /\\$/)
101                                 {
102                                 chop($b);
103                                 $o.=$b." ";
104                                 $b=<IN>;
105                                 chop($b);
106                                 }
107                         else
108                                 {
109                                 $o.=$b." ";
110                                 last;
111                                 }
112                         }
113                 $o =~ s/^\s+//;
114                 $o =~ s/\s+$//;
115                 $o =~ s/\s+/ /g;
116
117                 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
118                 $sym{$s}=($top{$s} or $o);
119                 }
120         }
121
122 print "RELATIVE_DIRECTORY=$dir\n";
123
124 foreach (sort keys %sym)
125         {
126         print "$_=$sym{$_}\n";
127         }
128 if ($dir eq "." && defined($sym{"BUILDENV"}))
129         {
130         foreach (split(' ',$sym{"BUILDENV"}))
131                 {
132                 /^(.+)=/;
133                 $top{$1}=$sym{$1};
134                 }
135         }
136
137 print "RELATIVE_DIRECTORY=\n";
138
139 close (IN);
140 }