]>
Commit | Line | Data |
---|---|---|
567a9e6f RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
da51dc5f RL |
6 | use OpenSSL::Util; |
7 | ||
2e535eb5 RL |
8 | our $makedep_scheme = $config{makedep_scheme}; |
9 | our $makedepcmd = platform->makedepcmd(); | |
834aae2a | 10 | |
567a9e6f | 11 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } |
f5c174ff | 12 | |
cff89b17 AP |
13 | # Shared AIX support is special. We put libcrypto[64].so.ver into |
14 | # libcrypto.a and use libcrypto_a.a as static one. | |
15 | sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ } | |
16 | ||
9dd4ed28 | 17 | our $sover_dirname = platform->shlib_version_as_filename(); |
33105818 | 18 | |
27c40a93 BL |
19 | # This makes sure things get built in the order they need |
20 | # to. You're welcome. | |
21 | sub dependmagic { | |
22 | my $target = shift; | |
d1080823 | 23 | my $help = shift; |
27c40a93 | 24 | |
d1080823 | 25 | return "$target: build_generated ## $help\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; |
27c40a93 | 26 | } |
c00d9311 RL |
27 | |
28 | our $COLUMNS = $ENV{COLUMNS}; | |
29 | if ($COLUMNS =~ /^\d+$/) { | |
30 | $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \' | |
31 | } else { | |
32 | $COLUMNS = 76; | |
33 | } | |
34 | ||
35 | sub fill_lines { | |
36 | my $item_sep = shift; # string | |
37 | my $line_length = shift; # number of chars | |
38 | ||
39 | my @result = (); | |
40 | my $resultpos = 0; | |
41 | ||
42 | foreach (@_) { | |
43 | my $fill_line = $result[$resultpos] // ''; | |
44 | my $newline = | |
45 | ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_; | |
46 | ||
47 | if (length($newline) > $line_length) { | |
48 | # If this is a single item and the intended result line | |
49 | # is empty, we put it there anyway | |
50 | if ($fill_line eq '') { | |
51 | $result[$resultpos++] = $newline; | |
52 | } else { | |
53 | $result[++$resultpos] = $_; | |
54 | } | |
55 | } else { | |
56 | $result[$resultpos] = $newline; | |
57 | } | |
58 | } | |
59 | return @result; | |
60 | } | |
834aae2a | 61 | ''; |
567a9e6f RL |
62 | -} |
63 | PLATFORM={- $config{target} -} | |
64 | OPTIONS={- $config{options} -} | |
65 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
66 | SRCDIR={- $config{sourcedir} -} | |
67 | BLDDIR={- $config{builddir} -} | |
31214258 | 68 | FIPSKEY={- $config{FIPSKEY} -} |
567a9e6f | 69 | |
16942e08 | 70 | VERSION={- "$config{full_version}" -} |
435981cb | 71 | VERSION_NUMBER={- "$config{version}" -} |
567a9e6f RL |
72 | MAJOR={- $config{major} -} |
73 | MINOR={- $config{minor} -} | |
3a63dbef | 74 | SHLIB_VERSION_NUMBER={- $config{shlib_version} -} |
567a9e6f | 75 | SHLIB_TARGET={- $target{shared_target} -} |
9dd4ed28 | 76 | |
c00d9311 RL |
77 | LIBS={- join(" \\\n" . ' ' x 5, |
78 | fill_lines(" ", $COLUMNS - 5, | |
79 | map { platform->staticlib($_) // () } | |
80 | @{$unified_info{libraries}})) -} | |
81 | SHLIBS={- join(" \\\n" . ' ' x 7, | |
82 | fill_lines(" ", $COLUMNS - 7, | |
83 | map { platform->sharedlib($_) // () } | |
84 | @{$unified_info{libraries}})) -} | |
85 | SHLIB_INFO={- join(" \\\n" . ' ' x 11, | |
86 | fill_lines(" ", $COLUMNS - 11, | |
87 | map { my $x = platform->sharedlib($_); | |
ef161e7b RL |
88 | my $y = platform->sharedlib_simple($_) // ''; |
89 | my $z = platform->sharedlib_import($_) // ''; | |
90 | $x ? "\"$x;$y;$z\"" : () } | |
c00d9311 RL |
91 | @{$unified_info{libraries}})) -} |
92 | MODULES={- join(" \\\n" . ' ' x 8, | |
93 | fill_lines(" ", $COLUMNS - 8, | |
94 | map { platform->dso($_) } | |
a2405c5f RL |
95 | # Drop all modules that are dependencies, they will |
96 | # be processed through their dependents | |
97 | grep { my $x = $_; | |
98 | !grep { grep { $_ eq $x } @$_ } | |
99 | values %{$unified_info{depends}} } | |
c00d9311 | 100 | @{$unified_info{modules}})) -} |
a2405c5f RL |
101 | FIPSMODULE={- # We do some extra checking here, as there should be only one |
102 | use File::Basename; | |
103 | our @fipsmodules = | |
104 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
105 | && $unified_info{attributes}->{modules}->{$_}->{fips} } | |
106 | @{$unified_info{modules}}; | |
107 | die "More that one FIPS module" if scalar @fipsmodules > 1; | |
108 | join(" ", map { platform->dso($_) } @fipsmodules) -} | |
109 | FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1; | |
c9b0214e | 110 | join(" ", map { basename(platform->dso($_)) } @fipsmodules) -} |
a1bfcb15 | 111 | |
c00d9311 RL |
112 | PROGRAMS={- join(" \\\n" . ' ' x 9, |
113 | fill_lines(" ", $COLUMNS - 9, | |
114 | map { platform->bin($_) } | |
115 | @{$unified_info{programs}})) -} | |
116 | SCRIPTS={- join(" \\\n" . ' ' x 8, | |
117 | fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -} | |
29eed3dd | 118 | {- output_off() if $disabled{makedepend}; "" -} |
c00d9311 RL |
119 | DEPS={- join(" \\\n" . ' ' x 5, |
120 | fill_lines(" ", $COLUMNS - 5, | |
121 | map { platform->isobj($_) ? platform->dep($_) : () } | |
122 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } | |
123 | keys %{$unified_info{sources}})); -} | |
29eed3dd | 124 | {- output_on() if $disabled{makedepend}; "" -} |
c00d9311 RL |
125 | GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20, |
126 | fill_lines(" ", $COLUMNS - 20, | |
127 | @{$unified_info{depends}->{""}})) -} | |
9ca08f91 RL |
128 | GENERATED_PODS={- # common0.tmpl provides @generated |
129 | join(" \\\n" . ' ' x 15, | |
130 | fill_lines(" ", $COLUMNS - 15, | |
131 | map { my $x = $_; | |
132 | ( | |
133 | grep { | |
134 | $unified_info{attributes}->{depends} | |
135 | ->{$x}->{$_}->{pod} // 0 | |
136 | } | |
137 | keys %{$unified_info{attributes}->{depends}->{$x}} | |
138 | ) ? $x : (); | |
139 | } | |
140 | @generated)) -} | |
8258975c | 141 | GENERATED={- # common0.tmpl provides @generated |
c00d9311 RL |
142 | join(" \\\n" . ' ' x 5, |
143 | fill_lines(" ", $COLUMNS - 5, | |
144 | map { platform->convertext($_) } @generated )) -} | |
9dd4ed28 | 145 | |
ac6bba6f | 146 | INSTALL_LIBS={- |
c00d9311 RL |
147 | join(" \\\n" . ' ' x 13, |
148 | fill_lines(" ", $COLUMNS - 13, | |
149 | map { platform->staticlib($_) // () } | |
150 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
151 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
152 | -} |
153 | INSTALL_SHLIBS={- | |
c00d9311 RL |
154 | join(" \\\n" . ' ' x 15, |
155 | fill_lines(" ", $COLUMNS - 15, | |
156 | map { platform->sharedlib($_) // () } | |
157 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
158 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
159 | -} |
160 | INSTALL_SHLIB_INFO={- | |
c00d9311 RL |
161 | join(" \\\n" . ' ' x 19, |
162 | fill_lines(" ", $COLUMNS - 19, | |
163 | map { my $x = platform->sharedlib($_); | |
ef161e7b RL |
164 | my $y = platform->sharedlib_simple($_) // ''; |
165 | my $z = platform->sharedlib_import($_) // ''; | |
166 | $x ? "\"$x;$y;$z\"" : () } | |
c00d9311 RL |
167 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
168 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
169 | -} |
170 | INSTALL_ENGINES={- | |
c00d9311 RL |
171 | join(" \\\n" . ' ' x 16, |
172 | fill_lines(" ", $COLUMNS - 16, | |
173 | map { platform->dso($_) } | |
174 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
175 | && $unified_info{attributes}->{modules}->{$_}->{engine} } | |
176 | @{$unified_info{modules}})) | |
ac6bba6f | 177 | -} |
f5657ce8 | 178 | INSTALL_MODULES={- |
5b689181 DMSP |
179 | join(" \\\n" . ' ' x 16, |
180 | fill_lines(" ", $COLUMNS - 16, | |
181 | map { platform->dso($_) } | |
182 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
f5657ce8 RL |
183 | && !$unified_info{attributes}->{modules}->{$_}->{engine} |
184 | && !$unified_info{attributes}->{modules}->{$_}->{fips} } | |
5b689181 DMSP |
185 | @{$unified_info{modules}})) |
186 | -} | |
f5657ce8 | 187 | INSTALL_FIPSMODULE={- |
41149648 RL |
188 | join(" \\\n" . ' ' x 16, |
189 | fill_lines(" ", $COLUMNS - 16, | |
190 | map { platform->dso($_) } | |
191 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
f5657ce8 | 192 | && $unified_info{attributes}->{modules}->{$_}->{fips} } |
41149648 RL |
193 | @{$unified_info{modules}})) |
194 | -} | |
f5657ce8 | 195 | INSTALL_FIPSMODULECONF=providers/fipsmodule.cnf |
ac6bba6f | 196 | INSTALL_PROGRAMS={- |
c00d9311 RL |
197 | join(" \\\n" . ' ' x 16, |
198 | fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) } | |
199 | grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } | |
200 | @{$unified_info{programs}})) | |
ac6bba6f | 201 | -} |
2ac569a6 RL |
202 | INSTALL_EXPORTERS_PKGCONFIG={- |
203 | join(" \\\n" . ' ' x 28, | |
204 | fill_lines(" ", $COLUMNS - 28, | |
205 | grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'pkg-config'} | |
206 | sort keys %{$unified_info{generate}})) | |
207 | -} | |
994e86a9 | 208 | BIN_SCRIPTS={- |
c00d9311 RL |
209 | join(" \\\n" . ' ' x 12, |
210 | fill_lines(" ", $COLUMNS - 12, | |
211 | map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; | |
212 | $x ? "$_:$x" : $_ } | |
213 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} | |
214 | && !$unified_info{attributes}->{scripts}->{$_}->{misc} } | |
215 | @{$unified_info{scripts}})) | |
994e86a9 RL |
216 | -} |
217 | MISC_SCRIPTS={- | |
c00d9311 RL |
218 | join(" \\\n" . ' ' x 13, |
219 | fill_lines(" ", $COLUMNS - 13, | |
220 | map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; | |
221 | $x ? "$_:$x" : $_ } | |
222 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} | |
223 | && $unified_info{attributes}->{scripts}->{$_}->{misc} } | |
224 | @{$unified_info{scripts}})) | |
994e86a9 | 225 | -} |
06621ba3 P |
226 | IMAGEDOCS1={- |
227 | join(" \\\n" . ' ' x 10, | |
228 | fill_lines(" ", $COLUMNS - 10, | |
229 | @{$unified_info{imagedocs}->{man1}})) -} | |
230 | IMAGEDOCS3={- | |
231 | join(" \\\n" . ' ' x 10, | |
232 | fill_lines(" ", $COLUMNS - 10, | |
233 | @{$unified_info{imagedocs}->{man3}})) -} | |
234 | IMAGEDOCS5={- | |
235 | join(" \\\n" . ' ' x 10, | |
236 | fill_lines(" ", $COLUMNS - 10, | |
237 | @{$unified_info{imagedocs}->{man5}})) -} | |
238 | IMAGEDOCS7={- | |
239 | join(" \\\n" . ' ' x 10, | |
240 | fill_lines(" ", $COLUMNS - 10, | |
241 | @{$unified_info{imagedocs}->{man7}})) -} | |
b0940b33 RL |
242 | HTMLDOCS1={- |
243 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 244 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
245 | @{$unified_info{htmldocs}->{man1}})) -} |
246 | HTMLDOCS3={- | |
247 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 248 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
249 | @{$unified_info{htmldocs}->{man3}})) -} |
250 | HTMLDOCS5={- | |
251 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 252 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
253 | @{$unified_info{htmldocs}->{man5}})) -} |
254 | HTMLDOCS7={- | |
255 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 256 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
257 | @{$unified_info{htmldocs}->{man7}})) -} |
258 | MANDOCS1={- | |
259 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 260 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 RL |
261 | @{$unified_info{mandocs}->{man1}})) -} |
262 | MANDOCS3={- | |
263 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 264 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 RL |
265 | @{$unified_info{mandocs}->{man3}})) -} |
266 | MANDOCS5={- | |
267 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 268 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 RL |
269 | @{$unified_info{mandocs}->{man5}})) -} |
270 | MANDOCS7={- | |
271 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 272 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 | 273 | @{$unified_info{mandocs}->{man7}})) -} |
567a9e6f | 274 | |
a3f1fc25 RL |
275 | APPS_OPENSSL="{- use File::Spec::Functions; |
276 | catfile("apps","openssl") -}" | |
6a74806e | 277 | |
3c65577f RL |
278 | # DESTDIR is for package builders so that they can configure for, say, |
279 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 280 | # Normally it is left empty. |
3c65577f | 281 | DESTDIR= |
567a9e6f RL |
282 | |
283 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
284 | # to change this! Short explanation in the top comment in Configure | |
285 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
286 | # | |
287 | our $prefix = $config{prefix} || "/usr/local"; | |
288 | $prefix -} | |
289 | OPENSSLDIR={- # | |
290 | # The logic here is that if no --openssldir was given, | |
291 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
292 | # If --openssldir was given and the value is an absolute | |
293 | # path, OPENSSLDIR will get its value without change. | |
294 | # If the value from --openssldir is a relative path, | |
295 | # OPENSSLDIR will get $prefix with the --openssldir | |
296 | # value appended as a subdirectory. | |
297 | # | |
298 | use File::Spec::Functions; | |
299 | our $openssldir = | |
300 | $config{openssldir} ? | |
301 | (file_name_is_absolute($config{openssldir}) ? | |
302 | $config{openssldir} | |
303 | : catdir($prefix, $config{openssldir})) | |
304 | : catdir($prefix, "ssl"); | |
305 | $openssldir -} | |
e454f3ad RL |
306 | LIBDIR={- our $libdir = $config{libdir}; |
307 | unless ($libdir) { | |
74b7f339 | 308 | $libdir = "lib$target{multilib}"; |
e454f3ad RL |
309 | } |
310 | file_name_is_absolute($libdir) ? "" : $libdir -} | |
311 | # $(libdir) is chosen to be compatible with the GNU coding standards | |
312 | libdir={- file_name_is_absolute($libdir) | |
313 | ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} | |
314 | ENGINESDIR=$(libdir)/engines-{- $sover_dirname -} | |
3f4e8d66 | 315 | MODULESDIR=$(libdir)/ossl-modules |
567a9e6f | 316 | |
fad599f7 RL |
317 | # Convenience variable for those who want to set the rpath in shared |
318 | # libraries and applications | |
e454f3ad | 319 | LIBRPATH=$(libdir) |
fad599f7 | 320 | |
d793a325 RB |
321 | BINDIR={- our $bindir = $config{bindir}; |
322 | unless ($bindir) { | |
323 | $bindir = "bin$target{multibin}"; | |
324 | } | |
325 | file_name_is_absolute($bindir) ? "" : $bindir -} | |
326 | bindir={- file_name_is_absolute($bindir) | |
327 | ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -} | |
328 | ||
2ac569a6 RL |
329 | PKGCONFIGDIR=$(libdir)/pkgconfig |
330 | ||
dde10ab4 | 331 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
332 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
333 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 334 | |
3544091a RL |
335 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
336 | # appended after the manpage file section number. "ssl" is popular, | |
337 | # resulting in files such as config.5ssl rather than config.5. | |
ae6f65ae | 338 | MANSUFFIX=ossl |
567a9e6f RL |
339 | HTMLSUFFIX=html |
340 | ||
5407338a RS |
341 | # For "optional" echo messages, to get "real" silence |
342 | ECHO = echo | |
567a9e6f | 343 | |
abe256e7 RL |
344 | ##### User defined commands and flags ################################ |
345 | ||
346 | # We let the C compiler driver to take care of .s files. This is done in | |
347 | # order to be excused from maintaining a separate set of architecture | |
348 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
349 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
350 | # and pass it down to assembler. In any case, we do not define AS or | |
351 | # ASFLAGS for this reason. | |
352 | ||
353 | CROSS_COMPILE={- $config{CROSS_COMPILE} -} | |
354 | CC=$(CROSS_COMPILE){- $config{CC} -} | |
355 | CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -} | |
356 | CPPFLAGS={- our $cppflags1 = join(" ", | |
357 | (map { "-D".$_} @{$config{CPPDEFINES}}), | |
358 | (map { "-I".$_} @{$config{CPPINCLUDES}}), | |
359 | @{$config{CPPFLAGS}}) -} | |
360 | CFLAGS={- join(' ', @{$config{CFLAGS}}) -} | |
361 | CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} | |
362 | LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} | |
363 | EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} | |
364 | ||
2e535eb5 | 365 | MAKEDEPEND={- $config{makedepcmd} -} |
567a9e6f | 366 | |
9e265322 | 367 | PERL={- $config{PERL} -} |
567a9e6f | 368 | |
abe256e7 RL |
369 | AR=$(CROSS_COMPILE){- $config{AR} -} |
370 | ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} | |
371 | RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -} | |
372 | RC= $(CROSS_COMPILE){- $config{RC} -} | |
373 | RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -} | |
374 | ||
567a9e6f | 375 | RM= rm -f |
98e5534e | 376 | RMDIR= rmdir |
abe256e7 RL |
377 | TAR= {- $target{TAR} || "tar" -} |
378 | TARFLAGS= {- $target{TARFLAGS} -} | |
567a9e6f RL |
379 | |
380 | BASENAME= openssl | |
381 | NAME= $(BASENAME)-$(VERSION) | |
b741f153 | 382 | # Relative to $(SRCDIR) |
567a9e6f RL |
383 | TARFILE= ../$(NAME).tar |
384 | ||
abe256e7 RL |
385 | ##### Project flags ################################################## |
386 | ||
387 | # Variables starting with CNF_ are common variables for all product types | |
388 | ||
389 | CNF_CPPFLAGS={- our $cppflags2 = | |
390 | join(' ', $target{cppflags} || (), | |
391 | (map { "-D".$_} @{$target{defines}}, | |
392 | @{$config{defines}}), | |
393 | (map { "-I".$_} @{$target{includes}}, | |
394 | @{$config{includes}}), | |
395 | @{$config{cppflags}}) -} | |
396 | CNF_CFLAGS={- join(' ', $target{cflags} || (), | |
397 | @{$config{cflags}}) -} | |
398 | CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), | |
399 | @{$config{cxxflags}}) -} | |
400 | CNF_LDFLAGS={- join(' ', $target{lflags} || (), | |
401 | @{$config{lflags}}) -} | |
402 | CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), | |
403 | @{$config{ex_libs}}) -} | |
404 | ||
405 | # Variables starting with LIB_ are used to build library object files | |
406 | # and shared libraries. | |
407 | # Variables starting with DSO_ are used to build DSOs and their object files. | |
408 | # Variables starting with BIN_ are used to build programs and their object | |
409 | # files. | |
410 | ||
58d6be5b RL |
411 | LIB_CPPFLAGS={- our $lib_cppflags = |
412 | join(' ', $target{lib_cppflags} || (), | |
abe256e7 RL |
413 | $target{shared_cppflag} || (), |
414 | (map { '-D'.$_ } | |
d368d9d2 RL |
415 | @{$target{lib_defines} || ()}, |
416 | @{$target{shared_defines} || ()}, | |
2fce15b5 RL |
417 | @{$config{lib_defines} || ()}, |
418 | @{$config{shared_defines} || ()}), | |
d368d9d2 RL |
419 | (map { '-I'.quotify1($_) } |
420 | @{$target{lib_includes}}, | |
421 | @{$target{shared_includes}}, | |
422 | @{$config{lib_includes}}, | |
423 | @{$config{shared_includes}}), | |
58d6be5b RL |
424 | @{$config{lib_cppflags}}, |
425 | @{$config{shared_cppflag}}); | |
426 | join(' ', $lib_cppflags, | |
427 | (map { '-D'.$_ } | |
abe256e7 | 428 | 'OPENSSLDIR="\"$(OPENSSLDIR)\""', |
3f4e8d66 RL |
429 | 'ENGINESDIR="\"$(ENGINESDIR)\""', |
430 | 'MODULESDIR="\"$(MODULESDIR)\""'), | |
abe256e7 RL |
431 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} |
432 | LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), | |
433 | $target{shared_cflag} || (), | |
434 | @{$config{lib_cflags}}, | |
435 | @{$config{shared_cflag}}, | |
436 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
437 | LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (), | |
438 | $target{shared_cxxflag} || (), | |
439 | @{$config{lib_cxxflags}}, | |
440 | @{$config{shared_cxxflag}}, | |
441 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
442 | LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), | |
443 | $config{shared_ldflag} || (), | |
444 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
445 | LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
446 | DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), | |
447 | $target{module_cppflags} || (), | |
2fce15b5 | 448 | (map { '-D'.$_ } |
d368d9d2 RL |
449 | @{$target{dso_defines}}, |
450 | @{$target{module_defines}}, | |
2fce15b5 RL |
451 | @{$config{dso_defines} || ()}, |
452 | @{$config{module_defines} || ()}), | |
d368d9d2 RL |
453 | (map { '-I'.quotify1($_) } |
454 | @{$target{dso_includes}}, | |
455 | @{$target{module_includes}}, | |
456 | @{$config{dso_includes}}, | |
457 | @{$config{module_includes}}), | |
abe256e7 RL |
458 | @{$config{dso_cppflags}}, |
459 | @{$config{module_cppflags}}, | |
460 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
461 | DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), | |
462 | $target{module_cflags} || (), | |
463 | @{$config{dso_cflags}}, | |
464 | @{$config{module_cflags}}, | |
465 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
466 | DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (), | |
467 | $target{module_cxxflags} || (), | |
468 | @{$config{dso_cxxflags}}, | |
469 | @{$config{module_cxxflag}}, | |
470 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
471 | DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (), | |
472 | $target{module_ldflags} || (), | |
473 | @{$config{dso_ldflags}}, | |
474 | @{$config{module_ldflags}}, | |
475 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
476 | DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
477 | BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), | |
2fce15b5 | 478 | (map { '-D'.$_ } @{$config{bin_defines} || ()}), |
abe256e7 RL |
479 | @{$config{bin_cppflags}}, |
480 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
481 | BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), | |
482 | @{$config{bin_cflags}}, | |
483 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
484 | BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (), | |
485 | @{$config{bin_cxxflags}}, | |
486 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
487 | BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), | |
488 | @{$config{bin_lflags}}, | |
489 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
490 | BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
491 | ||
492 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h | |
493 | CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; | |
494 | $cppflags2 =~ s|([\\"])|\\$1|g; | |
58d6be5b RL |
495 | $lib_cppflags =~ s|([\\"])|\\$1|g; |
496 | join(' ', $lib_cppflags || (), $cppflags2 || (), | |
497 | $cppflags1 || ()) -} | |
abe256e7 | 498 | |
567a9e6f RL |
499 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
500 | ||
501 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
502 | # the 80386. | |
503 | PROCESSOR= {- $config{processor} -} | |
504 | ||
9c7ce40b AP |
505 | # We want error [and other] messages in English. Trouble is that make(1) |
506 | # doesn't pass macros down as environment variables unless there already | |
507 | # was corresponding variable originally set. In other words we can only | |
508 | # reassign environment variables, but not set new ones, not in portable | |
509 | # manner that is. That's why we reassign several, just to be sure... | |
510 | LC_ALL=C | |
511 | LC_MESSAGES=C | |
512 | LANG=C | |
513 | ||
567a9e6f RL |
514 | # The main targets ################################################### |
515 | ||
d1080823 | 516 | ##@ Software |
567a9e6f | 517 | |
d1080823 TS |
518 | {- dependmagic('build_sw', 'Build all the software (default target)'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils |
519 | {- dependmagic('build_libs', 'Build the libraries libssl and libcrypto'); -}: build_libs_nodep | |
520 | {- dependmagic('build_modules', 'Build the modules (i.e. providers and engines)'); -}: build_modules_nodep | |
521 | {- dependmagic('build_programs', 'Build the openssl executables and scripts'); -}: build_programs_nodep | |
522 | ||
956b4c75 | 523 | all: build_sw {- "build_docs" if !$disabled{docs}; -} ## Build software and documentation |
d1080823 TS |
524 | |
525 | ##@ Documentation | |
9ca08f91 | 526 | build_generated_pods: $(GENERATED_PODS) |
d1080823 TS |
527 | build_docs: build_man_docs build_html_docs ## Create documentation |
528 | build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) ## Create manpages | |
529 | build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) ## Create HTML documentation | |
b0940b33 | 530 | |
27c40a93 | 531 | build_generated: $(GENERATED_MANDATORY) |
2ac569a6 | 532 | build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -} |
1842f369 | 533 | build_modules_nodep: $(MODULES) |
1e3d16b0 RL |
534 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
535 | ||
536 | # Kept around for backward compatibility | |
537 | build_apps build_tests: build_programs | |
68a5f1a2 | 538 | |
9b03b91b RL |
539 | # Convenience target to prebuild all generated files, not just the mandatory |
540 | # ones | |
b0940b33 | 541 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs |
18d15882 AP |
542 | @ : {- output_off() if $disabled{makedepend}; "" -} |
543 | @echo "Warning: consider configuring with no-makedepend, because if" | |
544 | @echo " target system doesn't have $(PERL)," | |
545 | @echo " then make will fail..." | |
546 | @ : {- output_on() if $disabled{makedepend}; "" -} | |
9b03b91b | 547 | |
d1080823 TS |
548 | ##@ Help |
549 | .PHONY: help | |
550 | help: ## Show this help screen | |
551 | @$(PERL) $(SRCDIR)/util/help.pl $(BLDDIR)/Makefile | |
b0940b33 | 552 | |
d1080823 TS |
553 | ##@ Testing |
554 | test: tests ## Run tests (alias of "tests") | |
555 | {- dependmagic('tests', 'Run tests'); -}: build_programs_nodep build_modules_nodep link-utils run_tests | |
c612c7a4 | 556 | run_tests: |
d90a6beb | 557 | @ : {- output_off() if $disabled{tests}; "" -} |
f0790d4d RL |
558 | ( SRCTOP=$(SRCDIR) \ |
559 | BLDTOP=$(BLDDIR) \ | |
cbece220 | 560 | PERL="$(PERL)" \ |
31214258 | 561 | FIPSKEY="$(FIPSKEY)" \ |
9dd4ed28 | 562 | EXE_EXT={- platform->binext() -} \ |
f0790d4d | 563 | $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
564 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
565 | @echo "Tests are not supported with your chosen Configure options" | |
566 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f | 567 | |
d1080823 | 568 | list-tests: ## List available tests that can be invoked via "make test TESTS=<name>" |
4813ad2d | 569 | @ : {- output_off() if $disabled{tests}; "" -} |
c612c7a4 | 570 | $(MAKE) run_tests TESTS=list |
4813ad2d RL |
571 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
572 | @echo "Tests are not supported with your chosen Configure options" | |
573 | @ : {- output_on() if !$disabled{tests}; "" -} | |
574 | ||
d1080823 | 575 | ##@ Workspace cleaning |
567a9e6f RL |
576 | |
577 | libclean: | |
f99f91f1 | 578 | @set -e; for s in $(SHLIB_INFO); do \ |
49bb4dd0 | 579 | if [ "$$s" = ";" ]; then continue; fi; \ |
f99f91f1 RL |
580 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
581 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
ef161e7b | 582 | s3=`echo "$$s" | cut -f3 -d";"`; \ |
49bb4dd0 BE |
583 | $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\ |
584 | $(RM) apps/$$s1; \ | |
585 | $(RM) test/$$s1; \ | |
586 | $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\ | |
f99f91f1 | 587 | $(RM) $$s1; \ |
ef161e7b | 588 | if [ "$$s2" != "" ]; then \ |
5407338a | 589 | $(ECHO) $(RM) $$s2; \ |
f99f91f1 RL |
590 | $(RM) $$s2; \ |
591 | fi; \ | |
ef161e7b RL |
592 | if [ "$$s3" != "" ]; then \ |
593 | $(ECHO) $(RM) $$s3; \ | |
594 | $(RM) $$s3; \ | |
595 | fi; \ | |
f99f91f1 RL |
596 | done |
597 | $(RM) $(LIBS) | |
9dd4ed28 | 598 | $(RM) *{- platform->defext() -} |
567a9e6f | 599 | |
d1080823 | 600 | clean: libclean ## Clean the workspace, keep the configuration |
c47a0803 RB |
601 | $(RM) $(HTMLDOCS1) |
602 | $(RM) $(HTMLDOCS3) | |
603 | $(RM) $(HTMLDOCS5) | |
604 | $(RM) $(HTMLDOCS7) | |
605 | $(RM) $(MANDOCS1) | |
606 | $(RM) $(MANDOCS3) | |
607 | $(RM) $(MANDOCS5) | |
608 | $(RM) $(MANDOCS7) | |
d94c2f1b | 609 | $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS) |
b0a97931 | 610 | $(RM) $(GENERATED_MANDATORY) $(GENERATED) |
0ce47b35 RL |
611 | -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \; |
612 | -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \; | |
4813ad2d | 613 | $(RM) core |
5bac37cb | 614 | $(RM) tags TAGS doc-nits md-nits |
d016d1ec | 615 | $(RM) -r test/test-runs |
a3c86ce9 | 616 | $(RM) providers/fips*.new |
0ce47b35 | 617 | -find . -type l \! -name '.*' -exec $(RM) {} \; |
567a9e6f | 618 | |
d1080823 | 619 | distclean: clean ## Clean and remove the configuration |
ef8040bc | 620 | $(RM) include/openssl/configuration.h |
4813ad2d RL |
621 | $(RM) configdata.pm |
622 | $(RM) Makefile | |
7cae3864 | 623 | |
f8d9d6e4 | 624 | # We check if any depfile is newer than Makefile and decide to |
a6adf099 | 625 | # concatenate only if that is true. |
468d1517 | 626 | depend: Makefile |
29eed3dd | 627 | @: {- output_off() if $disabled{makedepend}; "" -} |
2e535eb5 | 628 | @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}" |
29eed3dd | 629 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
630 | |
631 | # Install helper targets ############################################# | |
d1080823 TS |
632 | ##@ Installation |
633 | ||
956b4c75 | 634 | install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} ## Install software and documentation, create OpenSSL directories |
d1080823 | 635 | |
956b4c75 | 636 | uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation |
567a9e6f | 637 | |
d1080823 | 638 | install_sw: install_dev install_engines install_modules install_runtime ## Install just the software and libraries |
567a9e6f | 639 | |
d1080823 | 640 | uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev ## Uninstall the software and libraries |
567a9e6f | 641 | |
d1080823 | 642 | install_docs: install_man_docs install_html_docs ## Install manpages and HTML documentation |
567a9e6f | 643 | |
d1080823 | 644 | uninstall_docs: uninstall_man_docs uninstall_html_docs ## Uninstall manpages and HTML documentation |
49918414 | 645 | $(RM) -r "$(DESTDIR)$(DOCDIR)" |
567a9e6f | 646 | |
18da9fc3 | 647 | {- output_off() if $disabled{fips}; "" -} |
f5657ce8 | 648 | install_fips: build_sw $(INSTALL_FIPSMODULECONF) |
5b689181 | 649 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
49918414 JM |
650 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)" |
651 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)" | |
5b689181 | 652 | @$(ECHO) "*** Installing FIPS module" |
f5657ce8 | 653 | @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)" |
49918414 JM |
654 | @cp "$(INSTALL_FIPSMODULE)" "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" |
655 | @chmod 755 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" | |
656 | @mv -f "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" \ | |
657 | "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)" | |
a1bfcb15 | 658 | @$(ECHO) "*** Installing FIPS module configuration" |
f5657ce8 | 659 | @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf" |
49918414 | 660 | @cp $(INSTALL_FIPSMODULECONF) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf" |
a1bfcb15 | 661 | |
5b689181 | 662 | uninstall_fips: |
a1bfcb15 | 663 | @$(ECHO) "*** Uninstalling FIPS module configuration" |
49918414 | 664 | $(RM) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf" |
5b689181 | 665 | @$(ECHO) "*** Uninstalling FIPS module" |
49918414 | 666 | $(RM) "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)" |
18da9fc3 DMSP |
667 | {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -} |
668 | install_fips: | |
669 | @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option" | |
670 | ||
671 | uninstall_fips: | |
672 | @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option" | |
673 | {- output_on() if !$disabled{fips}; "" -} | |
674 | ||
a1bfcb15 | 675 | |
dde10ab4 | 676 | install_ssldirs: |
49918414 JM |
677 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs" |
678 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private" | |
679 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc" | |
4813ad2d RL |
680 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
681 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
d8356e1b RL |
682 | x1=`echo "$$x" | cut -f1 -d:`; \ |
683 | x2=`echo "$$x" | cut -f2 -d:`; \ | |
684 | fn=`basename $$x1`; \ | |
685 | $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
49918414 JM |
686 | cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ |
687 | chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ | |
688 | mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \ | |
689 | "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
d8356e1b RL |
690 | if [ "$$x1" != "$$x2" ]; then \ |
691 | ln=`basename "$$x2"`; \ | |
692 | : {- output_off() unless windowsdll(); "" -}; \ | |
693 | $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
49918414 | 694 | cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ |
d8356e1b RL |
695 | : {- output_on() unless windowsdll(); |
696 | output_off() if windowsdll(); "" -}; \ | |
697 | $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
49918414 | 698 | ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ |
d8356e1b RL |
699 | : {- output_on() if windowsdll(); "" -}; \ |
700 | fi; \ | |
4813ad2d | 701 | done |
5407338a | 702 | @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" |
49918414 JM |
703 | @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" |
704 | @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" | |
705 | @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" | |
c7af65c7 | 706 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ |
5407338a | 707 | $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ |
49918414 JM |
708 | cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ |
709 | chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ | |
cb926df2 | 710 | fi |
5407338a | 711 | @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" |
49918414 JM |
712 | @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" |
713 | @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" | |
714 | @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" | |
c7af65c7 | 715 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ |
5407338a | 716 | $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ |
49918414 JM |
717 | cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ |
718 | chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ | |
c7af65c7 | 719 | fi |
dde10ab4 | 720 | |
c1123d9f | 721 | install_dev: install_runtime_libs |
567a9e6f | 722 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
5407338a | 723 | @$(ECHO) "*** Installing development files" |
49918414 | 724 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl" |
6d56fcd8 | 725 | @ : {- output_off() if $disabled{uplink}; "" -} |
5407338a | 726 | @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
49918414 JM |
727 | @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
728 | @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" | |
6d56fcd8 | 729 | @ : {- output_on() if $disabled{uplink}; "" -} |
567a9e6f RL |
730 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
731 | $(BLDDIR)/include/openssl/*.h; do \ | |
732 | fn=`basename $$i`; \ | |
5407338a | 733 | $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
49918414 JM |
734 | cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
735 | chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ | |
567a9e6f | 736 | done |
49918414 | 737 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" |
0f01b7bc | 738 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 739 | fn=`basename $$l`; \ |
e454f3ad | 740 | $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ |
49918414 JM |
741 | cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \ |
742 | $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \ | |
743 | chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \ | |
744 | mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ | |
745 | "$(DESTDIR)$(libdir)/$$fn"; \ | |
567a9e6f | 746 | done |
84af1bae | 747 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 748 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
749 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
750 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
ef161e7b | 751 | s3=`echo "$$s" | cut -f3 -d";"`; \ |
d9c22dde RL |
752 | fn1=`basename "$$s1"`; \ |
753 | fn2=`basename "$$s2"`; \ | |
754 | fn3=`basename "$$s3"`; \ | |
cff89b17 | 755 | : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ |
ef161e7b | 756 | if [ "$$fn2" != "" ]; then \ |
e454f3ad | 757 | $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ |
49918414 | 758 | ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \ |
567a9e6f | 759 | fi; \ |
cff89b17 | 760 | : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ |
d9c22dde RL |
761 | if [ "$$fn3" != "" ]; then \ |
762 | $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \ | |
49918414 JM |
763 | cp $$s3 "$(DESTDIR)$(libdir)/$$fn3.new"; \ |
764 | chmod 755 "$(DESTDIR)$(libdir)/$$fn3.new"; \ | |
765 | mv -f "$(DESTDIR)$(libdir)/$$fn3.new" \ | |
766 | "$(DESTDIR)$(libdir)/$$fn3"; \ | |
d9c22dde | 767 | fi; \ |
cff89b17 | 768 | : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ |
49918414 | 769 | a="$(DESTDIR)$(libdir)/$$fn2"; \ |
cff89b17 AP |
770 | $(ECHO) "install $$s1 -> $$a"; \ |
771 | if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ | |
772 | mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ | |
773 | cp -f $$a $$a.new; \ | |
774 | for so in `$(AR) t $$a`; do \ | |
775 | $(AR) x $$a $$so; \ | |
776 | chmod u+w $$so; \ | |
777 | strip -X32_64 -e $$so; \ | |
778 | $(AR) r $$a.new $$so; \ | |
779 | done; \ | |
780 | )); fi; \ | |
781 | $(AR) r $$a.new $$s1; \ | |
782 | mv -f $$a.new $$a; \ | |
783 | : {- output_off() if sharedaix(); output_on(); "" -}; \ | |
567a9e6f | 784 | done |
84af1bae | 785 | @ : {- output_on() if $disabled{shared}; "" -} |
2ac569a6 RL |
786 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(PKGCONFIGDIR)" |
787 | @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \ | |
788 | fn=`basename $$e`; \ | |
789 | $(ECHO) "install $$e -> $(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ | |
790 | cp $$e "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ | |
791 | chmod 644 "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ | |
792 | done | |
567a9e6f | 793 | |
c1123d9f | 794 | uninstall_dev: uninstall_runtime_libs |
5407338a | 795 | @$(ECHO) "*** Uninstalling development files" |
6d56fcd8 | 796 | @ : {- output_off() if $disabled{uplink}; "" -} |
5407338a | 797 | @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
49918414 | 798 | @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
6d56fcd8 | 799 | @ : {- output_on() if $disabled{uplink}; "" -} |
567a9e6f RL |
800 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
801 | $(BLDDIR)/include/openssl/*.h; do \ | |
802 | fn=`basename $$i`; \ | |
5407338a | 803 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
49918414 | 804 | $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
567a9e6f | 805 | done |
49918414 JM |
806 | -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl" |
807 | -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include" | |
0f01b7bc | 808 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 809 | fn=`basename $$l`; \ |
e454f3ad | 810 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ |
49918414 | 811 | $(RM) "$(DESTDIR)$(libdir)/$$fn"; \ |
567a9e6f | 812 | done |
84af1bae | 813 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 814 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
815 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
816 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
ef161e7b | 817 | s3=`echo "$$s" | cut -f3 -d";"`; \ |
d9c22dde RL |
818 | fn1=`basename "$$s1"`; \ |
819 | fn2=`basename "$$s2"`; \ | |
820 | fn3=`basename "$$s3"`; \ | |
c8c2b779 | 821 | : {- output_off() if windowsdll(); "" -}; \ |
ef161e7b | 822 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ |
49918414 | 823 | $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \ |
ef161e7b RL |
824 | if [ -n "$$fn2" ]; then \ |
825 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ | |
49918414 | 826 | $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ |
567a9e6f | 827 | fi; \ |
c8c2b779 | 828 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
d9c22dde RL |
829 | if [ -n "$$fn3" ]; then \ |
830 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \ | |
49918414 | 831 | $(RM) "$(DESTDIR)$(libdir)/$$fn3"; \ |
d9c22dde | 832 | fi; \ |
ce5ed82f | 833 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 834 | done |
c8cca980 | 835 | @ : {- output_on() if $disabled{shared}; "" -} |
2ac569a6 RL |
836 | @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \ |
837 | fn=`basename "$$e"`; \ | |
838 | $(RM) "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ | |
839 | done | |
840 | -$(RMDIR) "$(DESTDIR)$(PKGCONFIGDIR)" | |
49918414 | 841 | -$(RMDIR) "$(DESTDIR)$(libdir)" |
567a9e6f | 842 | |
41149648 RL |
843 | _install_modules_deps: install_runtime_libs build_modules |
844 | ||
845 | install_engines: _install_modules_deps | |
567a9e6f | 846 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
49918414 | 847 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/" |
41149648 | 848 | @$(ECHO) "*** Installing engines" |
0f01b7bc | 849 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 850 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 851 | fn=`basename $$e`; \ |
5407338a | 852 | $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
49918414 JM |
853 | cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ |
854 | chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ | |
855 | mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \ | |
856 | "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ | |
567a9e6f RL |
857 | done |
858 | ||
859 | uninstall_engines: | |
41149648 | 860 | @$(ECHO) "*** Uninstalling engines" |
0f01b7bc | 861 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 862 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 863 | fn=`basename $$e`; \ |
5407338a | 864 | $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
49918414 | 865 | $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
567a9e6f | 866 | done |
49918414 | 867 | -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)" |
567a9e6f | 868 | |
41149648 RL |
869 | install_modules: _install_modules_deps |
870 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
49918414 | 871 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/" |
41149648 RL |
872 | @$(ECHO) "*** Installing modules" |
873 | @set -e; for e in dummy $(INSTALL_MODULES); do \ | |
874 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
875 | fn=`basename $$e`; \ | |
876 | $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \ | |
49918414 JM |
877 | cp $$e "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \ |
878 | chmod 755 "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \ | |
879 | mv -f "$(DESTDIR)$(MODULESDIR)/$$fn.new" \ | |
880 | "$(DESTDIR)$(MODULESDIR)/$$fn"; \ | |
41149648 RL |
881 | done |
882 | ||
883 | uninstall_modules: | |
884 | @$(ECHO) "*** Uninstalling modules" | |
885 | @set -e; for e in dummy $(INSTALL_MODULES); do \ | |
886 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
887 | fn=`basename $$e`; \ | |
41149648 | 888 | $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \ |
49918414 | 889 | $(RM) "$(DESTDIR)$(MODULESDIR)/$$fn"; \ |
41149648 | 890 | done |
49918414 | 891 | -$(RMDIR) "$(DESTDIR)$(MODULESDIR)" |
41149648 | 892 | |
c1123d9f RL |
893 | install_runtime: install_programs |
894 | ||
e8d01a60 | 895 | install_runtime_libs: build_libs |
567a9e6f | 896 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
36b53720 | 897 | @ : {- output_off() if windowsdll(); "" -} |
49918414 | 898 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" |
9694ebf7 | 899 | @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} |
49918414 | 900 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)/" |
9694ebf7 | 901 | @ : {- output_on() unless windowsdll(); "" -} |
c1123d9f | 902 | @$(ECHO) "*** Installing runtime libraries" |
0f01b7bc | 903 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 904 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 905 | fn=`basename $$s`; \ |
36b53720 | 906 | : {- output_off() unless windowsdll(); "" -}; \ |
d793a325 | 907 | $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \ |
49918414 JM |
908 | cp $$s "$(DESTDIR)$(bindir)/$$fn.new"; \ |
909 | chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \ | |
910 | mv -f "$(DESTDIR)$(bindir)/$$fn.new" \ | |
911 | "$(DESTDIR)$(bindir)/$$fn"; \ | |
36b53720 | 912 | : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ |
e454f3ad | 913 | $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ |
49918414 JM |
914 | cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \ |
915 | chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \ | |
916 | mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ | |
917 | "$(DESTDIR)$(libdir)/$$fn"; \ | |
36b53720 | 918 | : {- output_on() if windowsdll(); "" -}; \ |
fcf80c46 | 919 | done |
c1123d9f | 920 | |
e8d01a60 | 921 | install_programs: install_runtime_libs build_programs |
c1123d9f | 922 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
49918414 | 923 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)" |
c1123d9f | 924 | @$(ECHO) "*** Installing runtime programs" |
0f01b7bc | 925 | @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ |
2b364f61 | 926 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 927 | fn=`basename $$x`; \ |
d793a325 | 928 | $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \ |
49918414 JM |
929 | cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \ |
930 | chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \ | |
931 | mv -f "$(DESTDIR)$(bindir)/$$fn.new" \ | |
932 | "$(DESTDIR)$(bindir)/$$fn"; \ | |
567a9e6f | 933 | done |
2b364f61 RL |
934 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
935 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 936 | fn=`basename $$x`; \ |
d793a325 | 937 | $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \ |
49918414 JM |
938 | cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \ |
939 | chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \ | |
940 | mv -f "$(DESTDIR)$(bindir)/$$fn.new" \ | |
941 | "$(DESTDIR)$(bindir)/$$fn"; \ | |
567a9e6f | 942 | done |
567a9e6f | 943 | |
c1123d9f RL |
944 | uninstall_runtime: uninstall_programs uninstall_runtime_libs |
945 | ||
946 | uninstall_programs: | |
947 | @$(ECHO) "*** Uninstalling runtime programs" | |
0f01b7bc | 948 | @set -e; for x in dummy $(INSTALL_PROGRAMS); \ |
567a9e6f | 949 | do \ |
2b364f61 | 950 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 951 | fn=`basename $$x`; \ |
d793a325 | 952 | $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \ |
49918414 | 953 | $(RM) "$(DESTDIR)$(bindir)/$$fn"; \ |
567a9e6f | 954 | done; |
2b364f61 | 955 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 956 | do \ |
2b364f61 | 957 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 958 | fn=`basename $$x`; \ |
d793a325 | 959 | $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \ |
49918414 | 960 | $(RM) "$(DESTDIR)$(bindir)/$$fn"; \ |
567a9e6f | 961 | done |
49918414 | 962 | -$(RMDIR) "$(DESTDIR)$(bindir)" |
c1123d9f RL |
963 | |
964 | uninstall_runtime_libs: | |
965 | @$(ECHO) "*** Uninstalling runtime libraries" | |
b1837abd | 966 | @ : {- output_off() unless windowsdll(); "" -} |
0f01b7bc | 967 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 968 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 969 | fn=`basename $$s`; \ |
d793a325 | 970 | $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \ |
49918414 | 971 | $(RM) "$(DESTDIR)$(bindir)/$$fn"; \ |
fcf80c46 | 972 | done |
b1837abd | 973 | @ : {- output_on() unless windowsdll(); "" -} |
567a9e6f | 974 | |
567a9e6f | 975 | |
b0940b33 | 976 | install_man_docs: build_man_docs |
567a9e6f | 977 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
49918414 JM |
978 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man1" |
979 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man3" | |
980 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man5" | |
981 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man7" | |
5407338a | 982 | @$(ECHO) "*** Installing manpages" |
b0940b33 RL |
983 | @set -e; for x in dummy $(MANDOCS1); do \ |
984 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
985 | fn=`basename $$x`; \ | |
cf86057a | 986 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
987 | cp $$x "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
988 | chmod 644 "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ | |
989 | $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \ | |
b0940b33 RL |
990 | done |
991 | @set -e; for x in dummy $(MANDOCS3); do \ | |
992 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
993 | fn=`basename $$x`; \ | |
cf86057a | 994 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
995 | cp $$x "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
996 | chmod 644 "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ | |
997 | $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \ | |
b0940b33 RL |
998 | done |
999 | @set -e; for x in dummy $(MANDOCS5); do \ | |
1000 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1001 | fn=`basename $$x`; \ | |
cf86057a | 1002 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
1003 | cp $$x "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
1004 | chmod 644 "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ | |
1005 | $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \ | |
b0940b33 RL |
1006 | done |
1007 | @set -e; for x in dummy $(MANDOCS7); do \ | |
1008 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1009 | fn=`basename $$x`; \ | |
cf86057a | 1010 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
1011 | cp $$x "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
1012 | chmod 644 "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ | |
1013 | $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \ | |
b0940b33 | 1014 | done |
567a9e6f | 1015 | |
9e7a6411 | 1016 | uninstall_man_docs: build_man_docs |
5407338a | 1017 | @$(ECHO) "*** Uninstalling manpages" |
b0940b33 RL |
1018 | @set -e; for x in dummy $(MANDOCS1); do \ |
1019 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1020 | fn=`basename $$x`; \ | |
cf86057a | 1021 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
1022 | $(RM) "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
1023 | $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \ | |
b0940b33 RL |
1024 | done |
1025 | @set -e; for x in dummy $(MANDOCS3); do \ | |
1026 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1027 | fn=`basename $$x`; \ | |
cf86057a | 1028 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
1029 | $(RM) "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
1030 | $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \ | |
b0940b33 RL |
1031 | done |
1032 | @set -e; for x in dummy $(MANDOCS5); do \ | |
1033 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1034 | fn=`basename $$x`; \ | |
cf86057a | 1035 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
1036 | $(RM) "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
1037 | $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \ | |
b0940b33 RL |
1038 | done |
1039 | @set -e; for x in dummy $(MANDOCS7); do \ | |
1040 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1041 | fn=`basename $$x`; \ | |
cf86057a | 1042 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
49918414 JM |
1043 | $(RM) "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
1044 | $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \ | |
b0940b33 | 1045 | done |
567a9e6f | 1046 | |
06621ba3 | 1047 | install_html_docs: install_image_docs build_html_docs |
567a9e6f | 1048 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
49918414 JM |
1049 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man1" |
1050 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man3" | |
1051 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man5" | |
1052 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7" | |
5407338a | 1053 | @$(ECHO) "*** Installing HTML manpages" |
b0940b33 RL |
1054 | @set -e; for x in dummy $(HTMLDOCS1); do \ |
1055 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1056 | fn=`basename $$x`; \ | |
1057 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
49918414 JM |
1058 | cp $$x "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ |
1059 | chmod 644 "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
b0940b33 RL |
1060 | done |
1061 | @set -e; for x in dummy $(HTMLDOCS3); do \ | |
1062 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1063 | fn=`basename $$x`; \ | |
1064 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
49918414 JM |
1065 | cp $$x "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ |
1066 | chmod 644 "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
b0940b33 RL |
1067 | done |
1068 | @set -e; for x in dummy $(HTMLDOCS5); do \ | |
1069 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1070 | fn=`basename $$x`; \ | |
1071 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
49918414 JM |
1072 | cp $$x "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ |
1073 | chmod 644 "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
b0940b33 RL |
1074 | done |
1075 | @set -e; for x in dummy $(HTMLDOCS7); do \ | |
1076 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1077 | fn=`basename $$x`; \ | |
1078 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
49918414 JM |
1079 | cp $$x "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ |
1080 | chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
b0940b33 | 1081 | done |
567a9e6f | 1082 | |
06621ba3 | 1083 | uninstall_html_docs: uninstall_image_docs |
b0940b33 RL |
1084 | @$(ECHO) "*** Uninstalling HTML manpages" |
1085 | @set -e; for x in dummy $(HTMLDOCS1); do \ | |
1086 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1087 | fn=`basename $$x`; \ | |
1088 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
49918414 | 1089 | $(RM) "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ |
b0940b33 RL |
1090 | done |
1091 | @set -e; for x in dummy $(HTMLDOCS3); do \ | |
1092 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1093 | fn=`basename $$x`; \ | |
1094 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
49918414 | 1095 | $(RM) "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ |
b0940b33 RL |
1096 | done |
1097 | @set -e; for x in dummy $(HTMLDOCS5); do \ | |
1098 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1099 | fn=`basename $$x`; \ | |
1100 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
49918414 | 1101 | $(RM) "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ |
b0940b33 RL |
1102 | done |
1103 | @set -e; for x in dummy $(HTMLDOCS7); do \ | |
1104 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1105 | fn=`basename $$x`; \ | |
1106 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
49918414 | 1107 | $(RM) "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ |
b0940b33 | 1108 | done |
567a9e6f | 1109 | |
06621ba3 | 1110 | install_image_docs: |
49918414 | 1111 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7/img" |
06621ba3 P |
1112 | @set -e; for x in dummy $(IMAGEDOCS7); do \ |
1113 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1114 | fn=`basename $$x`; \ | |
1115 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ | |
49918414 JM |
1116 | cp $(SRCDIR)/$$x "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ |
1117 | chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ | |
06621ba3 P |
1118 | done |
1119 | ||
1120 | uninstall_image_docs: | |
06621ba3 P |
1121 | @set -e; for x in dummy $(IMAGEDOCS7); do \ |
1122 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1123 | fn=`basename $$x`; \ | |
1124 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ | |
49918414 | 1125 | $(RM) "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ |
06621ba3 P |
1126 | done |
1127 | ||
567a9e6f | 1128 | # Developer targets (note: these are only available on Unix) ######### |
eb4129e1 | 1129 | ##@ Code maintenance |
567a9e6f | 1130 | |
7b9f8995 RL |
1131 | # It's important that generate_buildinfo comes after ordinals, as ordinals |
1132 | # is sensitive to build.info changes. | |
d1080823 | 1133 | update: generate errors ordinals generate_buildinfo ## Update errors, ordinals and build info |
6bb2106e | 1134 | |
800869b8 DDO |
1135 | .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \ |
1136 | generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids | |
b7650c67 | 1137 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
8e32e1ab | 1138 | generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids |
567a9e6f | 1139 | |
800869b8 | 1140 | .PHONY: generate_buildinfo generate_doc_buildinfo |
7b9f8995 RL |
1141 | generate_buildinfo: generate_doc_buildinfo |
1142 | ||
5bac37cb | 1143 | .PHONY: doc-nits md-nits |
d1080823 | 1144 | doc-nits: build_generated_pods ## Evaluate OpenSSL documentation |
5bac37cb | 1145 | $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e |
65718c51 | 1146 | |
a51f225d RS |
1147 | # This uses "mdl", the markdownlint application, which is written in ruby. |
1148 | # The source is at https://github.com/markdownlint/markdownlint | |
1149 | # If you have ruby installed, "gem install mdl" should work. | |
1150 | # Another option is at https://snapcraft.io/install/mdl/debian | |
1151 | # Finally, there's a Node.js version, which we haven't tried, that | |
1152 | # can be found at https://github.com/DavidAnson/markdownlint | |
d1080823 | 1153 | md-nits: ## Evaluate markdown files via "mdl" |
0c74339c | 1154 | mdl -s $(SRCDIR)/util/markdownlint.rb . |
a51f225d | 1155 | |
567a9e6f RL |
1156 | # Test coverage is a good idea for the future |
1157 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
1158 | # ... | |
1159 | ||
dfb4efe0 | 1160 | .PHONY: lint |
d1080823 | 1161 | lint: ## Evaluate C code via "splint" |
dfb4efe0 DDO |
1162 | @( cd $(SRCDIR); \ |
1163 | echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \ | |
1164 | -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) ) | |
567a9e6f | 1165 | |
71beab84 | 1166 | .PHONY: check-format |
d1080823 | 1167 | check-format: ## Evaluate C code according to OpenSSL coding standards |
71beab84 DDO |
1168 | ( cd $(SRCDIR); $(PERL) util/check-format.pl \ |
1169 | $(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) ) | |
1170 | ||
800869b8 | 1171 | generate_apps: |
9a9f8ee7 RL |
1172 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ |
1173 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
9a9f8ee7 | 1174 | |
800869b8 | 1175 | generate_crypto_bn: |
9a9f8ee7 RL |
1176 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) |
1177 | ||
800869b8 | 1178 | generate_crypto_objects: |
22defb43 RS |
1179 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ |
1180 | crypto/objects/objects.txt \ | |
1181 | crypto/objects/obj_mac.num \ | |
1182 | > crypto/objects/obj_mac.new && \ | |
1183 | mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) | |
9a9f8ee7 RL |
1184 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
1185 | crypto/objects/objects.txt \ | |
1186 | crypto/objects/obj_mac.num \ | |
800869b8 DDO |
1187 | > include/openssl/obj_mac.h ) |
1188 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ | |
e6f2bb66 | 1189 | include/openssl/obj_mac.h \ |
800869b8 | 1190 | > crypto/objects/obj_dat.h ) |
9a9f8ee7 RL |
1191 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
1192 | crypto/objects/obj_mac.num \ | |
1193 | crypto/objects/obj_xref.txt \ | |
1194 | > crypto/objects/obj_xref.h ) | |
800869b8 | 1195 | ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h ) |
6bb2106e | 1196 | |
800869b8 | 1197 | generate_crypto_conf: |
b7650c67 RL |
1198 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ |
1199 | > crypto/conf/conf_def.h ) | |
1200 | ||
800869b8 | 1201 | generate_crypto_asn1: |
b7650c67 RL |
1202 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ |
1203 | > crypto/asn1/charmap.h ) | |
1204 | ||
800869b8 | 1205 | generate_fuzz_oids: |
8e32e1ab RL |
1206 | ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ |
1207 | crypto/objects/obj_dat.h \ | |
1208 | > fuzz/oids.txt ) | |
1209 | ||
7b9f8995 RL |
1210 | generate_doc_buildinfo: |
1211 | ( $(PERL) -I$(BLDDIR) -Mconfigdata \ | |
1212 | $(SRCDIR)/util/dofile.pl -o Makefile \ | |
5a6a6d59 RL |
1213 | $(SRCDIR)/doc/build.info.in \ |
1214 | > $(SRCDIR)/doc/build.info.new; \ | |
1215 | if ( test -e $(SRCDIR)/doc/build.info \ | |
1216 | && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \ | |
1217 | > /dev/null ); \ | |
1218 | then \ | |
1219 | rm $(SRCDIR)/doc/build.info.new; \ | |
1220 | else \ | |
1221 | mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \ | |
1222 | fi ) | |
7b9f8995 | 1223 | |
91a05d65 | 1224 | generate_fips_sources: providers/fips.module.sources.new |
32eebfa2 | 1225 | providers/fips.module.sources.new: configdata.pm |
27ca03ea RL |
1226 | rm -rf sources-tmp |
1227 | mkdir sources-tmp | |
1228 | ( \ | |
1229 | srcdir=`cd $(SRCDIR); pwd`; \ | |
1230 | cd sources-tmp \ | |
969fdad7 | 1231 | && $$srcdir/Configure --banner=Configured enable-fips -O0 \ |
27ca03ea | 1232 | && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \ |
f870a1f8 | 1233 | && $(MAKE) -sj 4 build_generated providers/fips.so \ |
57bd5fc7 | 1234 | && find . -name '*.d' | xargs cat > dep1 \ |
969fdad7 P |
1235 | && $(MAKE) distclean \ |
1236 | && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \ | |
27ca03ea | 1237 | && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \ |
f870a1f8 | 1238 | && $(MAKE) -sj 4 build_generated providers/fips.so \ |
57bd5fc7 | 1239 | && find . -name '*.d' | xargs cat > dep2 \ |
969fdad7 P |
1240 | && cat sources1 sources2 \ |
1241 | | grep -v ' : \\$$' | grep -v util/providers.num \ | |
57bd5fc7 | 1242 | | sed -e 's/^ *//' -e 's/ *\\$$//' \ |
969fdad7 | 1243 | | sort | uniq > sources \ |
57bd5fc7 RL |
1244 | && cat dep1 dep2 \ |
1245 | | $(PERL) -p -e 's/\\\n//' \ | |
1246 | | sed -e 's/^.*: *//' -e 's/ */ /g' \ | |
1247 | | fgrep -f sources \ | |
1248 | | tr ' ' '\n' \ | |
1249 | | sort | uniq > deps.raw \ | |
1250 | && cat deps.raw \ | |
1251 | | xargs ./configdata.pm --query 'get_sources(@ARGV)' \ | |
1252 | | $(PERL) -p -e 's/\\\n//' \ | |
1253 | | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \ | |
1254 | > deps.sed \ | |
1255 | && cat deps.raw | sed -f deps.sed > deps \ | |
27ca03ea RL |
1256 | ) |
1257 | ( \ | |
57bd5fc7 RL |
1258 | cat sources-tmp/sources sources-tmp/deps \ |
1259 | | $(PERL) -p -e 's:^ *\Q../\E:: ;' \ | |
1260 | -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \ | |
1261 | -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \ | |
27ca03ea RL |
1262 | cd $(SRCDIR); \ |
1263 | for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \ | |
1264 | crypto/aes/asm/*.pl crypto/aes/asm/*.S \ | |
1265 | crypto/ec/asm/*.pl \ | |
27ca03ea | 1266 | crypto/modes/asm/*.pl \ |
969fdad7 | 1267 | crypto/sha/asm/*.pl \ |
c509c040 TM |
1268 | crypto/*cpuid.pl crypto/*cpuid.S \ |
1269 | crypto/*cap.c; do \ | |
27ca03ea RL |
1270 | echo "$$x"; \ |
1271 | done \ | |
b07a0b1a | 1272 | ) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new |
27ca03ea | 1273 | rm -rf sources-tmp |
27ca03ea | 1274 | |
52df25cf RS |
1275 | # Set to -force to force a rebuild |
1276 | ERROR_REBUILD= | |
567a9e6f | 1277 | errors: |
aa6cc8d3 RL |
1278 | ( b=`pwd`; set -e; cd $(SRCDIR); \ |
1279 | $(PERL) util/ck_errf.pl -strict -internal; \ | |
cb7b7275 | 1280 | $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) |
aa6cc8d3 | 1281 | ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ |
52df25cf | 1282 | for E in *.ec ; do \ |
aa6cc8d3 RL |
1283 | $(PERL) ../util/ck_errf.pl -strict \ |
1284 | -conf $$E `basename $$E .ec`.c; \ | |
cb7b7275 | 1285 | $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ |
52df25cf RS |
1286 | -conf $$E `basename $$E .ec`.c ; \ |
1287 | done ) | |
567a9e6f | 1288 | |
30699aa1 RL |
1289 | {- use File::Basename; |
1290 | ||
96296339 | 1291 | my @sslheaders_tmpl = |
30699aa1 RL |
1292 | qw( include/openssl/ssl.h |
1293 | include/openssl/ssl2.h | |
1294 | include/openssl/ssl3.h | |
1295 | include/openssl/sslerr.h | |
1296 | include/openssl/tls1.h | |
1297 | include/openssl/dtls1.h | |
f5a46ed7 | 1298 | include/openssl/srtp.h |
770ea54b | 1299 | include/openssl/quic.h |
f5a46ed7 | 1300 | include/openssl/sslerr_legacy.h ); |
96296339 | 1301 | my @cryptoheaders_tmpl = |
30699aa1 RL |
1302 | qw( include/internal/dso.h |
1303 | include/internal/o_dir.h | |
30699aa1 | 1304 | include/internal/err.h |
c2041da8 | 1305 | include/internal/evp.h |
16feca71 RL |
1306 | include/internal/pem.h |
1307 | include/internal/asn1.h | |
30699aa1 | 1308 | include/internal/sslconf.h ); |
96296339 | 1309 | my @cryptoskipheaders = ( @sslheaders_tmpl, |
fda21497 DDO |
1310 | qw( include/openssl/asn1_mac.h |
1311 | include/openssl/conf_api.h | |
30699aa1 RL |
1312 | include/openssl/ebcdic.h |
1313 | include/openssl/opensslconf.h | |
1314 | include/openssl/symhacks.h ) ); | |
5d942028 RL |
1315 | our %cryptoheaders = (); |
1316 | our %sslheaders = (); | |
96296339 RL |
1317 | foreach my $d ( qw( include/openssl include/internal ) ) { |
1318 | my @header_patterns = | |
1319 | map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' ); | |
1320 | foreach my $f ( map { glob($_) } @header_patterns ) { | |
1321 | my $base = basename($f); | |
1322 | my $base_in = basename($f, '.in'); | |
1323 | my $dir = catfile($config{sourcedir}, $d); | |
1324 | if ($base ne $base_in) { | |
1325 | # We have a .h.in file, which means the header file is in the | |
1326 | # build tree. | |
1327 | $base = $base_in; | |
1328 | $dir = catfile($config{builddir}, $d); | |
1329 | } | |
1330 | my $new_f = catfile($dir, $base); | |
1331 | my $fn = "$d/$base"; | |
1332 | # The logic to add files to @cryptoheaders is a bit complex. The | |
1333 | # file to be added must be either in the public header directory | |
1334 | # or one of the pre-declared internal headers, and must under no | |
1335 | # circumstances be one of those that must be skipped. | |
5d942028 | 1336 | $cryptoheaders{$new_f} = 1 |
96296339 RL |
1337 | if (($d eq 'include/openssl' |
1338 | || ( grep { $_ eq $fn } @cryptoheaders_tmpl )) | |
1339 | && !( grep { $_ eq $fn } @cryptoskipheaders )); | |
1340 | # The logic to add files to @sslheaders is much simpler... | |
5d942028 | 1341 | $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl; |
96296339 | 1342 | } |
30699aa1 RL |
1343 | } |
1344 | ""; | |
1345 | -} | |
67e0735f DDO |
1346 | SRCS={- |
1347 | sub uniq { my %seen; grep !$seen{$_}++, @_; } | |
1348 | sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; } | |
1349 | join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5, | |
1350 | uniq(grep /\.(c|cc|cpp)$/, | |
1351 | flat (map { $unified_info{sources}->{$_} } | |
1352 | (sort keys %{$unified_info{sources}}))))) | |
1353 | -} | |
c00d9311 | 1354 | CRYPTOHEADERS={- join(" \\\n" . ' ' x 14, |
5d942028 | 1355 | fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -} |
c00d9311 | 1356 | SSLHEADERS={- join(" \\\n" . ' ' x 11, |
5d942028 | 1357 | fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -} |
6ee47412 MC |
1358 | |
1359 | renumber: build_generated | |
435981cb | 1360 | $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ |
6ee47412 MC |
1361 | --ordinals $(SRCDIR)/util/libcrypto.num \ |
1362 | --symhacks $(SRCDIR)/include/openssl/symhacks.h \ | |
1363 | --renumber \ | |
1364 | $(CRYPTOHEADERS) | |
435981cb | 1365 | $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ |
6ee47412 MC |
1366 | --ordinals $(SRCDIR)/util/libssl.num \ |
1367 | --symhacks $(SRCDIR)/include/openssl/symhacks.h \ | |
1368 | --renumber \ | |
1369 | $(SSLHEADERS) | |
1370 | ||
0e55c3ab | 1371 | $(SRCDIR)/util/libcrypto.num: $(CRYPTOHEADERS) $(SRCDIR)/include/openssl/symhacks.h |
435981cb | 1372 | $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ |
96296339 RL |
1373 | --ordinals $(SRCDIR)/util/libcrypto.num \ |
1374 | --symhacks $(SRCDIR)/include/openssl/symhacks.h \ | |
1375 | $(CRYPTOHEADERS) | |
0e55c3ab | 1376 | $(SRCDIR)/util/libssl.num: $(SSLHEADERS) $(SRCDIR)/include/openssl/symhacks.h |
435981cb | 1377 | $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ |
96296339 RL |
1378 | --ordinals $(SRCDIR)/util/libssl.num \ |
1379 | --symhacks $(SRCDIR)/include/openssl/symhacks.h \ | |
1380 | $(SSLHEADERS) | |
0e55c3ab DDO |
1381 | .PHONY: ordinals |
1382 | ordinals: build_generated $(SRCDIR)/util/libcrypto.num $(SRCDIR)/util/libssl.num | |
567a9e6f RL |
1383 | |
1384 | test_ordinals: | |
c612c7a4 | 1385 | $(MAKE) run_tests TESTS=test_ordinals |
567a9e6f RL |
1386 | |
1387 | tags TAGS: FORCE | |
1388 | rm -f TAGS tags | |
2a6a0440 | 1389 | -( cd $(SRCDIR); util/ctags.sh ) |
567a9e6f RL |
1390 | -etags `find . -name '*.[ch]' -o -name '*.pm'` |
1391 | ||
a3c86ce9 | 1392 | providers/fips.checksum.new: providers/fips.module.sources.new |
f3b1e348 TM |
1393 | @which unifdef > /dev/null || \ |
1394 | ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \ | |
1395 | false ) | |
91a05d65 | 1396 | ( sources=`pwd`/providers/fips.module.sources.new; \ |
f3b1e348 TM |
1397 | cd $(SRCDIR) \ |
1398 | && cat $$sources \ | |
1399 | | xargs ./util/fips-checksums.sh ) \ | |
91a05d65 TM |
1400 | > providers/fips-sources.checksums.new \ |
1401 | && sha256sum providers/fips-sources.checksums.new \ | |
8f3683cd TM |
1402 | | sed -e 's|\.new||' > providers/fips.checksum.new |
1403 | ||
1404 | fips-checksums: providers/fips.checksum.new | |
f3b1e348 | 1405 | |
91a05d65 TM |
1406 | $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new |
1407 | cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources | |
1408 | cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums | |
1409 | cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum | |
f3b1e348 TM |
1410 | |
1411 | update-fips-checksums: $(SRCDIR)/providers/fips.checksum | |
be223152 | 1412 | |
8e782e8b | 1413 | diff-fips-checksums: fips-checksums |
91a05d65 TM |
1414 | diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new |
1415 | diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new | |
1416 | diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new | |
8e782e8b | 1417 | |
567a9e6f RL |
1418 | # Release targets (note: only available on Unix) ##################### |
1419 | ||
1420 | tar: | |
b741f153 | 1421 | (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') |
567a9e6f RL |
1422 | |
1423 | # Helper targets ##################################################### | |
1424 | ||
0eed845c | 1425 | link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf |
567a9e6f | 1426 | |
468d1517 | 1427 | $(BLDDIR)/util/opensslwrap.sh: Makefile |
567a9e6f RL |
1428 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
1429 | mkdir -p "$(BLDDIR)/util"; \ | |
c3845ceb | 1430 | ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \ |
567a9e6f | 1431 | fi |
342a1a23 | 1432 | |
468d1517 | 1433 | $(BLDDIR)/apps/openssl.cnf: Makefile |
3ab736ac DMSP |
1434 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
1435 | mkdir -p "$(BLDDIR)/apps"; \ | |
1436 | ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \ | |
1437 | fi | |
1438 | ||
c058fcd7 | 1439 | FORCE: |
567a9e6f RL |
1440 | |
1441 | # Building targets ################################################### | |
1442 | ||
468d1517 RL |
1443 | Makefile: configdata.pm \ |
1444 | {- join(" \\\n" . ' ' x 10, | |
1445 | fill_lines(" ", $COLUMNS - 10, | |
1446 | @{$config{build_file_templates}})) -} | |
1447 | @echo "Detected changed: $?" | |
1448 | $(PERL) configdata.pm | |
1449 | @echo "**************************************************" | |
1450 | @echo "*** ***" | |
1451 | @echo "*** Please run the same make command again ***" | |
1452 | @echo "*** ***" | |
1453 | @echo "**************************************************" | |
1454 | @false | |
1455 | ||
c00d9311 RL |
1456 | configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \ |
1457 | {- join(" \\\n" . ' ' x 15, | |
1458 | fill_lines(" ", $COLUMNS - 15, | |
c00d9311 RL |
1459 | @{$config{build_infos}}, |
1460 | @{$config{conf_files}})) -} | |
27f42b46 | 1461 | @echo "Detected changed: $?" |
a1b6933e | 1462 | $(PERL) configdata.pm -r |
567a9e6f RL |
1463 | @echo "**************************************************" |
1464 | @echo "*** ***" | |
1465 | @echo "*** Please run the same make command again ***" | |
1466 | @echo "*** ***" | |
1467 | @echo "**************************************************" | |
1468 | @false | |
1469 | ||
bf01fbbf | 1470 | reconfigure reconf: |
a1b6933e | 1471 | $(PERL) configdata.pm -r |
bf01fbbf | 1472 | |
567a9e6f RL |
1473 | {- |
1474 | use File::Basename; | |
1475 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 | 1476 | |
6dd07a93 RL |
1477 | # Helper function to convert dependencies in platform agnostic form to |
1478 | # dependencies in platform form. | |
1479 | sub compute_platform_depends { | |
1480 | map { my $x = $_; | |
1481 | ||
1482 | grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x) | |
1483 | or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x) | |
1484 | or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x) | |
1485 | or platform->convertext($x); } @_; | |
1486 | } | |
1487 | ||
cedbb146 RL |
1488 | # Helper function to figure out dependencies on libraries |
1489 | # It takes a list of library names and outputs a list of dependencies | |
1490 | sub compute_lib_depends { | |
cedbb146 RL |
1491 | # Depending on shared libraries: |
1492 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
1493 | # On Unix platforms, we depend on {shlibname}.so | |
ef161e7b RL |
1494 | return map { platform->sharedlib_simple($_) |
1495 | // platform->sharedlib_import($_) | |
f159b83a | 1496 | // platform->sharedlib($_) |
ef161e7b RL |
1497 | // platform->staticlib($_) |
1498 | } @_; | |
cedbb146 RL |
1499 | } |
1500 | ||
3f399e37 RL |
1501 | sub generatetarget { |
1502 | my %args = @_; | |
6dd07a93 | 1503 | my $deps = join(" ", compute_platform_depends(@{$args{deps}})); |
3f399e37 RL |
1504 | return <<"EOF"; |
1505 | $args{target}: $deps | |
1506 | EOF | |
1507 | } | |
1508 | ||
66ddf178 RL |
1509 | sub generatesrc { |
1510 | my %args = @_; | |
79f47ef5 RL |
1511 | my $gen0 = $args{generator}->[0]; |
1512 | my $gen_args = join('', map { " $_" } | |
1513 | @{$args{generator}}[1..$#{$args{generator}}]); | |
1514 | my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); | |
d4605727 | 1515 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1516 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
6dd07a93 RL |
1517 | my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}}, |
1518 | @{$args{deps}})); | |
66ddf178 | 1519 | |
b0940b33 | 1520 | if ($args{src} =~ /\.html$/) { |
79f47ef5 RL |
1521 | # |
1522 | # HTML generator | |
1523 | # | |
1524 | my $title = basename($args{src}, ".html"); | |
1525 | my $pod = $gen0; | |
1526 | return <<"EOF"; | |
98706c5a | 1527 | $args{src}: $pod |
1ec45fab | 1528 | \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc" |
b0940b33 RL |
1529 | EOF |
1530 | } elsif ($args{src} =~ /\.(\d)$/) { | |
79f47ef5 RL |
1531 | # |
1532 | # Man-page generator | |
1533 | # | |
1534 | my $section = $1; | |
1535 | my $name = uc basename($args{src}, ".$section"); | |
1536 | my $pod = $gen0; | |
1537 | return <<"EOF"; | |
98706c5a | 1538 | $args{src}: $pod |
ae6f65ae | 1539 | pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\ |
1ec45fab | 1540 | --release=\$(VERSION) $pod >\$\@ |
b0940b33 RL |
1541 | EOF |
1542 | } elsif (platform->isdef($args{src})) { | |
79f47ef5 RL |
1543 | # |
1544 | # Linker script-ish generator | |
1545 | # | |
9dd4ed28 | 1546 | my $target = platform->def($args{src}); |
ef2dfc99 | 1547 | (my $mkdef_os = $target{shared_target}) =~ s|-shared$||; |
435981cb | 1548 | my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : ''; |
9dd4ed28 | 1549 | my $ord_name = $args{generator}->[1] || $args{product}; |
ef2dfc99 | 1550 | return <<"EOF"; |
79f47ef5 | 1551 | $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl |
e5f831a0 | 1552 | \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target |
7cae3864 | 1553 | EOF |
b8d3cf09 RL |
1554 | } elsif (platform->isasm($args{src}) |
1555 | || platform->iscppasm($args{src})) { | |
79f47ef5 RL |
1556 | # |
1557 | # Assembler generator | |
1558 | # | |
593d5c2f RL |
1559 | my $cppflags = { |
1560 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
1561 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
1562 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1563 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1564 | } -> {$args{intent}}; | |
1565 | ||
79f47ef5 RL |
1566 | my $generator; |
1567 | if ($gen0 =~ /\.pl$/) { | |
1568 | $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args | |
cf076a3f | 1569 | .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)'; |
79f47ef5 RL |
1570 | } elsif ($gen0 =~ /\.m4$/) { |
1571 | $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >' | |
1572 | } elsif ($gen0 =~ /\.S$/) { | |
8458f1bf RL |
1573 | $generator = undef; |
1574 | } else { | |
79f47ef5 | 1575 | die "Generator type for $args{src} unknown: $gen0\n"; |
8458f1bf RL |
1576 | } |
1577 | ||
1578 | if (defined($generator)) { | |
66ddf178 | 1579 | return <<"EOF"; |
79f47ef5 | 1580 | $args{src}: $gen0 $deps |
8458f1bf | 1581 | $generator \$@ |
66ddf178 | 1582 | EOF |
66ddf178 | 1583 | } |
8458f1bf | 1584 | return <<"EOF"; |
79f47ef5 RL |
1585 | $args{src}: $gen0 $deps |
1586 | \$(CC) $incs $cppflags $defs -E $gen0 | \\ | |
39199fb3 | 1587 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ |
79f47ef5 RL |
1588 | EOF |
1589 | } elsif ($gen0 =~ m|^.*\.in$|) { | |
1590 | # | |
1591 | # "dofile" generator (file.in -> file) | |
1592 | # | |
1593 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1594 | "util", "dofile.pl")), | |
1595 | rel2abs($config{builddir})); | |
b684ee2c RL |
1596 | my @perlmodules = (); |
1597 | my %perlmoduleincs = (); | |
1598 | my %perlmoduledeps = (); | |
1599 | foreach my $x (('configdata.pm', @{$args{deps}})) { | |
1600 | # Compute (i)nclusion directory, (m)odule name and (d)ependency | |
1601 | my $i, $m, $d; | |
1602 | if ($x =~ /\|/) { | |
1603 | $i = $`; | |
1604 | $d = $'; | |
1605 | ||
1606 | # Massage the module part to become a real perl module spec | |
1607 | $m = $d; | |
1608 | $m =~ s|\.pm$||; | |
1609 | # Directory specs are :: in perl package names | |
1610 | $m =~ s|/|::|g; | |
1611 | ||
1612 | # Full file name of the dependency | |
1613 | $d = catfile($i, $d) if $i; | |
1614 | } elsif ($x =~ /\.pm$/) { | |
1615 | $i = dirname($x); | |
1616 | $m = basename($x, '.pm'); | |
1617 | $d = $x; | |
1618 | } else { | |
1619 | # All other dependencies are simply collected | |
1620 | $d = $x; | |
1621 | } | |
1622 | push @perlmodules, '"-M'.$m.'"' if $m; | |
1623 | $perlmoduledeps{$d} = 1; | |
1624 | $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i; | |
1625 | } | |
1626 | ||
1627 | # Because of the special treatment of dependencies, we need to | |
1628 | # recompute $deps completely | |
1629 | my $deps | |
1630 | = join(" ", compute_platform_depends(@{$args{generator_deps}}, | |
1631 | sort keys %perlmoduledeps)); | |
1632 | my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules); | |
1633 | ||
79f47ef5 RL |
1634 | return <<"EOF"; |
1635 | $args{src}: $gen0 $deps | |
6dd07a93 | 1636 | \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@ |
79f47ef5 RL |
1637 | EOF |
1638 | } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) { | |
1639 | # | |
1640 | # Generic generator using OpenSSL programs | |
1641 | # | |
1642 | ||
6dd07a93 | 1643 | # Redo $gen0, to ensure that we have the proper extension where |
79f47ef5 RL |
1644 | # necessary. |
1645 | $gen0 = platform->bin($gen0); | |
92a979b4 | 1646 | # Use $(PERL) to execute wrap.pl directly to avoid calling env |
79f47ef5 RL |
1647 | return <<"EOF"; |
1648 | $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl | |
92a979b4 | 1649 | \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@ |
79f47ef5 RL |
1650 | EOF |
1651 | } else { | |
1652 | # | |
1653 | # Generic generator using Perl | |
1654 | # | |
1655 | return <<"EOF"; | |
1656 | $args{src}: $gen0 $deps | |
1657 | \$(PERL)$gen_incs $gen0$gen_args > \$@ | |
8458f1bf | 1658 | EOF |
66ddf178 RL |
1659 | } |
1660 | } | |
1661 | ||
bb26842d RL |
1662 | # Should one wonder about the end of the Perl snippet, it's because this |
1663 | # second regexp eats up line endings as well, if the removed path is the | |
1664 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 1665 | sub src2obj { |
567a9e6f | 1666 | my %args = @_; |
e805c2d6 | 1667 | my $obj = platform->convertext($args{obj}); |
9dd4ed28 | 1668 | my $dep = platform->dep($args{obj}); |
a23f0316 | 1669 | my @srcs = @{$args{srcs}}; |
8458f1bf RL |
1670 | my $srcs = join(" ", @srcs); |
1671 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 1672 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1673 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
722c9762 RL |
1674 | my $cmd; |
1675 | my $cmdflags; | |
1676 | my $cmdcompile; | |
81183680 RL |
1677 | if (grep /\.rc$/, @srcs) { |
1678 | $cmd = '$(RC)'; | |
1679 | $cmdflags = '$(RCFLAGS)'; | |
8c3bc594 | 1680 | $cmdcompile = ''; |
81183680 RL |
1681 | } elsif (grep /\.(cc|cpp)$/, @srcs) { |
1682 | $cmd = '$(CXX)'; | |
722c9762 RL |
1683 | $cmdcompile = ' -c'; |
1684 | $cmdflags = { | |
9dfc8680 | 1685 | shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1686 | lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
1687 | dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', | |
1688 | bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' | |
1689 | } -> {$args{intent}}; | |
7763472f | 1690 | } else { |
722c9762 RL |
1691 | $cmd = '$(CC)'; |
1692 | $cmdcompile = ' -c'; | |
1693 | $cmdflags = { | |
9dfc8680 | 1694 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1695 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
1696 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1697 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1698 | } -> {$args{intent}}; | |
7763472f | 1699 | } |
a23f0316 AP |
1700 | my $recipe; |
1701 | # extension-specific rules | |
1702 | if (grep /\.s$/, @srcs) { | |
1703 | $recipe .= <<"EOF"; | |
9dd4ed28 | 1704 | $obj: $deps |
a23f0316 | 1705 | $cmd $cmdflags -c -o \$\@ $srcs |
7e5b8b93 | 1706 | EOF |
a23f0316 | 1707 | } elsif (grep /\.S$/, @srcs) { |
f691578b | 1708 | # Originally there was multi-step rule with $(CC) -E file.S |
18d15882 AP |
1709 | # followed by $(CC) -c file.s. It compensated for one of |
1710 | # legacy platform compiler's inability to handle .S files. | |
1711 | # The platform is long discontinued by vendor so there is | |
1712 | # hardly a point to drag it along... | |
29eed3dd | 1713 | $recipe .= <<"EOF"; |
9dd4ed28 | 1714 | $obj: $deps |
25628ab2 | 1715 | $cmd $incs $defs $cmdflags -c -o \$\@ $srcs |
a23f0316 | 1716 | EOF |
2e535eb5 | 1717 | } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) { |
a23f0316 | 1718 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1719 | $obj: $deps |
1720 | $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs | |
1721 | \@touch $dep.tmp | |
1722 | \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\ | |
1723 | rm -f $dep.tmp; \\ | |
29b28eee | 1724 | else \\ |
9dd4ed28 | 1725 | mv $dep.tmp $dep; \\ |
987dbc7f | 1726 | fi |
29eed3dd | 1727 | EOF |
7e5b8b93 | 1728 | } else { |
29eed3dd | 1729 | $recipe .= <<"EOF"; |
9dd4ed28 | 1730 | $obj: $deps |
25628ab2 | 1731 | $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs |
567a9e6f | 1732 | EOF |
2e535eb5 | 1733 | if ($makedep_scheme eq 'makedepend') { |
7e5b8b93 | 1734 | $recipe .= <<"EOF"; |
c39785d4 | 1735 | \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ |
9dd4ed28 | 1736 | > $dep |
567a9e6f | 1737 | EOF |
7e5b8b93 | 1738 | } |
29eed3dd RL |
1739 | } |
1740 | return $recipe; | |
567a9e6f | 1741 | } |
d8cac50b | 1742 | # We *know* this routine is only called when we've configure 'shared'. |
f6196227 | 1743 | sub obj2shlib { |
567a9e6f | 1744 | my %args = @_; |
47eeaf45 | 1745 | my @linkdirs = (); |
e805c2d6 RL |
1746 | my @linklibs = (); |
1747 | foreach (@{$args{deps}}) { | |
1748 | if (platform->isstaticlib($_)) { | |
1749 | push @linklibs, platform->convertext($_); | |
1750 | } else { | |
1751 | my $d = "-L" . dirname($_); | |
1752 | my $l = basename($_); | |
1753 | $l =~ s/^lib//; | |
1754 | $l = "-l" . $l; | |
1755 | push @linklibs, $l; | |
1756 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1757 | } | |
47eeaf45 | 1758 | } |
e805c2d6 RL |
1759 | my $linkflags = join("", map { $_." " } @linkdirs); |
1760 | my $linklibs = join("", map { $_." " } @linklibs); | |
1761 | my @objs = map { platform->convertext($_) } | |
9dd4ed28 | 1762 | grep { !platform->isdef($_) } |
ef2dfc99 | 1763 | @{$args{objs}}; |
9dd4ed28 RL |
1764 | my @defs = map { platform->def($_) } |
1765 | grep { platform->isdef($_) } | |
81183680 | 1766 | @{$args{objs}}; |
81183680 RL |
1767 | my @deps = compute_lib_depends(@{$args{deps}}); |
1768 | die "More than one exported symbol map" if scalar @defs > 1; | |
c00d9311 | 1769 | |
9dd4ed28 | 1770 | my $full = platform->sharedlib($args{lib}); |
ef161e7b RL |
1771 | # $import is for Windows and subsystems thereof, where static import |
1772 | # libraries for DLLs are a thing. On platforms that have this mechanism, | |
1773 | # $import has the name of this import library. On platforms that don't | |
1774 | # have this mechanism, $import will be |undef|. | |
1775 | my $import = platform->sharedlib_import($args{lib}); | |
1776 | # $simple is for platforms where full shared library names include the | |
1777 | # shared library version, and there's a simpler name that doesn't include | |
1778 | # that version. On such platforms, $simple has the simpler name. On | |
1779 | # other platforms, it will be |undef|. | |
1780 | my $simple = platform->sharedlib_simple($args{lib}); | |
1781 | ||
e07a7892 | 1782 | my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef; |
81183680 | 1783 | my $shared_soname = ""; |
d8cac50b | 1784 | $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) |
81183680 RL |
1785 | if defined $target{shared_sonameflag}; |
1786 | my $shared_imp = ""; | |
ef161e7b RL |
1787 | $shared_imp .= ' '.$target{shared_impflag}.basename($import) |
1788 | if defined $target{shared_impflag} && defined $import; | |
81183680 | 1789 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); |
c00d9311 | 1790 | |
e07a7892 RL |
1791 | # There is at least one platform where the compiler-as-linker needs to |
1792 | # have one object file directly on the command line. That won't hurt | |
1793 | # any other platform, so we do that for everyone when there's an argfile | |
1794 | # to be had. This depends heavily on splice, which removes elements from | |
1795 | # the given array, and returns them so they can be captured. | |
1796 | my @argfileobjs = $argfile | |
1797 | ? splice(@objs, 1) | |
1798 | : (); | |
1799 | my $argfilecmds = $argfile | |
1800 | ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs) | |
1801 | : undef; | |
1802 | my $argfiledeps = $argfile | |
1803 | ? join(" \\\n" . ' ' x (length($argfile) + 2), | |
1804 | fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs)) | |
1805 | : undef; | |
1806 | my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps); | |
1807 | my @fullobjs = ( | |
1808 | @objs, | |
1809 | ($argfile ? $target{shared_argfileflag}.$argfile : ()) | |
1810 | ); | |
1811 | my $fulldeps = | |
1812 | join(" \\\n" . ' ' x (length($full) + 2), | |
1813 | fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps)); | |
1814 | my $fullobjs = | |
1815 | join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs)); | |
c00d9311 | 1816 | |
294e3802 RL |
1817 | my $recipe = ''; |
1818 | ||
3bf7c3a1 | 1819 | if (defined $simple && $simple ne $full) { |
294e3802 RL |
1820 | if (sharedaix()) { |
1821 | $recipe .= <<"EOF"; | |
9dd4ed28 | 1822 | $simple: $full |
9dd4ed28 RL |
1823 | rm -f $simple && \\ |
1824 | \$(AR) r $simple $full | |
cff89b17 | 1825 | EOF |
294e3802 RL |
1826 | } else { |
1827 | $recipe .= <<"EOF"; | |
1828 | $simple: $full | |
d8cac50b | 1829 | rm -f $simple && \\ |
9dd4ed28 | 1830 | ln -s $full $simple |
81183680 | 1831 | EOF |
294e3802 | 1832 | } |
9dd4ed28 | 1833 | } |
ef161e7b RL |
1834 | if (defined $import) { |
1835 | $recipe .= <<"EOF"; | |
1836 | $import: $full | |
1837 | EOF | |
1838 | } | |
9dd4ed28 | 1839 | $recipe .= <<"EOF"; |
e07a7892 | 1840 | $full: $fulldeps |
9dd4ed28 | 1841 | \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ |
c00d9311 | 1842 | -o $full$shared_def \\ |
e07a7892 | 1843 | $fullobjs \\ |
c00d9311 | 1844 | $linklibs \$(LIB_EX_LIBS) |
9dd4ed28 RL |
1845 | EOF |
1846 | if (windowsdll()) { | |
81183680 | 1847 | $recipe .= <<"EOF"; |
9dd4ed28 | 1848 | rm -f apps/$full |
9dd4ed28 RL |
1849 | rm -f fuzz/$full |
1850 | cp -p $full apps/ | |
9dd4ed28 | 1851 | cp -p $full fuzz/ |
567a9e6f | 1852 | EOF |
f16f363a MC |
1853 | if (!$disabled{tests}) { |
1854 | $recipe .= <<"EOF"; | |
1855 | rm -f test/$full | |
1856 | cp -p $full test/ | |
1857 | EOF | |
1858 | } | |
81183680 | 1859 | } |
e07a7892 RL |
1860 | $recipe .= <<"EOF" if defined $argfile; |
1861 | $argfile: $argfiledeps | |
1862 | \$(RM) $argfile | |
1863 | $argfilecmds | |
1864 | EOF | |
9dd4ed28 | 1865 | return $recipe; |
567a9e6f | 1866 | } |
5386287c | 1867 | sub obj2dso { |
567a9e6f | 1868 | my %args = @_; |
285daccd | 1869 | my $dso = platform->dso($args{module}); |
47eeaf45 | 1870 | my @linkdirs = (); |
e805c2d6 RL |
1871 | my @linklibs = (); |
1872 | foreach (@{$args{deps}}) { | |
1873 | next unless defined $_; | |
1874 | if (platform->isstaticlib($_)) { | |
1875 | push @linklibs, platform->convertext($_); | |
1876 | } else { | |
1877 | my $d = "-L" . dirname($_); | |
1878 | my $l = basename($_); | |
1879 | $l =~ s/^lib//; | |
1880 | $l = "-l" . $l; | |
1881 | push @linklibs, $l; | |
1882 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1883 | } | |
47eeaf45 | 1884 | } |
e805c2d6 RL |
1885 | my $linkflags = join("", map { $_." " } @linkdirs); |
1886 | my $linklibs = join("", map { $_." " } @linklibs); | |
1887 | my @objs = map { platform->convertext($_) } | |
9dd4ed28 | 1888 | grep { !platform->isdef($_) } |
29f3cfdd | 1889 | @{$args{objs}}; |
9dd4ed28 RL |
1890 | my @defs = map { platform->def($_) } |
1891 | grep { platform->isdef($_) } | |
66a24ab8 | 1892 | @{$args{objs}}; |
81183680 | 1893 | my @deps = compute_lib_depends(@{$args{deps}}); |
66a24ab8 | 1894 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); |
21d1994f | 1895 | # Next line needs to become "less magic" (see PR #11950) |
69e0f8cc | 1896 | $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/); |
c00d9311 RL |
1897 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); |
1898 | my $deps = join(" \\\n" . ' ' x (length($dso) + 2), | |
1899 | fill_lines(' ', $COLUMNS - length($dso) - 2, | |
1900 | @objs, @defs, @deps)); | |
1901 | ||
567a9e6f | 1902 | return <<"EOF"; |
9dd4ed28 | 1903 | $dso: $deps |
722c9762 | 1904 | \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ |
c00d9311 RL |
1905 | -o $dso$shared_def \\ |
1906 | $objs \\ | |
1907 | $linklibs\$(DSO_EX_LIBS) | |
567a9e6f RL |
1908 | EOF |
1909 | } | |
1910 | sub obj2lib { | |
1911 | my %args = @_; | |
9dd4ed28 RL |
1912 | my $lib = platform->staticlib($args{lib}); |
1913 | my @objs = map { platform->obj($_) } @{$args{objs}}; | |
385deae7 | 1914 | my $deps = join(" \\\n" . ' ' x (length($lib) + 2), |
c00d9311 | 1915 | fill_lines(' ', $COLUMNS - length($lib) - 2, @objs)); |
0e60ce63 | 1916 | my $max_per_call = 500; |
385deae7 RL |
1917 | my @objs_grouped; |
1918 | push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs; | |
1919 | my $fill_lib = | |
1920 | join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped)); | |
567a9e6f | 1921 | return <<"EOF"; |
385deae7 | 1922 | $lib: $deps |
0e60ce63 | 1923 | \$(RM) $lib |
385deae7 | 1924 | $fill_lib |
567a9e6f RL |
1925 | \$(RANLIB) \$\@ || echo Never mind. |
1926 | EOF | |
1927 | } | |
1928 | sub obj2bin { | |
1929 | my %args = @_; | |
9dd4ed28 | 1930 | my $bin = platform->bin($args{bin}); |
c00d9311 RL |
1931 | my @objs = map { platform->obj($_) } @{$args{objs}}; |
1932 | my @deps = compute_lib_depends(@{$args{deps}}); | |
1933 | my $objs = join(" \\\n" . ' ' x (length($bin) + 2), | |
1934 | fill_lines(' ', $COLUMNS - length($bin) - 2, @objs)); | |
47eeaf45 | 1935 | my @linkdirs = (); |
e805c2d6 RL |
1936 | my @linklibs = (); |
1937 | foreach (@{$args{deps}}) { | |
1938 | next unless defined $_; | |
1939 | if (platform->isstaticlib($_)) { | |
1940 | push @linklibs, platform->convertext($_); | |
1941 | } else { | |
1942 | my $d = "-L" . dirname($_); | |
1943 | my $l = basename($_); | |
1944 | $l =~ s/^lib//; | |
1945 | $l = "-l" . $l; | |
1946 | push @linklibs, $l; | |
1947 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1948 | } | |
47eeaf45 | 1949 | } |
e805c2d6 RL |
1950 | my $linkflags = join("", map { $_." " } @linkdirs); |
1951 | my $linklibs = join("", map { $_." " } @linklibs); | |
81183680 | 1952 | my $cmd = '$(CC)'; |
722c9762 | 1953 | my $cmdflags = '$(BIN_CFLAGS)'; |
81183680 RL |
1954 | if (grep /_cc\.o$/, @{$args{objs}}) { |
1955 | $cmd = '$(CXX)'; | |
722c9762 | 1956 | $cmdflags = '$(BIN_CXXFLAGS)'; |
7763472f | 1957 | } |
c00d9311 RL |
1958 | |
1959 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); | |
1960 | my $deps = join(" \\\n" . ' ' x (length($bin) + 2), | |
1961 | fill_lines(' ', $COLUMNS - length($bin) - 2, | |
1962 | @objs, @deps)); | |
1963 | ||
567a9e6f | 1964 | return <<"EOF"; |
c00d9311 | 1965 | $bin: $deps |
9dd4ed28 | 1966 | rm -f $bin |
722c9762 | 1967 | \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ |
c00d9311 RL |
1968 | -o $bin \\ |
1969 | $objs \\ | |
e805c2d6 | 1970 | $linklibs\$(BIN_EX_LIBS) |
567a9e6f RL |
1971 | EOF |
1972 | } | |
1973 | sub in2script { | |
1974 | my %args = @_; | |
1975 | my $script = $args{script}; | |
1976 | my $sources = join(" ", @{$args{sources}}); | |
1977 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1978 | "util", "dofile.pl")), | |
1979 | rel2abs($config{builddir})); | |
1980 | return <<"EOF"; | |
079f8d36 | 1981 | $script: $sources configdata.pm |
0eed845c | 1982 | \$(RM) "$script" |
4b799cea | 1983 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1984 | "-o$target{build_file}" $sources > "$script" |
567a9e6f | 1985 | chmod a+x $script |
0ad1d94d RL |
1986 | EOF |
1987 | } | |
1988 | sub generatedir { | |
1989 | my %args = @_; | |
1990 | my $dir = $args{dir}; | |
6dd07a93 | 1991 | my @deps = compute_platform_depends(@{$args{deps}}); |
c00d9311 | 1992 | my @comments = (); |
0ad1d94d | 1993 | |
b6e66075 RL |
1994 | # We already have a 'test' target, and the top directory is just plain |
1995 | # silly | |
1996 | return if $dir eq "test" || $dir eq "."; | |
1997 | ||
0ad1d94d RL |
1998 | foreach my $type (("dso", "lib", "bin", "script")) { |
1999 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
2000 | # For lib object files, we could update the library. However, it |
2001 | # was decided that it's enough to build the directory local object | |
2002 | # files, so we don't need to add any actions, and the dependencies | |
2003 | # are already taken care of. | |
2004 | if ($type ne "lib") { | |
0ad1d94d RL |
2005 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
2006 | if (dirname($prod) eq $dir) { | |
6dd07a93 | 2007 | push @deps, compute_platform_depends($prod); |
0ad1d94d | 2008 | } else { |
c00d9311 | 2009 | push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); |
0ad1d94d RL |
2010 | } |
2011 | } | |
2012 | } | |
2013 | } | |
2014 | ||
c00d9311 RL |
2015 | my $target = "$dir $dir/"; |
2016 | my $deps = join(" \\\n\t", | |
2017 | fill_lines(' ', $COLUMNS - 8, @deps)); | |
2018 | my $comments = join("\n", "", @comments); | |
0ad1d94d | 2019 | return <<"EOF"; |
c00d9311 RL |
2020 | $target: \\ |
2021 | $deps$comments | |
567a9e6f RL |
2022 | EOF |
2023 | } | |
2024 | "" # Important! This becomes part of the template result. | |
2025 | -} |