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