Support ccache.
[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/aes",
27 "crypto/camellia",
28 "crypto/seed",
29 "crypto/modes",
30 "crypto/cmac",
31 "crypto/bn",
32 "crypto/rsa",
33 "crypto/dsa",
34 "crypto/dso",
35 "crypto/dh",
36 "crypto/ec",
37 "crypto/buffer",
38 "crypto/bio",
39 "crypto/stack",
40 "crypto/lhash",
41 "crypto/rand",
42 "crypto/err",
43 "crypto/objects",
44 "crypto/evp",
45 "crypto/asn1",
46 "crypto/pem",
47 "crypto/x509",
48 "crypto/x509v3",
49 "crypto/cms",
50 "crypto/conf",
51 "crypto/jpake",
52 "crypto/txt_db",
53 "crypto/pkcs7",
54 "crypto/pkcs12",
55 "crypto/comp",
56 "crypto/engine",
57 "crypto/ocsp",
58 "crypto/ui",
59 #"crypto/store",
60 "crypto/pqueue",
61 "crypto/whrlpool",
62 "crypto/ts",
63 "crypto/srp",
64 "crypto/ct",
65 "crypto/async",
66 "crypto/chacha",
67 "crypto/poly1305",
68 "ssl",
69 "apps",
70 "engines",
71 "engines/ccgost",
72 "test",
73 "tools"
74 );
75
76 %top;
77
78 my $fipscanisteronly = 0;
79
80 foreach (@dirs) {
81         next if ($fipscanisteronly && !(-d $_));
82         &files_dir ($_, "Makefile");
83 }
84
85 exit(0);
86
87 sub files_dir
88 {
89 my ($dir, $makefile) = @_;
90
91 my %sym;
92
93 open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
94
95 my $s="";
96
97 while (<IN>)
98         {
99         chop;
100         s/#.*//;
101         if (/^([^\s=]+)\s*=\s*(.*)$/)
102                 {
103                 $o="";
104                 ($s,$b)=($1,$2);
105                 for (;;)
106                         {
107                         if ($b =~ /\\$/)
108                                 {
109                                 chop($b);
110                                 $o.=$b." ";
111                                 $b=<IN>;
112                                 chop($b);
113                                 }
114                         else
115                                 {
116                                 $o.=$b." ";
117                                 last;
118                                 }
119                         }
120                 $o =~ s/^\s+//;
121                 $o =~ s/\s+$//;
122                 $o =~ s/\s+/ /g;
123
124                 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
125                 $sym{$s}=($top{$s} or $o);
126                 }
127         }
128
129 print "RELATIVE_DIRECTORY=$dir\n";
130
131 foreach (sort keys %sym)
132         {
133         print "$_=$sym{$_}\n";
134         }
135 if ($dir eq "." && defined($sym{"BUILDENV"}))
136         {
137         foreach (split(' ',$sym{"BUILDENV"}))
138                 {
139                 /^(.+)=/;
140                 $top{$1}=$sym{$1};
141                 }
142         }
143
144 print "RELATIVE_DIRECTORY=\n";
145
146 close (IN);
147 if ($dir eq "." && $sym{FIPSCANISTERONLY} eq "y")
148         {
149         $fipscanisteronly = 1;
150         }
151 }