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