Automate assembler support for Win64 targets (more work is needed).
[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/whrlpool",
61 "crypto/ts",
62 "ssl",
63 "apps",
64 "engines",
65 "engines/ccgost",
66 "test",
67 "tools"
68 );
69
70 %top;
71
72 foreach (@dirs) {
73         &files_dir ($_, "Makefile");
74 }
75
76 exit(0);
77
78 sub files_dir
79 {
80 my ($dir, $makefile) = @_;
81
82 my %sym;
83
84 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
85
86 my $s="";
87
88 while (<IN>)
89         {
90         chop;
91         s/#.*//;
92         if (/^(\S+)\s*=\s*(.*)$/)
93                 {
94                 $o="";
95                 ($s,$b)=($1,$2);
96                 for (;;)
97                         {
98                         if ($b =~ /\\$/)
99                                 {
100                                 chop($b);
101                                 $o.=$b." ";
102                                 $b=<IN>;
103                                 chop($b);
104                                 }
105                         else
106                                 {
107                                 $o.=$b." ";
108                                 last;
109                                 }
110                         }
111                 $o =~ s/^\s+//;
112                 $o =~ s/\s+$//;
113                 $o =~ s/\s+/ /g;
114
115                 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
116                 $sym{$s}=($top{$s} or $o);
117                 }
118         }
119
120 print "RELATIVE_DIRECTORY=$dir\n";
121
122 foreach (sort keys %sym)
123         {
124         print "$_=$sym{$_}\n";
125         }
126 if ($dir eq "." && defined($sym{"BUILDENV"}))
127         {
128         foreach (split(' ',$sym{"BUILDENV"}))
129                 {
130                 /^(.+)=/;
131                 $top{$1}=$sym{$1};
132                 }
133         }
134
135 print "RELATIVE_DIRECTORY=\n";
136
137 close (IN);
138 }