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