2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
8 our $makedep_scheme = $config{makedep_scheme};
9 our $makedepcmd = platform->makedepcmd();
11 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
13 # Shared AIX support is special. We put libcrypto[64].so.ver into
14 # libcrypto.a and use libcrypto_a.a as static one, unless using
15 # shared_target style aix-solib. In that mode, create
16 # libcrypto.so as a link-import library that inserts runtime
17 # dependencies on libcrypto.so.ver, and the static library is
19 sub sharedaix { !$disabled{shared} && $target{shared_target} =~ /^aix(?!-solib$)/ }
20 sub sharedaix_solib { !$disabled{shared} && $target{shared_target} =~ /^aix-solib$/ }
22 our $sover_dirname = platform->shlib_version_as_filename();
24 # This makes sure things get built in the order they need
30 return "$target: build_generated ## $help\n\t\"\$(MAKE)\" depend && \"\$(MAKE)\" _$target\n_$target";
33 our $COLUMNS = $ENV{COLUMNS};
34 if ($COLUMNS =~ /^\d+$/) {
35 $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
41 my $item_sep = shift; # string
42 my $line_length = shift; # number of chars
48 my $fill_line = $result[$resultpos] // '';
50 ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
52 if (length($newline) > $line_length) {
53 # If this is a single item and the intended result line
54 # is empty, we put it there anyway
55 if ($fill_line eq '') {
56 $result[$resultpos++] = $newline;
58 $result[++$resultpos] = $_;
61 $result[$resultpos] = $newline;
68 PLATFORM={- $config{target} -}
69 OPTIONS={- $config{options} -}
70 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
71 SRCDIR={- $config{sourcedir} -}
72 BLDDIR={- $config{builddir} -}
73 FIPSKEY={- $config{FIPSKEY} -}
75 VERSION={- "$config{full_version}" -}
76 VERSION_NUMBER={- "$config{version}" -}
77 MAJOR={- $config{major} -}
78 MINOR={- $config{minor} -}
79 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
80 SHLIB_TARGET={- $target{shared_target} -}
82 LIBS={- join(" \\\n" . ' ' x 5,
83 fill_lines(" ", $COLUMNS - 5,
84 map { platform->staticlib($_) // () }
85 @{$unified_info{libraries}})) -}
86 SHLIBS={- join(" \\\n" . ' ' x 7,
87 fill_lines(" ", $COLUMNS - 7,
88 map { platform->sharedlib($_) // () }
89 @{$unified_info{libraries}})) -}
90 SHLIB_INFO={- join(" \\\n" . ' ' x 11,
91 fill_lines(" ", $COLUMNS - 11,
92 map { my $x = platform->sharedlib($_);
93 my $y = platform->sharedlib_simple($_) // '';
94 my $z = platform->sharedlib_import($_) // '';
95 $x ? "\"$x;$y;$z\"" : () }
96 @{$unified_info{libraries}})) -}
97 MODULES={- join(" \\\n" . ' ' x 8,
98 fill_lines(" ", $COLUMNS - 8,
99 map { platform->dso($_) }
100 # Drop all modules that are dependencies, they will
101 # be processed through their dependents
103 !grep { grep { $_ eq $x } @$_ }
104 values %{$unified_info{depends}} }
105 @{$unified_info{modules}})) -}
106 FIPSMODULE={- # We do some extra checking here, as there should be only one
109 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
110 && $unified_info{attributes}->{modules}->{$_}->{fips} }
111 @{$unified_info{modules}};
112 die "More that one FIPS module" if scalar @fipsmodules > 1;
113 join(" ", map { platform->dso($_) } @fipsmodules) -}
114 FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
115 join(" ", map { basename(platform->dso($_)) } @fipsmodules) -}
117 PROGRAMS={- join(" \\\n" . ' ' x 9,
118 fill_lines(" ", $COLUMNS - 9,
119 map { platform->bin($_) }
120 @{$unified_info{programs}})) -}
121 SCRIPTS={- join(" \\\n" . ' ' x 8,
122 fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
123 {- output_off() if $disabled{makedepend}; "" -}
124 DEPS={- join(" \\\n" . ' ' x 5,
125 fill_lines(" ", $COLUMNS - 5,
126 map { platform->isobj($_) ? platform->dep($_) : () }
127 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
128 keys %{$unified_info{sources}})); -}
129 {- output_on() if $disabled{makedepend}; "" -}
130 GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
131 fill_lines(" ", $COLUMNS - 20,
132 @{$unified_info{depends}->{""}})) -}
133 GENERATED_PODS={- # common0.tmpl provides @generated
134 join(" \\\n" . ' ' x 15,
135 fill_lines(" ", $COLUMNS - 15,
139 $unified_info{attributes}->{depends}
140 ->{$x}->{$_}->{pod} // 0
142 keys %{$unified_info{attributes}->{depends}->{$x}}
146 GENERATED={- # common0.tmpl provides @generated
147 join(" \\\n" . ' ' x 5,
148 fill_lines(" ", $COLUMNS - 5,
149 map { platform->convertext($_) } @generated )) -}
152 join(" \\\n" . ' ' x 13,
153 fill_lines(" ", $COLUMNS - 13,
154 map { platform->staticlib($_) // () }
155 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
156 @{$unified_info{libraries}}))
159 join(" \\\n" . ' ' x 15,
160 fill_lines(" ", $COLUMNS - 15,
161 map { platform->sharedlib($_) // () }
162 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
163 @{$unified_info{libraries}}))
165 INSTALL_SHLIB_INFO={-
166 join(" \\\n" . ' ' x 19,
167 fill_lines(" ", $COLUMNS - 19,
168 map { my $x = platform->sharedlib($_);
169 my $y = platform->sharedlib_simple($_) // '';
170 my $z = platform->sharedlib_import($_) // '';
171 $x ? "\"$x;$y;$z\"" : () }
172 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
173 @{$unified_info{libraries}}))
176 join(" \\\n" . ' ' x 16,
177 fill_lines(" ", $COLUMNS - 16,
178 map { platform->dso($_) }
179 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
180 && $unified_info{attributes}->{modules}->{$_}->{engine} }
181 @{$unified_info{modules}}))
184 join(" \\\n" . ' ' x 16,
185 fill_lines(" ", $COLUMNS - 16,
186 map { platform->dso($_) }
187 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
188 && !$unified_info{attributes}->{modules}->{$_}->{engine}
189 && !$unified_info{attributes}->{modules}->{$_}->{fips} }
190 @{$unified_info{modules}}))
192 INSTALL_FIPSMODULE={-
193 join(" \\\n" . ' ' x 16,
194 fill_lines(" ", $COLUMNS - 16,
195 map { platform->dso($_) }
196 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
197 && $unified_info{attributes}->{modules}->{$_}->{fips} }
198 @{$unified_info{modules}}))
200 INSTALL_FIPSMODULECONF=providers/fipsmodule.cnf
202 join(" \\\n" . ' ' x 16,
203 fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
204 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
205 @{$unified_info{programs}}))
207 INSTALL_EXPORTERS_PKGCONFIG={-
208 join(" \\\n" . ' ' x 28,
209 fill_lines(" ", $COLUMNS - 28,
210 grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'pkg-config'}
211 sort keys %{$unified_info{generate}}))
213 INSTALL_EXPORTERS_CMAKE={-
214 join(" \\\n" . ' ' x 24,
215 fill_lines(" ", $COLUMNS - 24,
216 grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'cmake'}
217 sort keys %{$unified_info{generate}}))
220 join(" \\\n" . ' ' x 12,
221 fill_lines(" ", $COLUMNS - 12,
222 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
224 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
225 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
226 @{$unified_info{scripts}}))
229 join(" \\\n" . ' ' x 13,
230 fill_lines(" ", $COLUMNS - 13,
231 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
233 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
234 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
235 @{$unified_info{scripts}}))
238 join(" \\\n" . ' ' x 10,
239 fill_lines(" ", $COLUMNS - 10,
240 @{$unified_info{imagedocs}->{man1}})) -}
242 join(" \\\n" . ' ' x 10,
243 fill_lines(" ", $COLUMNS - 10,
244 @{$unified_info{imagedocs}->{man3}})) -}
246 join(" \\\n" . ' ' x 10,
247 fill_lines(" ", $COLUMNS - 10,
248 @{$unified_info{imagedocs}->{man5}})) -}
250 join(" \\\n" . ' ' x 10,
251 fill_lines(" ", $COLUMNS - 10,
252 @{$unified_info{imagedocs}->{man7}})) -}
254 join(" \\\n" . ' ' x 10,
255 fill_lines(" ", $COLUMNS - 10,
256 @{$unified_info{htmldocs}->{man1}})) -}
258 join(" \\\n" . ' ' x 10,
259 fill_lines(" ", $COLUMNS - 10,
260 @{$unified_info{htmldocs}->{man3}})) -}
262 join(" \\\n" . ' ' x 10,
263 fill_lines(" ", $COLUMNS - 10,
264 @{$unified_info{htmldocs}->{man5}})) -}
266 join(" \\\n" . ' ' x 10,
267 fill_lines(" ", $COLUMNS - 10,
268 @{$unified_info{htmldocs}->{man7}})) -}
270 join(" \\\n" . ' ' x 9,
271 fill_lines(" ", $COLUMNS - 9,
272 @{$unified_info{mandocs}->{man1}})) -}
274 join(" \\\n" . ' ' x 9,
275 fill_lines(" ", $COLUMNS - 9,
276 @{$unified_info{mandocs}->{man3}})) -}
278 join(" \\\n" . ' ' x 9,
279 fill_lines(" ", $COLUMNS - 9,
280 @{$unified_info{mandocs}->{man5}})) -}
282 join(" \\\n" . ' ' x 9,
283 fill_lines(" ", $COLUMNS - 9,
284 @{$unified_info{mandocs}->{man7}})) -}
286 APPS_OPENSSL="{- use File::Spec::Functions;
287 catfile("apps","openssl") -}"
289 # DESTDIR is for package builders so that they can configure for, say,
290 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
291 # Normally it is left empty.
294 # Do not edit these manually. Use Configure with --prefix or --openssldir
295 # to change this! Short explanation in the top comment in Configure
296 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
298 our $prefix = $config{prefix} || "/usr/local";
301 # The logic here is that if no --openssldir was given,
302 # OPENSSLDIR will get the value from $prefix plus "/ssl".
303 # If --openssldir was given and the value is an absolute
304 # path, OPENSSLDIR will get its value without change.
305 # If the value from --openssldir is a relative path,
306 # OPENSSLDIR will get $prefix with the --openssldir
307 # value appended as a subdirectory.
309 use File::Spec::Functions;
311 $config{openssldir} ?
312 (file_name_is_absolute($config{openssldir}) ?
314 : catdir($prefix, $config{openssldir}))
315 : catdir($prefix, "ssl");
317 LIBDIR={- our $libdir = $config{libdir};
319 $libdir = "lib$target{multilib}";
321 file_name_is_absolute($libdir) ? "" : $libdir -}
322 # $(libdir) is chosen to be compatible with the GNU coding standards
323 libdir={- file_name_is_absolute($libdir)
324 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
325 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
326 MODULESDIR=$(libdir)/ossl-modules
328 # Convenience variable for those who want to set the rpath in shared
329 # libraries and applications
332 BINDIR={- our $bindir = $config{bindir};
334 $bindir = "bin$target{multibin}";
336 file_name_is_absolute($bindir) ? "" : $bindir -}
337 bindir={- file_name_is_absolute($bindir)
338 ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -}
340 PKGCONFIGDIR=$(libdir)/pkgconfig
341 CMAKECONFIGDIR=$(libdir)/cmake/OpenSSL
343 MANDIR=$(INSTALLTOP)/share/man
344 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
345 HTMLDIR=$(DOCDIR)/html
347 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
348 # appended after the manpage file section number. "ssl" is popular,
349 # resulting in files such as config.5ssl rather than config.5.
353 # For "optional" echo messages, to get "real" silence
356 ##### User defined commands and flags ################################
358 # We let the C compiler driver to take care of .s files. This is done in
359 # order to be excused from maintaining a separate set of architecture
360 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
361 # gcc, then the driver will automatically translate it to -xarch=v8plus
362 # and pass it down to assembler. In any case, we do not define AS or
363 # ASFLAGS for this reason.
365 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
366 CC=$(CROSS_COMPILE){- $config{CC} -}
367 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
368 CPPFLAGS={- our $cppflags1 = join(" ",
369 (map { "-D".$_} @{$config{CPPDEFINES}}),
370 (map { "-I".$_} @{$config{CPPINCLUDES}}),
371 @{$config{CPPFLAGS}}) -}
372 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
373 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
374 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
375 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
377 MAKEDEPEND={- $config{makedepcmd} -}
379 PERL={- $config{PERL} -}
381 AR=$(CROSS_COMPILE){- $config{AR} -}
382 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
383 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
384 RC= $(CROSS_COMPILE){- $config{RC} -}
385 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
389 TAR= {- $target{TAR} || "tar" -}
390 TARFLAGS= {- $target{TARFLAGS} -}
393 NAME= $(BASENAME)-$(VERSION)
394 # Relative to $(SRCDIR)
395 TARFILE= ../$(NAME).tar
397 ##### Project flags ##################################################
399 # Variables starting with CNF_ are common variables for all product types
401 CNF_CPPFLAGS={- our $cppflags2 =
402 join(' ', $target{cppflags} || (),
403 (map { "-D".$_} @{$target{defines}},
404 @{$config{defines}}),
405 (map { "-I".$_} @{$target{includes}},
406 @{$config{includes}}),
407 @{$config{cppflags}}) -}
408 CNF_CFLAGS={- join(' ', $target{cflags} || (),
409 @{$config{cflags}}) -}
410 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
411 @{$config{cxxflags}}) -}
412 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
413 @{$config{lflags}}) -}
414 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
415 @{$config{ex_libs}}) -}
417 # Variables starting with LIB_ are used to build library object files
418 # and shared libraries.
419 # Variables starting with DSO_ are used to build DSOs and their object files.
420 # Variables starting with BIN_ are used to build programs and their object
423 LIB_CPPFLAGS={- our $lib_cppflags =
424 join(' ', $target{lib_cppflags} || (),
425 $target{shared_cppflag} || (),
427 @{$target{lib_defines} || ()},
428 @{$target{shared_defines} || ()},
429 @{$config{lib_defines} || ()},
430 @{$config{shared_defines} || ()}),
431 (map { '-I'.quotify1($_) }
432 @{$target{lib_includes}},
433 @{$target{shared_includes}},
434 @{$config{lib_includes}},
435 @{$config{shared_includes}}),
436 @{$config{lib_cppflags}},
437 @{$config{shared_cppflag}});
438 join(' ', $lib_cppflags,
440 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
441 'ENGINESDIR="\"$(ENGINESDIR)\""',
442 'MODULESDIR="\"$(MODULESDIR)\""'),
443 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
444 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
445 $target{shared_cflag} || (),
446 @{$config{lib_cflags}},
447 @{$config{shared_cflag}},
448 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
449 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
450 $target{shared_cxxflag} || (),
451 @{$config{lib_cxxflags}},
452 @{$config{shared_cxxflag}},
453 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
454 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
455 $config{shared_ldflag} || (),
456 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
457 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
458 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
459 $target{module_cppflags} || (),
461 @{$target{dso_defines}},
462 @{$target{module_defines}},
463 @{$config{dso_defines} || ()},
464 @{$config{module_defines} || ()}),
465 (map { '-I'.quotify1($_) }
466 @{$target{dso_includes}},
467 @{$target{module_includes}},
468 @{$config{dso_includes}},
469 @{$config{module_includes}}),
470 @{$config{dso_cppflags}},
471 @{$config{module_cppflags}},
472 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
473 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
474 $target{module_cflags} || (),
475 @{$config{dso_cflags}},
476 @{$config{module_cflags}},
477 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
478 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
479 $target{module_cxxflags} || (),
480 @{$config{dso_cxxflags}},
481 @{$config{module_cxxflag}},
482 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
483 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
484 $target{module_ldflags} || (),
485 @{$config{dso_ldflags}},
486 @{$config{module_ldflags}},
487 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
488 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
489 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
490 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
491 @{$config{bin_cppflags}},
492 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
493 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
494 @{$config{bin_cflags}},
495 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
496 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
497 @{$config{bin_cxxflags}},
498 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
499 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
500 @{$config{bin_lflags}},
501 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
502 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
504 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
505 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
506 $cppflags2 =~ s|([\\"])|\\$1|g;
507 $lib_cppflags =~ s|([\\"])|\\$1|g;
508 join(' ', $lib_cppflags || (), $cppflags2 || (),
511 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
513 # For x86 assembler: Set PROCESSOR to 386 if you want to support
515 PROCESSOR= {- $config{processor} -}
517 # We want error [and other] messages in English. Trouble is that make(1)
518 # doesn't pass macros down as environment variables unless there already
519 # was corresponding variable originally set. In other words we can only
520 # reassign environment variables, but not set new ones, not in portable
521 # manner that is. That's why we reassign several, just to be sure...
526 # The main targets ###################################################
530 {- dependmagic('build_sw', 'Build all the software (default target)'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
531 {- dependmagic('build_libs', 'Build the libraries libssl and libcrypto'); -}: build_libs_nodep
532 {- dependmagic('build_modules', 'Build the modules (i.e. providers and engines)'); -}: build_modules_nodep
533 {- dependmagic('build_programs', 'Build the openssl executables and scripts'); -}: build_programs_nodep
535 all: build_sw {- "build_docs" if !$disabled{docs}; -} ## Build software and documentation
538 build_generated_pods: $(GENERATED_PODS)
539 build_docs: build_man_docs build_html_docs ## Create documentation
540 build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) ## Create manpages
541 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) ## Create HTML documentation
543 build_generated: $(GENERATED_MANDATORY)
544 build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
545 build_modules_nodep: $(MODULES)
546 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
548 # Kept around for backward compatibility
549 build_apps build_tests: build_programs
551 # Convenience target to prebuild all generated files, not just the mandatory
553 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
554 @ : {- output_off() if $disabled{makedepend}; "" -}
555 @echo "Warning: consider configuring with no-makedepend, because if"
556 @echo " target system doesn't have $(PERL),"
557 @echo " then make will fail..."
558 @ : {- output_on() if $disabled{makedepend}; "" -}
562 help: ## Show this help screen
563 @$(PERL) $(SRCDIR)/util/help.pl $(BLDDIR)/Makefile
566 test: tests ## Run tests (alias of "tests")
567 {- dependmagic('tests', 'Run tests'); -}: build_programs_nodep build_modules_nodep link-utils
570 @ : {- output_off() if $disabled{tests}; "" -}
574 FIPSKEY="$(FIPSKEY)" \
575 EXE_EXT={- platform->binext() -} \
576 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
577 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
578 @echo "Tests are not supported with your chosen Configure options"
579 @ : {- output_on() if !$disabled{tests}; "" -}
581 list-tests: ## List available tests that can be invoked via "make test TESTS=<name>"
582 @ : {- output_off() if $disabled{tests}; "" -}
583 "$(MAKE)" run_tests TESTS=list
584 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
585 @echo "Tests are not supported with your chosen Configure options"
586 @ : {- output_on() if !$disabled{tests}; "" -}
588 ##@ Workspace cleaning
591 @set -e; for s in $(SHLIB_INFO); do \
592 if [ "$$s" = ";" ]; then continue; fi; \
593 s1=`echo "$$s" | cut -f1 -d";"`; \
594 s2=`echo "$$s" | cut -f2 -d";"`; \
595 s3=`echo "$$s" | cut -f3 -d";"`; \
596 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
599 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
601 if [ "$$s2" != "" ]; then \
602 $(ECHO) $(RM) $$s2; \
605 if [ "$$s3" != "" ]; then \
606 $(ECHO) $(RM) $$s3; \
611 $(RM) *{- platform->defext() -}
613 clean: libclean ## Clean the workspace, keep the configuration
622 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS)
623 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
624 -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
625 -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
627 $(RM) tags TAGS doc-nits md-nits
628 $(RM) -r test/test-runs
629 $(RM) providers/fips*.new
630 -find . -type l \! -name '.*' -exec $(RM) {} \;
632 distclean: clean ## Clean and remove the configuration
633 $(RM) include/openssl/configuration.h
637 # We check if any depfile is newer than Makefile and decide to
638 # concatenate only if that is true.
640 @: {- output_off() if $disabled{makedepend}; "" -}
641 @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}"
642 @: {- output_on() if $disabled{makedepend}; "" -}
644 # Install helper targets #############################################
647 install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} ## Install software and documentation, create OpenSSL directories
649 uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation
651 install_sw: install_dev install_engines install_modules install_runtime ## Install just the software and libraries
653 uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev ## Uninstall the software and libraries
655 install_docs: install_man_docs install_html_docs ## Install manpages and HTML documentation
657 uninstall_docs: uninstall_man_docs uninstall_html_docs ## Uninstall manpages and HTML documentation
658 $(RM) -r "$(DESTDIR)$(DOCDIR)"
660 {- output_off() if $disabled{fips}; "" -}
661 install_fips: build_sw $(INSTALL_FIPSMODULECONF)
662 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
663 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)"
664 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)"
665 @$(ECHO) "*** Installing FIPS module"
666 @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
667 @cp "$(INSTALL_FIPSMODULE)" "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
668 @chmod 755 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
669 @mv -f "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" \
670 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
671 @$(ECHO) "*** Installing FIPS module configuration"
672 @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
673 @cp $(INSTALL_FIPSMODULECONF) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
676 @$(ECHO) "*** Uninstalling FIPS module configuration"
677 $(RM) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
678 @$(ECHO) "*** Uninstalling FIPS module"
679 $(RM) "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
680 {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
682 @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
685 @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
686 {- output_on() if !$disabled{fips}; "" -}
690 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs"
691 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private"
692 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc"
693 @set -e; for x in dummy $(MISC_SCRIPTS); do \
694 if [ "$$x" = "dummy" ]; then continue; fi; \
695 x1=`echo "$$x" | cut -f1 -d:`; \
696 x2=`echo "$$x" | cut -f2 -d:`; \
697 fn=`basename $$x1`; \
698 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
699 cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
700 chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
701 mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \
702 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
703 if [ "$$x1" != "$$x2" ]; then \
704 ln=`basename "$$x2"`; \
705 : {- output_off() unless windowsdll(); "" -}; \
706 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
707 cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
708 : {- output_on() unless windowsdll();
709 output_off() if windowsdll(); "" -}; \
710 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
711 ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
712 : {- output_on() if windowsdll(); "" -}; \
715 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
716 @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
717 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
718 @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
719 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
720 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
721 cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
722 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
724 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
725 @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
726 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
727 @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
728 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
729 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
730 cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
731 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
734 install_dev: install_runtime_libs
735 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
736 @$(ECHO) "*** Installing development files"
737 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl"
738 @ : {- output_off() if $disabled{uplink}; "" -}
739 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
740 @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
741 @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
742 @ : {- output_on() if $disabled{uplink}; "" -}
743 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
744 $(BLDDIR)/include/openssl/*.h; do \
746 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
747 cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
748 chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
750 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
751 @set -e; for l in $(INSTALL_LIBS); do \
753 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
754 cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \
755 $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \
756 chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \
757 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
758 "$(DESTDIR)$(libdir)/$$fn"; \
760 @ : {- output_off() if $disabled{shared}; "" -}
761 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
762 s1=`echo "$$s" | cut -f1 -d";"`; \
763 s2=`echo "$$s" | cut -f2 -d";"`; \
764 s3=`echo "$$s" | cut -f3 -d";"`; \
765 fn1=`basename "$$s1"`; \
766 fn2=`basename "$$s2"`; \
767 fn3=`basename "$$s3"`; \
768 : {- output_off(); output_on() unless windowsdll() or sharedaix() or sharedaix_solib(); "" -}; \
769 if [ "$$fn2" != "" ]; then \
770 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
771 ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \
773 : {- output_off() unless windowsdll() or sharedaix() or sharedaix_solib(); output_on() if windowsdll() or sharedaix_solib(); "" -}; \
774 if [ "$$fn3" != "" ]; then \
775 $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
776 cp $$s3 "$(DESTDIR)$(libdir)/$$fn3.new"; \
777 chmod 755 "$(DESTDIR)$(libdir)/$$fn3.new"; \
778 mv -f "$(DESTDIR)$(libdir)/$$fn3.new" \
779 "$(DESTDIR)$(libdir)/$$fn3"; \
781 : {- output_off() if windowsdll() or sharedaix_solib(); output_on() if sharedaix(); "" -}; \
782 a="$(DESTDIR)$(libdir)/$$fn2"; \
783 $(ECHO) "install $$s1 -> $$a"; \
784 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
785 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
787 for so in `$(AR) t $$a`; do \
790 strip -X32_64 -e $$so; \
791 $(AR) r $$a.new $$so; \
794 $(AR) r $$a.new $$s1; \
796 : {- output_off() if sharedaix(); output_on(); "" -}; \
798 @ : {- output_on() if $disabled{shared}; "" -}
799 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(PKGCONFIGDIR)"
800 @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \
802 $(ECHO) "install $$e -> $(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
803 cp $$e "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
804 chmod 644 "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
806 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(CMAKECONFIGDIR)
807 @for e in $(INSTALL_EXPORTERS_CMAKE); do \
809 $(ECHO) "install $$e -> $(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \
810 cp $$e $(DESTDIR)$(CMAKECONFIGDIR)/$$fn; \
811 chmod 644 $(DESTDIR)$(CMAKECONFIGDIR)/$$fn; \
814 uninstall_dev: uninstall_runtime_libs
815 @$(ECHO) "*** Uninstalling development files"
816 @ : {- output_off() if $disabled{uplink}; "" -}
817 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
818 @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
819 @ : {- output_on() if $disabled{uplink}; "" -}
820 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
821 $(BLDDIR)/include/openssl/*.h; do \
823 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
824 $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
826 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl"
827 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include"
828 @set -e; for l in $(INSTALL_LIBS); do \
830 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
831 $(RM) "$(DESTDIR)$(libdir)/$$fn"; \
833 @ : {- output_off() if $disabled{shared}; "" -}
834 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
835 s1=`echo "$$s" | cut -f1 -d";"`; \
836 s2=`echo "$$s" | cut -f2 -d";"`; \
837 s3=`echo "$$s" | cut -f3 -d";"`; \
838 fn1=`basename "$$s1"`; \
839 fn2=`basename "$$s2"`; \
840 fn3=`basename "$$s3"`; \
841 : {- output_off() if windowsdll(); "" -}; \
842 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
843 $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \
844 if [ -n "$$fn2" ]; then \
845 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
846 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \
848 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
849 if [ -n "$$fn3" ]; then \
850 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
851 $(RM) "$(DESTDIR)$(libdir)/$$fn3"; \
853 : {- output_on() unless windowsdll(); "" -}; \
855 @ : {- output_on() if $disabled{shared}; "" -}
856 @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \
857 fn=`basename "$$e"`; \
858 $(RM) "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
860 @for e in $(INSTALL_EXPORTERS_CMAKE); do \
861 fn=`basename "$$e"`; \
862 $(RM) "$(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \
864 -$(RMDIR) "$(DESTDIR)$(PKGCONFIGDIR)"
865 -$(RMDIR) "$(DESTDIR)$(CMAKECONFIGDIR)"
866 -$(RMDIR) "$(DESTDIR)$(libdir)"
868 _install_modules_deps: install_runtime_libs build_modules
870 install_engines: _install_modules_deps
871 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
872 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/"
873 @$(ECHO) "*** Installing engines"
874 @set -e; for e in dummy $(INSTALL_ENGINES); do \
875 if [ "$$e" = "dummy" ]; then continue; fi; \
877 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
878 cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
879 chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
880 mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \
881 "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
885 @$(ECHO) "*** Uninstalling engines"
886 @set -e; for e in dummy $(INSTALL_ENGINES); do \
887 if [ "$$e" = "dummy" ]; then continue; fi; \
889 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
890 $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
892 -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)"
894 install_modules: _install_modules_deps
895 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
896 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/"
897 @$(ECHO) "*** Installing modules"
898 @set -e; for e in dummy $(INSTALL_MODULES); do \
899 if [ "$$e" = "dummy" ]; then continue; fi; \
901 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
902 cp $$e "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
903 chmod 755 "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
904 mv -f "$(DESTDIR)$(MODULESDIR)/$$fn.new" \
905 "$(DESTDIR)$(MODULESDIR)/$$fn"; \
909 @$(ECHO) "*** Uninstalling modules"
910 @set -e; for e in dummy $(INSTALL_MODULES); do \
911 if [ "$$e" = "dummy" ]; then continue; fi; \
913 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
914 $(RM) "$(DESTDIR)$(MODULESDIR)/$$fn"; \
916 -$(RMDIR) "$(DESTDIR)$(MODULESDIR)"
918 install_runtime: install_programs
920 install_runtime_libs: build_libs
921 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
922 @ : {- output_off() if windowsdll(); "" -}
923 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
924 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
925 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)/"
926 @ : {- output_on() unless windowsdll(); "" -}
927 @$(ECHO) "*** Installing runtime libraries"
928 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
929 if [ "$$s" = "dummy" ]; then continue; fi; \
931 : {- output_off() unless windowsdll(); "" -}; \
932 $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \
933 cp $$s "$(DESTDIR)$(bindir)/$$fn.new"; \
934 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
935 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
936 "$(DESTDIR)$(bindir)/$$fn"; \
937 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
938 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
939 cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \
940 chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \
941 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
942 "$(DESTDIR)$(libdir)/$$fn"; \
943 : {- output_on() if windowsdll(); "" -}; \
946 install_programs: install_runtime_libs build_programs
947 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
948 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)"
949 @$(ECHO) "*** Installing runtime programs"
950 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
951 if [ "$$x" = "dummy" ]; then continue; fi; \
953 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
954 cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
955 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
956 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
957 "$(DESTDIR)$(bindir)/$$fn"; \
959 @set -e; for x in dummy $(BIN_SCRIPTS); do \
960 if [ "$$x" = "dummy" ]; then continue; fi; \
962 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
963 cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
964 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
965 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
966 "$(DESTDIR)$(bindir)/$$fn"; \
969 uninstall_runtime: uninstall_programs uninstall_runtime_libs
972 @$(ECHO) "*** Uninstalling runtime programs"
973 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
975 if [ "$$x" = "dummy" ]; then continue; fi; \
977 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
978 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
980 @set -e; for x in dummy $(BIN_SCRIPTS); \
982 if [ "$$x" = "dummy" ]; then continue; fi; \
984 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
985 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
987 -$(RMDIR) "$(DESTDIR)$(bindir)"
989 uninstall_runtime_libs:
990 @$(ECHO) "*** Uninstalling runtime libraries"
991 @ : {- output_off() unless windowsdll(); "" -}
992 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
993 if [ "$$s" = "dummy" ]; then continue; fi; \
995 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
996 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
998 @ : {- output_on() unless windowsdll(); "" -}
1001 install_man_docs: build_man_docs
1002 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
1003 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man1"
1004 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man3"
1005 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man5"
1006 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man7"
1007 @$(ECHO) "*** Installing manpages"
1008 @set -e; for x in dummy $(MANDOCS1); do \
1009 if [ "$$x" = "dummy" ]; then continue; fi; \
1010 fn=`basename $$x`; \
1011 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1012 cp $$x "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1013 chmod 644 "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1014 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
1016 @set -e; for x in dummy $(MANDOCS3); do \
1017 if [ "$$x" = "dummy" ]; then continue; fi; \
1018 fn=`basename $$x`; \
1019 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1020 cp $$x "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1021 chmod 644 "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1022 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
1024 @set -e; for x in dummy $(MANDOCS5); do \
1025 if [ "$$x" = "dummy" ]; then continue; fi; \
1026 fn=`basename $$x`; \
1027 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1028 cp $$x "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1029 chmod 644 "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1030 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
1032 @set -e; for x in dummy $(MANDOCS7); do \
1033 if [ "$$x" = "dummy" ]; then continue; fi; \
1034 fn=`basename $$x`; \
1035 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1036 cp $$x "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1037 chmod 644 "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1038 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
1041 uninstall_man_docs: build_man_docs
1042 @$(ECHO) "*** Uninstalling manpages"
1043 @set -e; for x in dummy $(MANDOCS1); do \
1044 if [ "$$x" = "dummy" ]; then continue; fi; \
1045 fn=`basename $$x`; \
1046 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1047 $(RM) "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1048 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
1050 @set -e; for x in dummy $(MANDOCS3); do \
1051 if [ "$$x" = "dummy" ]; then continue; fi; \
1052 fn=`basename $$x`; \
1053 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1054 $(RM) "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1055 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
1057 @set -e; for x in dummy $(MANDOCS5); do \
1058 if [ "$$x" = "dummy" ]; then continue; fi; \
1059 fn=`basename $$x`; \
1060 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1061 $(RM) "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1062 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
1064 @set -e; for x in dummy $(MANDOCS7); do \
1065 if [ "$$x" = "dummy" ]; then continue; fi; \
1066 fn=`basename $$x`; \
1067 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1068 $(RM) "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1069 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
1072 install_html_docs: install_image_docs build_html_docs
1073 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
1074 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man1"
1075 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man3"
1076 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man5"
1077 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7"
1078 @$(ECHO) "*** Installing HTML manpages"
1079 @set -e; for x in dummy $(HTMLDOCS1); do \
1080 if [ "$$x" = "dummy" ]; then continue; fi; \
1081 fn=`basename $$x`; \
1082 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1083 cp $$x "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1084 chmod 644 "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1086 @set -e; for x in dummy $(HTMLDOCS3); do \
1087 if [ "$$x" = "dummy" ]; then continue; fi; \
1088 fn=`basename $$x`; \
1089 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1090 cp $$x "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1091 chmod 644 "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1093 @set -e; for x in dummy $(HTMLDOCS5); do \
1094 if [ "$$x" = "dummy" ]; then continue; fi; \
1095 fn=`basename $$x`; \
1096 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1097 cp $$x "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1098 chmod 644 "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1100 @set -e; for x in dummy $(HTMLDOCS7); do \
1101 if [ "$$x" = "dummy" ]; then continue; fi; \
1102 fn=`basename $$x`; \
1103 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1104 cp $$x "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1105 chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1108 uninstall_html_docs: uninstall_image_docs
1109 @$(ECHO) "*** Uninstalling HTML manpages"
1110 @set -e; for x in dummy $(HTMLDOCS1); do \
1111 if [ "$$x" = "dummy" ]; then continue; fi; \
1112 fn=`basename $$x`; \
1113 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1114 $(RM) "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1116 @set -e; for x in dummy $(HTMLDOCS3); do \
1117 if [ "$$x" = "dummy" ]; then continue; fi; \
1118 fn=`basename $$x`; \
1119 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1120 $(RM) "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1122 @set -e; for x in dummy $(HTMLDOCS5); do \
1123 if [ "$$x" = "dummy" ]; then continue; fi; \
1124 fn=`basename $$x`; \
1125 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1126 $(RM) "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1128 @set -e; for x in dummy $(HTMLDOCS7); do \
1129 if [ "$$x" = "dummy" ]; then continue; fi; \
1130 fn=`basename $$x`; \
1131 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1132 $(RM) "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1136 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7/img"
1137 @set -e; for x in dummy $(IMAGEDOCS7); do \
1138 if [ "$$x" = "dummy" ]; then continue; fi; \
1139 fn=`basename $$x`; \
1140 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1141 cp $(SRCDIR)/$$x "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1142 chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1145 uninstall_image_docs:
1146 @set -e; for x in dummy $(IMAGEDOCS7); do \
1147 if [ "$$x" = "dummy" ]; then continue; fi; \
1148 fn=`basename $$x`; \
1149 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1150 $(RM) "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1153 # Developer targets (note: these are only available on Unix) #########
1154 ##@ Code maintenance
1156 # It's important that generate_buildinfo comes after ordinals, as ordinals
1157 # is sensitive to build.info changes.
1158 update: generate errors ordinals generate_buildinfo ## Update errors, ordinals and build info
1160 .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \
1161 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1162 generate: generate_apps generate_crypto_bn generate_crypto_objects \
1163 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1165 .PHONY: generate_buildinfo generate_doc_buildinfo
1166 generate_buildinfo: generate_doc_buildinfo
1168 .PHONY: doc-nits md-nits
1169 doc-nits: build_generated_pods ## Evaluate OpenSSL documentation
1170 $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e
1172 # This uses "mdl", the markdownlint application, which is written in ruby.
1173 # The source is at https://github.com/markdownlint/markdownlint
1174 # If you have ruby installed, "gem install mdl" should work.
1175 # Another option is at https://snapcraft.io/install/mdl/debian
1176 # Finally, there's a Node.js version, which we haven't tried, that
1177 # can be found at https://github.com/DavidAnson/markdownlint
1178 md-nits: ## Evaluate markdown files via "mdl"
1179 mdl -s $(SRCDIR)/util/markdownlint.rb .
1181 # Test coverage is a good idea for the future
1182 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1186 lint: ## Evaluate C code via "splint"
1188 echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \
1189 -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) )
1191 .PHONY: check-format
1192 check-format: ## Evaluate C code according to OpenSSL coding standards
1193 ( cd $(SRCDIR); $(PERL) util/check-format.pl \
1194 $(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) )
1197 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1198 < apps/openssl.cnf > apps/openssl-vms.cnf )
1201 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1203 generate_crypto_objects:
1204 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1205 crypto/objects/objects.txt \
1206 crypto/objects/obj_mac.num \
1207 > crypto/objects/obj_mac.new && \
1208 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1209 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1210 crypto/objects/objects.txt \
1211 crypto/objects/obj_mac.num \
1212 > include/openssl/obj_mac.h )
1213 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1214 include/openssl/obj_mac.h \
1215 > crypto/objects/obj_dat.h )
1216 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1217 crypto/objects/obj_mac.num \
1218 crypto/objects/obj_xref.txt \
1219 > crypto/objects/obj_xref.h )
1220 ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1222 generate_crypto_conf:
1223 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1224 > crypto/conf/conf_def.h )
1226 generate_crypto_asn1:
1227 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1228 > crypto/asn1/charmap.h )
1231 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1232 crypto/objects/obj_dat.h \
1235 generate_doc_buildinfo:
1236 ( $(PERL) -I$(BLDDIR) -Mconfigdata \
1237 $(SRCDIR)/util/dofile.pl -o Makefile \
1238 $(SRCDIR)/doc/build.info.in \
1239 > $(SRCDIR)/doc/build.info.new; \
1240 if ( test -e $(SRCDIR)/doc/build.info \
1241 && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
1244 rm $(SRCDIR)/doc/build.info.new; \
1246 mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
1249 generate_fips_sources: providers/fips.module.sources.new
1250 providers/fips.module.sources.new: configdata.pm
1254 srcdir=`cd $(SRCDIR); pwd`; \
1256 && $$srcdir/Configure --banner=Configured enable-fips -O0 \
1257 && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \
1258 && "$(MAKE)" -sj 4 build_generated providers/fips.so \
1259 && find . -name '*.d' | xargs cat > dep1 \
1260 && "$(MAKE)" distclean \
1261 && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \
1262 && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \
1263 && "$(MAKE)" -sj 4 build_generated providers/fips.so \
1264 && find . -name '*.d' | xargs cat > dep2 \
1265 && cat sources1 sources2 \
1266 | grep -v ' : \\$$' | grep -v util/providers.num \
1267 | sed -e 's/^ *//' -e 's/ *\\$$//' \
1268 | sort | uniq > sources \
1270 | $(PERL) -p -e 's/\\\n//' \
1271 | sed -e 's/^.*: *//' -e 's/ */ /g' \
1272 | fgrep -f sources \
1274 | sort | uniq > deps.raw \
1276 | xargs ./configdata.pm --query 'get_sources(@ARGV)' \
1277 | $(PERL) -p -e 's/\\\n//' \
1278 | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \
1280 && cat deps.raw | sed -f deps.sed > deps \
1283 cat sources-tmp/sources sources-tmp/deps \
1284 | $(PERL) -p -e 's:^ *\Q../\E:: ;' \
1285 -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \
1286 -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \
1288 for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \
1289 crypto/aes/asm/*.pl crypto/aes/asm/*.S \
1290 crypto/ec/asm/*.pl \
1291 crypto/modes/asm/*.pl \
1292 crypto/sha/asm/*.pl \
1293 crypto/*cpuid.pl crypto/*cpuid.S \
1297 ) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new
1300 # Set to -force to force a rebuild
1303 ( b=`pwd`; set -e; cd $(SRCDIR); \
1304 $(PERL) util/ck_errf.pl -strict -internal; \
1305 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1306 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1307 for E in *.ec ; do \
1308 $(PERL) ../util/ck_errf.pl -strict \
1309 -conf $$E `basename $$E .ec`.c; \
1310 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1311 -conf $$E `basename $$E .ec`.c ; \
1314 {- use File::Basename;
1316 my @sslheaders_tmpl =
1317 qw( include/openssl/ssl.h
1318 include/openssl/ssl2.h
1319 include/openssl/ssl3.h
1320 include/openssl/sslerr.h
1321 include/openssl/tls1.h
1322 include/openssl/dtls1.h
1323 include/openssl/srtp.h
1324 include/openssl/quic.h
1325 include/openssl/sslerr_legacy.h );
1326 my @cryptoheaders_tmpl =
1327 qw( include/internal/dso.h
1328 include/internal/o_dir.h
1329 include/internal/err.h
1330 include/internal/evp.h
1331 include/internal/pem.h
1332 include/internal/asn1.h
1333 include/internal/sslconf.h );
1334 my @cryptoskipheaders = ( @sslheaders_tmpl,
1335 qw( include/openssl/asn1_mac.h
1336 include/openssl/conf_api.h
1337 include/openssl/ebcdic.h
1338 include/openssl/opensslconf.h
1339 include/openssl/symhacks.h ) );
1340 our %cryptoheaders = ();
1341 our %sslheaders = ();
1342 foreach my $d ( qw( include/openssl include/internal ) ) {
1343 my @header_patterns =
1344 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1345 foreach my $f ( map { glob($_) } @header_patterns ) {
1346 my $base = basename($f);
1347 my $base_in = basename($f, '.in');
1348 my $dir = catfile($config{sourcedir}, $d);
1349 if ($base ne $base_in) {
1350 # We have a .h.in file, which means the header file is in the
1353 $dir = catfile($config{builddir}, $d);
1355 my $new_f = catfile($dir, $base);
1356 my $fn = "$d/$base";
1357 # The logic to add files to @cryptoheaders is a bit complex. The
1358 # file to be added must be either in the public header directory
1359 # or one of the pre-declared internal headers, and must under no
1360 # circumstances be one of those that must be skipped.
1361 $cryptoheaders{$new_f} = 1
1362 if (($d eq 'include/openssl'
1363 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1364 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1365 # The logic to add files to @sslheaders is much simpler...
1366 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1372 sub uniq { my %seen; grep !$seen{$_}++, @_; }
1373 sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; }
1374 join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5,
1375 uniq(grep /\.(c|cc|cpp)$/,
1376 flat (map { $unified_info{sources}->{$_} }
1377 (sort keys %{$unified_info{sources}})))))
1379 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1380 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1381 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1382 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1384 renumber: build_generated
1385 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1386 --ordinals $(SRCDIR)/util/libcrypto.num \
1387 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1390 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1391 --ordinals $(SRCDIR)/util/libssl.num \
1392 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1397 ordinals: build_generated
1398 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1399 --ordinals $(SRCDIR)/util/libcrypto.num \
1400 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1402 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1403 --ordinals $(SRCDIR)/util/libssl.num \
1404 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1408 "$(MAKE)" run_tests TESTS=test_ordinals
1412 -( cd $(SRCDIR); util/ctags.sh )
1413 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1415 providers/fips.checksum.new: providers/fips.module.sources.new
1416 @which unifdef > /dev/null || \
1417 ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \
1419 ( sources=`pwd`/providers/fips.module.sources.new; \
1422 | xargs ./util/fips-checksums.sh ) \
1423 > providers/fips-sources.checksums.new \
1424 && sha256sum providers/fips-sources.checksums.new \
1425 | sed -e 's|\.new||' > providers/fips.checksum.new
1427 fips-checksums: providers/fips.checksum.new
1429 $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new
1430 cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources
1431 cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums
1432 cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum
1434 update-fips-checksums: $(SRCDIR)/providers/fips.checksum
1436 diff-fips-checksums: fips-checksums
1437 diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new
1438 diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new
1439 diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new
1441 # Release targets (note: only available on Unix) #####################
1444 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1446 # Helper targets #####################################################
1448 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf
1450 $(BLDDIR)/util/opensslwrap.sh: Makefile
1451 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1452 mkdir -p "$(BLDDIR)/util"; \
1453 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1456 $(BLDDIR)/apps/openssl.cnf: Makefile
1457 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1458 mkdir -p "$(BLDDIR)/apps"; \
1459 ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
1464 # Building targets ###################################################
1466 Makefile: configdata.pm \
1467 {- join(" \\\n" . ' ' x 10,
1468 fill_lines(" ", $COLUMNS - 10,
1469 @{$config{build_file_templates}})) -}
1470 @echo "Detected changed: $?"
1471 $(PERL) configdata.pm
1472 @echo "**************************************************"
1474 @echo "*** Please run the same make command again ***"
1476 @echo "**************************************************"
1479 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1480 {- join(" \\\n" . ' ' x 15,
1481 fill_lines(" ", $COLUMNS - 15,
1482 @{$config{build_infos}},
1483 @{$config{conf_files}})) -}
1484 @echo "Detected changed: $?"
1485 $(PERL) configdata.pm -r
1486 @echo "**************************************************"
1488 @echo "*** Please run the same make command again ***"
1490 @echo "**************************************************"
1494 $(PERL) configdata.pm -r
1498 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1500 # Helper function to convert dependencies in platform agnostic form to
1501 # dependencies in platform form.
1502 sub compute_platform_depends {
1505 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
1506 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
1507 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
1508 or platform->convertext($x); } @_;
1511 # Helper function to figure out dependencies on libraries
1512 # It takes a list of library names and outputs a list of dependencies
1513 sub compute_lib_depends {
1514 # Depending on shared libraries:
1515 # On Windows POSIX layers, we depend on {libname}.dll.a
1516 # On Unix platforms, we depend on {shlibname}.so
1517 return map { platform->sharedlib_simple($_)
1518 // platform->sharedlib_import($_)
1519 // platform->sharedlib($_)
1520 // platform->staticlib($_)
1524 sub generatetarget {
1526 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
1528 $args{target}: $deps
1534 my $gen0 = $args{generator}->[0];
1535 my $gen_args = join('', map { " $_" }
1536 @{$args{generator}}[1..$#{$args{generator}}]);
1537 my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1538 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1539 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1540 my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}},
1543 if ($args{src} =~ /\.html$/) {
1547 my $title = basename($args{src}, ".html");
1551 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1553 } elsif ($args{src} =~ /\.(\d)$/) {
1555 # Man-page generator
1558 my $name = uc basename($args{src}, ".$section");
1562 pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
1563 --release=\$(VERSION) $pod >\$\@
1565 } elsif (platform->isdef($args{src})) {
1567 # Linker script-ish generator
1569 my $target = platform->def($args{src});
1570 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1571 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
1572 my $ord_name = $args{generator}->[1] || $args{product};
1574 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
1575 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
1577 } elsif (platform->isasm($args{src})
1578 || platform->iscppasm($args{src})) {
1580 # Assembler generator
1583 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1584 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1585 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1586 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1587 } -> {$args{intent}};
1590 if ($gen0 =~ /\.pl$/) {
1591 $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
1592 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1593 } elsif ($gen0 =~ /\.m4$/) {
1594 $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
1595 } elsif ($gen0 =~ /\.S$/) {
1598 die "Generator type for $args{src} unknown: $gen0\n";
1601 if (defined($generator)) {
1603 $args{src}: $gen0 $deps
1608 $args{src}: $gen0 $deps
1609 \$(CC) $incs $cppflags $defs -E $gen0 | \\
1610 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1612 } elsif ($gen0 =~ m|^.*\.in$|) {
1614 # "dofile" generator (file.in -> file)
1616 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1617 "util", "dofile.pl")),
1618 rel2abs($config{builddir}));
1619 my @perlmodules = ();
1620 my %perlmoduleincs = ();
1621 my %perlmoduledeps = ();
1622 foreach my $x (('configdata.pm', @{$args{deps}})) {
1623 # Compute (i)nclusion directory, (m)odule name and (d)ependency
1629 # Massage the module part to become a real perl module spec
1632 # Directory specs are :: in perl package names
1635 # Full file name of the dependency
1636 $d = catfile($i, $d) if $i;
1637 } elsif ($x =~ /\.pm$/) {
1639 $m = basename($x, '.pm');
1642 # All other dependencies are simply collected
1645 push @perlmodules, '"-M'.$m.'"' if $m;
1646 $perlmoduledeps{$d} = 1;
1647 $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i;
1650 # Because of the special treatment of dependencies, we need to
1651 # recompute $deps completely
1653 = join(" ", compute_platform_depends(@{$args{generator_deps}},
1654 sort keys %perlmoduledeps));
1655 my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules);
1658 $args{src}: $gen0 $deps
1659 \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
1661 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1663 # Generic generator using OpenSSL programs
1666 # Redo $gen0, to ensure that we have the proper extension where
1668 $gen0 = platform->bin($gen0);
1669 # Use $(PERL) to execute wrap.pl directly to avoid calling env
1671 $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
1672 \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
1676 # Generic generator using Perl
1679 $args{src}: $gen0 $deps
1680 \$(PERL)$gen_incs $gen0$gen_args > \$@
1685 # Should one wonder about the end of the Perl snippet, it's because this
1686 # second regexp eats up line endings as well, if the removed path is the
1687 # last in the line. We may therefore need to put back a line ending.
1690 my $obj = platform->convertext($args{obj});
1691 my $dep = platform->dep($args{obj});
1692 my @srcs = @{$args{srcs}};
1693 my $srcs = join(" ", @srcs);
1694 my $deps = join(" ", @srcs, @{$args{deps}});
1695 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1696 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1700 if (grep /\.rc$/, @srcs) {
1702 $cmdflags = '$(RCFLAGS)';
1704 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1706 $cmdcompile = ' -c';
1708 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1709 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1710 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1711 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1712 } -> {$args{intent}};
1715 $cmdcompile = ' -c';
1717 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1718 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1719 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1720 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1721 } -> {$args{intent}};
1724 # extension-specific rules
1725 if (grep /\.s$/, @srcs) {
1728 $cmd $cmdflags -c -o \$\@ $srcs
1730 } elsif (grep /\.S$/, @srcs) {
1731 # Originally there was multi-step rule with $(CC) -E file.S
1732 # followed by $(CC) -c file.s. It compensated for one of
1733 # legacy platform compiler's inability to handle .S files.
1734 # The platform is long discontinued by vendor so there is
1735 # hardly a point to drag it along...
1738 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1740 } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
1743 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1745 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1748 mv $dep.tmp $dep; \\
1754 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1756 if ($makedep_scheme eq 'makedepend') {
1758 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1765 # We *know* this routine is only called when we've configure 'shared'.
1770 foreach (@{$args{deps}}) {
1771 if (platform->isstaticlib($_)) {
1772 push @linklibs, platform->convertext($_);
1774 my $d = "-L" . dirname($_);
1775 my $l = basename($_);
1779 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1782 my $linkflags = join("", map { $_." " } @linkdirs);
1783 my $linklibs = join("", map { $_." " } @linklibs);
1784 my @objs = map { platform->convertext($_) }
1785 grep { !platform->isdef($_) }
1787 my @defs = map { platform->def($_) }
1788 grep { platform->isdef($_) }
1790 my @deps = compute_lib_depends(@{$args{deps}});
1791 die "More than one exported symbol map" if scalar @defs > 1;
1793 my $full = platform->sharedlib($args{lib});
1794 # $import is for Windows and subsystems thereof, where static import
1795 # libraries for DLLs are a thing. On platforms that have this mechanism,
1796 # $import has the name of this import library. On platforms that don't
1797 # have this mechanism, $import will be |undef|.
1798 # It's also used on AIX in solib mode, which creates import libraries
1799 # for the shared libraries.
1800 my $import = platform->sharedlib_import($args{lib});
1801 # $simple is for platforms where full shared library names include the
1802 # shared library version, and there's a simpler name that doesn't include
1803 # that version. On such platforms, $simple has the simpler name. On
1804 # other platforms, it will be |undef|.
1805 my $simple = platform->sharedlib_simple($args{lib});
1807 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1808 my $shared_soname = "";
1809 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1810 if defined $target{shared_sonameflag};
1811 my $shared_imp = "";
1812 $shared_imp .= ' '.$target{shared_impflag}.basename($import)
1813 if defined $target{shared_impflag} && defined $import;
1814 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1816 # There is at least one platform where the compiler-as-linker needs to
1817 # have one object file directly on the command line. That won't hurt
1818 # any other platform, so we do that for everyone when there's an argfile
1819 # to be had. This depends heavily on splice, which removes elements from
1820 # the given array, and returns them so they can be captured.
1821 my @argfileobjs = $argfile
1824 my $argfilecmds = $argfile
1825 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1827 my $argfiledeps = $argfile
1828 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1829 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1831 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1834 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1837 join(" \\\n" . ' ' x (length($full) + 2),
1838 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1840 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1844 if (defined $simple && $simple ne $full) {
1849 \$(AR) r $simple $full
1859 if (defined $import) {
1860 if (sharedaix_solib()) {
1862 $import: $full $defs[0]
1864 echo \\#!$full > $import && \\
1865 cat $defs[0] >>$import
1875 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1876 -o $full$shared_def \\
1878 $linklibs \$(LIB_EX_LIBS)
1887 if (!$disabled{tests}) {
1894 $recipe .= <<"EOF" if defined $argfile;
1895 $argfile: $argfiledeps
1903 my $dso = platform->dso($args{module});
1906 foreach (@{$args{deps}}) {
1907 next unless defined $_;
1908 if (platform->isstaticlib($_)) {
1909 push @linklibs, platform->convertext($_);
1911 my $d = "-L" . dirname($_);
1912 my $l = basename($_);
1916 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1919 my $linkflags = join("", map { $_." " } @linkdirs);
1920 my $linklibs = join("", map { $_." " } @linklibs);
1921 my @objs = map { platform->convertext($_) }
1922 grep { !platform->isdef($_) }
1924 my @defs = map { platform->def($_) }
1925 grep { platform->isdef($_) }
1927 my @deps = compute_lib_depends(@{$args{deps}});
1928 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1929 # Next line needs to become "less magic" (see PR #11950)
1930 $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/);
1931 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1932 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1933 fill_lines(' ', $COLUMNS - length($dso) - 2,
1934 @objs, @defs, @deps));
1938 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1939 -o $dso$shared_def \\
1941 $linklibs\$(DSO_EX_LIBS)
1946 my $lib = platform->staticlib($args{lib});
1947 my @objs = map { platform->obj($_) } @{$args{objs}};
1948 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1949 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1950 my $max_per_call = 500;
1952 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1954 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1959 \$(RANLIB) \$\@ || echo Never mind.
1964 my $bin = platform->bin($args{bin});
1965 my @objs = map { platform->obj($_) } @{$args{objs}};
1966 my @deps = compute_lib_depends(@{$args{deps}});
1967 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1968 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1971 foreach (@{$args{deps}}) {
1972 next unless defined $_;
1973 if (platform->isstaticlib($_)) {
1974 push @linklibs, platform->convertext($_);
1976 my $d = "-L" . dirname($_);
1977 my $l = basename($_);
1981 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1984 my $linkflags = join("", map { $_." " } @linkdirs);
1985 my $linklibs = join("", map { $_." " } @linklibs);
1987 my $cmdflags = '$(BIN_CFLAGS)';
1988 if (grep /_cc\.o$/, @{$args{objs}}) {
1990 $cmdflags = '$(BIN_CXXFLAGS)';
1993 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1994 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1995 fill_lines(' ', $COLUMNS - length($bin) - 2,
2001 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
2004 $linklibs\$(BIN_EX_LIBS)
2009 my $script = $args{script};
2010 my $sources = join(" ", @{$args{sources}});
2011 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
2012 "util", "dofile.pl")),
2013 rel2abs($config{builddir}));
2015 $script: $sources configdata.pm
2017 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
2018 "-o$target{build_file}" $sources > "$script"
2024 my $dir = $args{dir};
2025 my @deps = compute_platform_depends(@{$args{deps}});
2028 # We already have a 'test' target, and the top directory is just plain
2030 return if $dir eq "test" || $dir eq ".";
2032 foreach my $type (("dso", "lib", "bin", "script")) {
2033 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
2034 # For lib object files, we could update the library. However, it
2035 # was decided that it's enough to build the directory local object
2036 # files, so we don't need to add any actions, and the dependencies
2037 # are already taken care of.
2038 if ($type ne "lib") {
2039 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
2040 if (dirname($prod) eq $dir) {
2041 push @deps, compute_platform_depends($prod);
2043 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
2049 my $target = "$dir $dir/";
2050 my $deps = join(" \\\n\t",
2051 fill_lines(' ', $COLUMNS - 8, @deps));
2052 my $comments = join("\n", "", @comments);
2058 "" # Important! This becomes part of the template result.