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