ef72e7223b933d83404ee06e9c9ccc4cf7cd0ef0
[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 "crypto/ui",
53 "crypto/krb5",
54 "ssl",
55 "apps",
56 "test",
57 "tools"
58 );
59
60 foreach (@dirs) {
61         &files_dir ($_, "Makefile.ssl");
62 }
63
64 exit(0);
65
66 sub files_dir
67 {
68 my ($dir, $makefile) = @_;
69
70 my %sym;
71
72 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
73
74 my $s="";
75
76 while (<IN>)
77         {
78         chop;
79         s/#.*//;
80         if (/^(\S+)\s*=\s*(.*)$/)
81                 {
82                 $o="";
83                 ($s,$b)=($1,$2);
84                 for (;;)
85                         {
86                         if ($b =~ /\\$/)
87                                 {
88                                 chop($b);
89                                 $o.=$b." ";
90                                 $b=<IN>;
91                                 chop($b);
92                                 }
93                         else
94                                 {
95                                 $o.=$b." ";
96                                 last;
97                                 }
98                         }
99                 $o =~ s/^\s+//;
100                 $o =~ s/\s+$//;
101                 $o =~ s/\s+/ /g;
102
103                 $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
104                 $sym{$s}=$o;
105                 }
106         }
107
108 print "RELATIVE_DIRECTORY=$dir\n";
109
110 foreach (sort keys %sym)
111         {
112         print "$_=$sym{$_}\n";
113         }
114 print "RELATIVE_DIRECTORY=\n";
115
116 close (IN);
117 }