15e0120df3a456ba32b54dea678f11537a328d5b
[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/bn",
27 "crypto/rsa",
28 "crypto/dsa",
29 "crypto/dso",
30 "crypto/dh",
31 "crypto/buffer",
32 "crypto/bio",
33 "crypto/stack",
34 "crypto/lhash",
35 "crypto/rand",
36 "crypto/err",
37 "crypto/objects",
38 "crypto/evp",
39 "crypto/asn1",
40 "crypto/pem",
41 "crypto/x509",
42 "crypto/x509v3",
43 "crypto/conf",
44 "crypto/txt_db",
45 "crypto/pkcs7",
46 "crypto/pkcs12",
47 "crypto/comp",
48 "crypto/engine",
49 "crypto/ocsp",
50 "ssl",
51 "apps",
52 "test",
53 "tools"
54 );
55
56 foreach (@dirs) {
57         &files_dir ($_, "Makefile.ssl");
58 }
59
60 exit(0);
61
62 sub files_dir
63 {
64 my ($dir, $makefile) = @_;
65
66 my %sym;
67
68 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
69
70 my $s="";
71
72 while (<IN>)
73         {
74         chop;
75         s/#.*//;
76         if (/^(\S+)\s*=\s*(.*)$/)
77                 {
78                 $o="";
79                 ($s,$b)=($1,$2);
80                 for (;;)
81                         {
82                         if ($b =~ /\\$/)
83                                 {
84                                 chop($b);
85                                 $o.=$b." ";
86                                 $b=<IN>;
87                                 chop($b);
88                                 }
89                         else
90                                 {
91                                 $o.=$b." ";
92                                 last;
93                                 }
94                         }
95                 $o =~ s/^\s+//;
96                 $o =~ s/\s+$//;
97                 $o =~ s/\s+/ /g;
98
99                 $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
100                 $sym{$s}=$o;
101                 }
102         }
103
104 print "RELATIVE_DIRECTORY=$dir\n";
105
106 foreach (sort keys %sym)
107         {
108         print "$_=$sym{$_}\n";
109         }
110 print "RELATIVE_DIRECTORY=\n";
111
112 close (IN);
113 }