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.
15 sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
17 our $sover_dirname = platform->shlib_version_as_filename();
19 # This makes sure things get built in the order they need
25 return "$target: build_generated ## $help\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
28 our $COLUMNS = $ENV{COLUMNS};
29 if ($COLUMNS =~ /^\d+$/) {
30 $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
36 my $item_sep = shift; # string
37 my $line_length = shift; # number of chars
43 my $fill_line = $result[$resultpos] // '';
45 ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
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;
53 $result[++$resultpos] = $_;
56 $result[$resultpos] = $newline;
63 PLATFORM={- $config{target} -}
64 OPTIONS={- $config{options} -}
65 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
66 SRCDIR={- $config{sourcedir} -}
67 BLDDIR={- $config{builddir} -}
68 FIPSKEY={- $config{FIPSKEY} -}
70 VERSION={- "$config{full_version}" -}
71 VERSION_NUMBER={- "$config{version}" -}
72 MAJOR={- $config{major} -}
73 MINOR={- $config{minor} -}
74 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
75 SHLIB_TARGET={- $target{shared_target} -}
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($_);
88 my $y = platform->sharedlib_simple($_) // '';
89 my $z = platform->sharedlib_import($_) // '';
90 $x ? "\"$x;$y;$z\"" : () }
91 @{$unified_info{libraries}})) -}
92 MODULES={- join(" \\\n" . ' ' x 8,
93 fill_lines(" ", $COLUMNS - 8,
94 map { platform->dso($_) }
95 # Drop all modules that are dependencies, they will
96 # be processed through their dependents
98 !grep { grep { $_ eq $x } @$_ }
99 values %{$unified_info{depends}} }
100 @{$unified_info{modules}})) -}
101 FIPSMODULE={- # We do some extra checking here, as there should be only one
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;
110 join(" ", map { basename(platform->dso($_)) } @fipsmodules) -}
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}})) -}
118 {- output_off() if $disabled{makedepend}; "" -}
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}})); -}
124 {- output_on() if $disabled{makedepend}; "" -}
125 GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
126 fill_lines(" ", $COLUMNS - 20,
127 @{$unified_info{depends}->{""}})) -}
128 GENERATED_PODS={- # common0.tmpl provides @generated
129 join(" \\\n" . ' ' x 15,
130 fill_lines(" ", $COLUMNS - 15,
134 $unified_info{attributes}->{depends}
135 ->{$x}->{$_}->{pod} // 0
137 keys %{$unified_info{attributes}->{depends}->{$x}}
141 GENERATED={- # common0.tmpl provides @generated
142 join(" \\\n" . ' ' x 5,
143 fill_lines(" ", $COLUMNS - 5,
144 map { platform->convertext($_) } @generated )) -}
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}}))
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}}))
160 INSTALL_SHLIB_INFO={-
161 join(" \\\n" . ' ' x 19,
162 fill_lines(" ", $COLUMNS - 19,
163 map { my $x = platform->sharedlib($_);
164 my $y = platform->sharedlib_simple($_) // '';
165 my $z = platform->sharedlib_import($_) // '';
166 $x ? "\"$x;$y;$z\"" : () }
167 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
168 @{$unified_info{libraries}}))
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}}))
179 join(" \\\n" . ' ' x 16,
180 fill_lines(" ", $COLUMNS - 16,
181 map { platform->dso($_) }
182 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
183 && !$unified_info{attributes}->{modules}->{$_}->{engine}
184 && !$unified_info{attributes}->{modules}->{$_}->{fips} }
185 @{$unified_info{modules}}))
187 INSTALL_FIPSMODULE={-
188 join(" \\\n" . ' ' x 16,
189 fill_lines(" ", $COLUMNS - 16,
190 map { platform->dso($_) }
191 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
192 && $unified_info{attributes}->{modules}->{$_}->{fips} }
193 @{$unified_info{modules}}))
195 INSTALL_FIPSMODULECONF=providers/fipsmodule.cnf
197 join(" \\\n" . ' ' x 16,
198 fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
199 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
200 @{$unified_info{programs}}))
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}}))
208 INSTALL_EXPORTERS_CMAKE={-
209 join(" \\\n" . ' ' x 24,
210 fill_lines(" ", $COLUMNS - 24,
211 grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'cmake'}
212 sort keys %{$unified_info{generate}}))
215 join(" \\\n" . ' ' x 12,
216 fill_lines(" ", $COLUMNS - 12,
217 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
219 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
220 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
221 @{$unified_info{scripts}}))
224 join(" \\\n" . ' ' x 13,
225 fill_lines(" ", $COLUMNS - 13,
226 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
228 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
229 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
230 @{$unified_info{scripts}}))
233 join(" \\\n" . ' ' x 10,
234 fill_lines(" ", $COLUMNS - 10,
235 @{$unified_info{imagedocs}->{man1}})) -}
237 join(" \\\n" . ' ' x 10,
238 fill_lines(" ", $COLUMNS - 10,
239 @{$unified_info{imagedocs}->{man3}})) -}
241 join(" \\\n" . ' ' x 10,
242 fill_lines(" ", $COLUMNS - 10,
243 @{$unified_info{imagedocs}->{man5}})) -}
245 join(" \\\n" . ' ' x 10,
246 fill_lines(" ", $COLUMNS - 10,
247 @{$unified_info{imagedocs}->{man7}})) -}
249 join(" \\\n" . ' ' x 10,
250 fill_lines(" ", $COLUMNS - 10,
251 @{$unified_info{htmldocs}->{man1}})) -}
253 join(" \\\n" . ' ' x 10,
254 fill_lines(" ", $COLUMNS - 10,
255 @{$unified_info{htmldocs}->{man3}})) -}
257 join(" \\\n" . ' ' x 10,
258 fill_lines(" ", $COLUMNS - 10,
259 @{$unified_info{htmldocs}->{man5}})) -}
261 join(" \\\n" . ' ' x 10,
262 fill_lines(" ", $COLUMNS - 10,
263 @{$unified_info{htmldocs}->{man7}})) -}
265 join(" \\\n" . ' ' x 9,
266 fill_lines(" ", $COLUMNS - 9,
267 @{$unified_info{mandocs}->{man1}})) -}
269 join(" \\\n" . ' ' x 9,
270 fill_lines(" ", $COLUMNS - 9,
271 @{$unified_info{mandocs}->{man3}})) -}
273 join(" \\\n" . ' ' x 9,
274 fill_lines(" ", $COLUMNS - 9,
275 @{$unified_info{mandocs}->{man5}})) -}
277 join(" \\\n" . ' ' x 9,
278 fill_lines(" ", $COLUMNS - 9,
279 @{$unified_info{mandocs}->{man7}})) -}
281 APPS_OPENSSL="{- use File::Spec::Functions;
282 catfile("apps","openssl") -}"
284 # DESTDIR is for package builders so that they can configure for, say,
285 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
286 # Normally it is left empty.
289 # Do not edit these manually. Use Configure with --prefix or --openssldir
290 # to change this! Short explanation in the top comment in Configure
291 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
293 our $prefix = $config{prefix} || "/usr/local";
296 # The logic here is that if no --openssldir was given,
297 # OPENSSLDIR will get the value from $prefix plus "/ssl".
298 # If --openssldir was given and the value is an absolute
299 # path, OPENSSLDIR will get its value without change.
300 # If the value from --openssldir is a relative path,
301 # OPENSSLDIR will get $prefix with the --openssldir
302 # value appended as a subdirectory.
304 use File::Spec::Functions;
306 $config{openssldir} ?
307 (file_name_is_absolute($config{openssldir}) ?
309 : catdir($prefix, $config{openssldir}))
310 : catdir($prefix, "ssl");
312 LIBDIR={- our $libdir = $config{libdir};
314 $libdir = "lib$target{multilib}";
316 file_name_is_absolute($libdir) ? "" : $libdir -}
317 # $(libdir) is chosen to be compatible with the GNU coding standards
318 libdir={- file_name_is_absolute($libdir)
319 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
320 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
321 MODULESDIR=$(libdir)/ossl-modules
323 # Convenience variable for those who want to set the rpath in shared
324 # libraries and applications
327 BINDIR={- our $bindir = $config{bindir};
329 $bindir = "bin$target{multibin}";
331 file_name_is_absolute($bindir) ? "" : $bindir -}
332 bindir={- file_name_is_absolute($bindir)
333 ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -}
335 PKGCONFIGDIR=$(libdir)/pkgconfig
336 CMAKECONFIGDIR=$(libdir)/cmake/OpenSSL
338 MANDIR=$(INSTALLTOP)/share/man
339 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
340 HTMLDIR=$(DOCDIR)/html
342 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
343 # appended after the manpage file section number. "ssl" is popular,
344 # resulting in files such as config.5ssl rather than config.5.
348 # For "optional" echo messages, to get "real" silence
351 ##### User defined commands and flags ################################
353 # We let the C compiler driver to take care of .s files. This is done in
354 # order to be excused from maintaining a separate set of architecture
355 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
356 # gcc, then the driver will automatically translate it to -xarch=v8plus
357 # and pass it down to assembler. In any case, we do not define AS or
358 # ASFLAGS for this reason.
360 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
361 CC=$(CROSS_COMPILE){- $config{CC} -}
362 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
363 CPPFLAGS={- our $cppflags1 = join(" ",
364 (map { "-D".$_} @{$config{CPPDEFINES}}),
365 (map { "-I".$_} @{$config{CPPINCLUDES}}),
366 @{$config{CPPFLAGS}}) -}
367 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
368 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
369 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
370 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
372 MAKEDEPEND={- $config{makedepcmd} -}
374 PERL={- $config{PERL} -}
376 AR=$(CROSS_COMPILE){- $config{AR} -}
377 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
378 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
379 RC= $(CROSS_COMPILE){- $config{RC} -}
380 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
384 TAR= {- $target{TAR} || "tar" -}
385 TARFLAGS= {- $target{TARFLAGS} -}
388 NAME= $(BASENAME)-$(VERSION)
389 # Relative to $(SRCDIR)
390 TARFILE= ../$(NAME).tar
392 ##### Project flags ##################################################
394 # Variables starting with CNF_ are common variables for all product types
396 CNF_CPPFLAGS={- our $cppflags2 =
397 join(' ', $target{cppflags} || (),
398 (map { "-D".$_} @{$target{defines}},
399 @{$config{defines}}),
400 (map { "-I".$_} @{$target{includes}},
401 @{$config{includes}}),
402 @{$config{cppflags}}) -}
403 CNF_CFLAGS={- join(' ', $target{cflags} || (),
404 @{$config{cflags}}) -}
405 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
406 @{$config{cxxflags}}) -}
407 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
408 @{$config{lflags}}) -}
409 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
410 @{$config{ex_libs}}) -}
412 # Variables starting with LIB_ are used to build library object files
413 # and shared libraries.
414 # Variables starting with DSO_ are used to build DSOs and their object files.
415 # Variables starting with BIN_ are used to build programs and their object
418 LIB_CPPFLAGS={- our $lib_cppflags =
419 join(' ', $target{lib_cppflags} || (),
420 $target{shared_cppflag} || (),
422 @{$target{lib_defines} || ()},
423 @{$target{shared_defines} || ()},
424 @{$config{lib_defines} || ()},
425 @{$config{shared_defines} || ()}),
426 (map { '-I'.quotify1($_) }
427 @{$target{lib_includes}},
428 @{$target{shared_includes}},
429 @{$config{lib_includes}},
430 @{$config{shared_includes}}),
431 @{$config{lib_cppflags}},
432 @{$config{shared_cppflag}});
433 join(' ', $lib_cppflags,
435 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
436 'ENGINESDIR="\"$(ENGINESDIR)\""',
437 'MODULESDIR="\"$(MODULESDIR)\""'),
438 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
439 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
440 $target{shared_cflag} || (),
441 @{$config{lib_cflags}},
442 @{$config{shared_cflag}},
443 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
444 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
445 $target{shared_cxxflag} || (),
446 @{$config{lib_cxxflags}},
447 @{$config{shared_cxxflag}},
448 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
449 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
450 $config{shared_ldflag} || (),
451 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
452 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
453 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
454 $target{module_cppflags} || (),
456 @{$target{dso_defines}},
457 @{$target{module_defines}},
458 @{$config{dso_defines} || ()},
459 @{$config{module_defines} || ()}),
460 (map { '-I'.quotify1($_) }
461 @{$target{dso_includes}},
462 @{$target{module_includes}},
463 @{$config{dso_includes}},
464 @{$config{module_includes}}),
465 @{$config{dso_cppflags}},
466 @{$config{module_cppflags}},
467 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
468 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
469 $target{module_cflags} || (),
470 @{$config{dso_cflags}},
471 @{$config{module_cflags}},
472 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
473 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
474 $target{module_cxxflags} || (),
475 @{$config{dso_cxxflags}},
476 @{$config{module_cxxflag}},
477 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
478 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
479 $target{module_ldflags} || (),
480 @{$config{dso_ldflags}},
481 @{$config{module_ldflags}},
482 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
483 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
484 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
485 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
486 @{$config{bin_cppflags}},
487 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
488 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
489 @{$config{bin_cflags}},
490 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
491 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
492 @{$config{bin_cxxflags}},
493 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
494 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
495 @{$config{bin_lflags}},
496 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
497 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
499 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
500 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
501 $cppflags2 =~ s|([\\"])|\\$1|g;
502 $lib_cppflags =~ s|([\\"])|\\$1|g;
503 join(' ', $lib_cppflags || (), $cppflags2 || (),
506 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
508 # For x86 assembler: Set PROCESSOR to 386 if you want to support
510 PROCESSOR= {- $config{processor} -}
512 # We want error [and other] messages in English. Trouble is that make(1)
513 # doesn't pass macros down as environment variables unless there already
514 # was corresponding variable originally set. In other words we can only
515 # reassign environment variables, but not set new ones, not in portable
516 # manner that is. That's why we reassign several, just to be sure...
521 # The main targets ###################################################
525 {- dependmagic('build_sw', 'Build all the software (default target)'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
526 {- dependmagic('build_libs', 'Build the libraries libssl and libcrypto'); -}: build_libs_nodep
527 {- dependmagic('build_modules', 'Build the modules (i.e. providers and engines)'); -}: build_modules_nodep
528 {- dependmagic('build_programs', 'Build the openssl executables and scripts'); -}: build_programs_nodep
530 all: build_sw {- "build_docs" if !$disabled{docs}; -} ## Build software and documentation
533 build_generated_pods: $(GENERATED_PODS)
534 build_docs: build_man_docs build_html_docs ## Create documentation
535 build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) ## Create manpages
536 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) ## Create HTML documentation
538 build_generated: $(GENERATED_MANDATORY)
539 build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
540 build_modules_nodep: $(MODULES)
541 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
543 # Kept around for backward compatibility
544 build_apps build_tests: build_programs
546 # Convenience target to prebuild all generated files, not just the mandatory
548 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
549 @ : {- output_off() if $disabled{makedepend}; "" -}
550 @echo "Warning: consider configuring with no-makedepend, because if"
551 @echo " target system doesn't have $(PERL),"
552 @echo " then make will fail..."
553 @ : {- output_on() if $disabled{makedepend}; "" -}
557 help: ## Show this help screen
558 @$(PERL) $(SRCDIR)/util/help.pl $(BLDDIR)/Makefile
561 test: tests ## Run tests (alias of "tests")
562 {- dependmagic('tests', 'Run tests'); -}: build_programs_nodep build_modules_nodep link-utils
565 @ : {- output_off() if $disabled{tests}; "" -}
569 FIPSKEY="$(FIPSKEY)" \
570 EXE_EXT={- platform->binext() -} \
571 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
572 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
573 @echo "Tests are not supported with your chosen Configure options"
574 @ : {- output_on() if !$disabled{tests}; "" -}
576 list-tests: ## List available tests that can be invoked via "make test TESTS=<name>"
577 @ : {- output_off() if $disabled{tests}; "" -}
578 $(MAKE) run_tests TESTS=list
579 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
580 @echo "Tests are not supported with your chosen Configure options"
581 @ : {- output_on() if !$disabled{tests}; "" -}
583 ##@ Workspace cleaning
586 @set -e; for s in $(SHLIB_INFO); do \
587 if [ "$$s" = ";" ]; then continue; fi; \
588 s1=`echo "$$s" | cut -f1 -d";"`; \
589 s2=`echo "$$s" | cut -f2 -d";"`; \
590 s3=`echo "$$s" | cut -f3 -d";"`; \
591 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
594 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
596 if [ "$$s2" != "" ]; then \
597 $(ECHO) $(RM) $$s2; \
600 if [ "$$s3" != "" ]; then \
601 $(ECHO) $(RM) $$s3; \
606 $(RM) *{- platform->defext() -}
608 clean: libclean ## Clean the workspace, keep the configuration
617 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS)
618 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
619 -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
620 -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
622 $(RM) tags TAGS doc-nits md-nits
623 $(RM) -r test/test-runs
624 $(RM) providers/fips*.new
625 -find . -type l \! -name '.*' -exec $(RM) {} \;
627 distclean: clean ## Clean and remove the configuration
628 $(RM) include/openssl/configuration.h
632 # We check if any depfile is newer than Makefile and decide to
633 # concatenate only if that is true.
635 @: {- output_off() if $disabled{makedepend}; "" -}
636 @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}"
637 @: {- output_on() if $disabled{makedepend}; "" -}
639 # Install helper targets #############################################
642 install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} ## Install software and documentation, create OpenSSL directories
644 uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation
646 install_sw: install_dev install_engines install_modules install_runtime ## Install just the software and libraries
648 uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev ## Uninstall the software and libraries
650 install_docs: install_man_docs install_html_docs ## Install manpages and HTML documentation
652 uninstall_docs: uninstall_man_docs uninstall_html_docs ## Uninstall manpages and HTML documentation
653 $(RM) -r "$(DESTDIR)$(DOCDIR)"
655 {- output_off() if $disabled{fips}; "" -}
656 install_fips: build_sw $(INSTALL_FIPSMODULECONF)
657 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
658 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)"
659 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)"
660 @$(ECHO) "*** Installing FIPS module"
661 @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
662 @cp "$(INSTALL_FIPSMODULE)" "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
663 @chmod 755 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
664 @mv -f "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" \
665 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
666 @$(ECHO) "*** Installing FIPS module configuration"
667 @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
668 @cp $(INSTALL_FIPSMODULECONF) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
671 @$(ECHO) "*** Uninstalling FIPS module configuration"
672 $(RM) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
673 @$(ECHO) "*** Uninstalling FIPS module"
674 $(RM) "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
675 {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
677 @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
680 @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
681 {- output_on() if !$disabled{fips}; "" -}
685 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs"
686 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private"
687 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc"
688 @set -e; for x in dummy $(MISC_SCRIPTS); do \
689 if [ "$$x" = "dummy" ]; then continue; fi; \
690 x1=`echo "$$x" | cut -f1 -d:`; \
691 x2=`echo "$$x" | cut -f2 -d:`; \
692 fn=`basename $$x1`; \
693 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
694 cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
695 chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
696 mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \
697 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
698 if [ "$$x1" != "$$x2" ]; then \
699 ln=`basename "$$x2"`; \
700 : {- output_off() unless windowsdll(); "" -}; \
701 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
702 cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
703 : {- output_on() unless windowsdll();
704 output_off() if windowsdll(); "" -}; \
705 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
706 ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
707 : {- output_on() if windowsdll(); "" -}; \
710 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
711 @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
712 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
713 @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
714 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
715 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
716 cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
717 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
719 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
720 @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
721 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
722 @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
723 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
724 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
725 cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
726 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
729 install_dev: install_runtime_libs
730 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
731 @$(ECHO) "*** Installing development files"
732 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl"
733 @ : {- output_off() if $disabled{uplink}; "" -}
734 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
735 @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
736 @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
737 @ : {- output_on() if $disabled{uplink}; "" -}
738 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
739 $(BLDDIR)/include/openssl/*.h; do \
741 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
742 cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
743 chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
745 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
746 @set -e; for l in $(INSTALL_LIBS); do \
748 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
749 cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \
750 $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \
751 chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \
752 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
753 "$(DESTDIR)$(libdir)/$$fn"; \
755 @ : {- output_off() if $disabled{shared}; "" -}
756 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
757 s1=`echo "$$s" | cut -f1 -d";"`; \
758 s2=`echo "$$s" | cut -f2 -d";"`; \
759 s3=`echo "$$s" | cut -f3 -d";"`; \
760 fn1=`basename "$$s1"`; \
761 fn2=`basename "$$s2"`; \
762 fn3=`basename "$$s3"`; \
763 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
764 if [ "$$fn2" != "" ]; then \
765 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
766 ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \
768 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
769 if [ "$$fn3" != "" ]; then \
770 $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
771 cp $$s3 "$(DESTDIR)$(libdir)/$$fn3.new"; \
772 chmod 755 "$(DESTDIR)$(libdir)/$$fn3.new"; \
773 mv -f "$(DESTDIR)$(libdir)/$$fn3.new" \
774 "$(DESTDIR)$(libdir)/$$fn3"; \
776 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
777 a="$(DESTDIR)$(libdir)/$$fn2"; \
778 $(ECHO) "install $$s1 -> $$a"; \
779 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
780 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
782 for so in `$(AR) t $$a`; do \
785 strip -X32_64 -e $$so; \
786 $(AR) r $$a.new $$so; \
789 $(AR) r $$a.new $$s1; \
791 : {- output_off() if sharedaix(); output_on(); "" -}; \
793 @ : {- output_on() if $disabled{shared}; "" -}
794 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(PKGCONFIGDIR)"
795 @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \
797 $(ECHO) "install $$e -> $(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
798 cp $$e "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
799 chmod 644 "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
801 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(CMAKECONFIGDIR)
802 @for e in $(INSTALL_EXPORTERS_CMAKE); do \
804 $(ECHO) "install $$e -> $(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \
805 cp $$e $(DESTDIR)$(CMAKECONFIGDIR)/$$fn; \
806 chmod 644 $(DESTDIR)$(CMAKECONFIGDIR)/$$fn; \
809 uninstall_dev: uninstall_runtime_libs
810 @$(ECHO) "*** Uninstalling development files"
811 @ : {- output_off() if $disabled{uplink}; "" -}
812 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
813 @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
814 @ : {- output_on() if $disabled{uplink}; "" -}
815 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
816 $(BLDDIR)/include/openssl/*.h; do \
818 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
819 $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
821 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl"
822 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include"
823 @set -e; for l in $(INSTALL_LIBS); do \
825 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
826 $(RM) "$(DESTDIR)$(libdir)/$$fn"; \
828 @ : {- output_off() if $disabled{shared}; "" -}
829 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
830 s1=`echo "$$s" | cut -f1 -d";"`; \
831 s2=`echo "$$s" | cut -f2 -d";"`; \
832 s3=`echo "$$s" | cut -f3 -d";"`; \
833 fn1=`basename "$$s1"`; \
834 fn2=`basename "$$s2"`; \
835 fn3=`basename "$$s3"`; \
836 : {- output_off() if windowsdll(); "" -}; \
837 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
838 $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \
839 if [ -n "$$fn2" ]; then \
840 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
841 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \
843 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
844 if [ -n "$$fn3" ]; then \
845 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
846 $(RM) "$(DESTDIR)$(libdir)/$$fn3"; \
848 : {- output_on() unless windowsdll(); "" -}; \
850 @ : {- output_on() if $disabled{shared}; "" -}
851 @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \
852 fn=`basename "$$e"`; \
853 $(RM) "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
855 @for e in $(INSTALL_EXPORTERS_CMAKE); do \
856 fn=`basename "$$e"`; \
857 $(RM) "$(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \
859 -$(RMDIR) "$(DESTDIR)$(PKGCONFIGDIR)"
860 -$(RMDIR) "$(DESTDIR)$(CMAKECONFIGDIR)"
861 -$(RMDIR) "$(DESTDIR)$(libdir)"
863 _install_modules_deps: install_runtime_libs build_modules
865 install_engines: _install_modules_deps
866 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
867 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/"
868 @$(ECHO) "*** Installing engines"
869 @set -e; for e in dummy $(INSTALL_ENGINES); do \
870 if [ "$$e" = "dummy" ]; then continue; fi; \
872 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
873 cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
874 chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
875 mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \
876 "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
880 @$(ECHO) "*** Uninstalling engines"
881 @set -e; for e in dummy $(INSTALL_ENGINES); do \
882 if [ "$$e" = "dummy" ]; then continue; fi; \
884 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
885 $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
887 -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)"
889 install_modules: _install_modules_deps
890 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
891 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/"
892 @$(ECHO) "*** Installing modules"
893 @set -e; for e in dummy $(INSTALL_MODULES); do \
894 if [ "$$e" = "dummy" ]; then continue; fi; \
896 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
897 cp $$e "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
898 chmod 755 "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
899 mv -f "$(DESTDIR)$(MODULESDIR)/$$fn.new" \
900 "$(DESTDIR)$(MODULESDIR)/$$fn"; \
904 @$(ECHO) "*** Uninstalling modules"
905 @set -e; for e in dummy $(INSTALL_MODULES); do \
906 if [ "$$e" = "dummy" ]; then continue; fi; \
908 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
909 $(RM) "$(DESTDIR)$(MODULESDIR)/$$fn"; \
911 -$(RMDIR) "$(DESTDIR)$(MODULESDIR)"
913 install_runtime: install_programs
915 install_runtime_libs: build_libs
916 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
917 @ : {- output_off() if windowsdll(); "" -}
918 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
919 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
920 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)/"
921 @ : {- output_on() unless windowsdll(); "" -}
922 @$(ECHO) "*** Installing runtime libraries"
923 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
924 if [ "$$s" = "dummy" ]; then continue; fi; \
926 : {- output_off() unless windowsdll(); "" -}; \
927 $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \
928 cp $$s "$(DESTDIR)$(bindir)/$$fn.new"; \
929 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
930 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
931 "$(DESTDIR)$(bindir)/$$fn"; \
932 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
933 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
934 cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \
935 chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \
936 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
937 "$(DESTDIR)$(libdir)/$$fn"; \
938 : {- output_on() if windowsdll(); "" -}; \
941 install_programs: install_runtime_libs build_programs
942 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
943 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)"
944 @$(ECHO) "*** Installing runtime programs"
945 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
946 if [ "$$x" = "dummy" ]; then continue; fi; \
948 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
949 cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
950 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
951 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
952 "$(DESTDIR)$(bindir)/$$fn"; \
954 @set -e; for x in dummy $(BIN_SCRIPTS); do \
955 if [ "$$x" = "dummy" ]; then continue; fi; \
957 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
958 cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
959 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
960 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
961 "$(DESTDIR)$(bindir)/$$fn"; \
964 uninstall_runtime: uninstall_programs uninstall_runtime_libs
967 @$(ECHO) "*** Uninstalling runtime programs"
968 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
970 if [ "$$x" = "dummy" ]; then continue; fi; \
972 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
973 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
975 @set -e; for x in dummy $(BIN_SCRIPTS); \
977 if [ "$$x" = "dummy" ]; then continue; fi; \
979 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
980 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
982 -$(RMDIR) "$(DESTDIR)$(bindir)"
984 uninstall_runtime_libs:
985 @$(ECHO) "*** Uninstalling runtime libraries"
986 @ : {- output_off() unless windowsdll(); "" -}
987 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
988 if [ "$$s" = "dummy" ]; then continue; fi; \
990 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
991 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
993 @ : {- output_on() unless windowsdll(); "" -}
996 install_man_docs: build_man_docs
997 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
998 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man1"
999 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man3"
1000 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man5"
1001 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man7"
1002 @$(ECHO) "*** Installing manpages"
1003 @set -e; for x in dummy $(MANDOCS1); do \
1004 if [ "$$x" = "dummy" ]; then continue; fi; \
1005 fn=`basename $$x`; \
1006 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1007 cp $$x "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1008 chmod 644 "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1009 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
1011 @set -e; for x in dummy $(MANDOCS3); do \
1012 if [ "$$x" = "dummy" ]; then continue; fi; \
1013 fn=`basename $$x`; \
1014 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1015 cp $$x "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1016 chmod 644 "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1017 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
1019 @set -e; for x in dummy $(MANDOCS5); do \
1020 if [ "$$x" = "dummy" ]; then continue; fi; \
1021 fn=`basename $$x`; \
1022 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1023 cp $$x "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1024 chmod 644 "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1025 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
1027 @set -e; for x in dummy $(MANDOCS7); do \
1028 if [ "$$x" = "dummy" ]; then continue; fi; \
1029 fn=`basename $$x`; \
1030 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1031 cp $$x "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1032 chmod 644 "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1033 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
1036 uninstall_man_docs: build_man_docs
1037 @$(ECHO) "*** Uninstalling manpages"
1038 @set -e; for x in dummy $(MANDOCS1); do \
1039 if [ "$$x" = "dummy" ]; then continue; fi; \
1040 fn=`basename $$x`; \
1041 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1042 $(RM) "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1043 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
1045 @set -e; for x in dummy $(MANDOCS3); do \
1046 if [ "$$x" = "dummy" ]; then continue; fi; \
1047 fn=`basename $$x`; \
1048 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1049 $(RM) "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1050 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
1052 @set -e; for x in dummy $(MANDOCS5); do \
1053 if [ "$$x" = "dummy" ]; then continue; fi; \
1054 fn=`basename $$x`; \
1055 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1056 $(RM) "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1057 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
1059 @set -e; for x in dummy $(MANDOCS7); do \
1060 if [ "$$x" = "dummy" ]; then continue; fi; \
1061 fn=`basename $$x`; \
1062 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1063 $(RM) "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1064 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
1067 install_html_docs: install_image_docs build_html_docs
1068 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
1069 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man1"
1070 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man3"
1071 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man5"
1072 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7"
1073 @$(ECHO) "*** Installing HTML manpages"
1074 @set -e; for x in dummy $(HTMLDOCS1); do \
1075 if [ "$$x" = "dummy" ]; then continue; fi; \
1076 fn=`basename $$x`; \
1077 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1078 cp $$x "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1079 chmod 644 "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1081 @set -e; for x in dummy $(HTMLDOCS3); do \
1082 if [ "$$x" = "dummy" ]; then continue; fi; \
1083 fn=`basename $$x`; \
1084 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1085 cp $$x "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1086 chmod 644 "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1088 @set -e; for x in dummy $(HTMLDOCS5); do \
1089 if [ "$$x" = "dummy" ]; then continue; fi; \
1090 fn=`basename $$x`; \
1091 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1092 cp $$x "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1093 chmod 644 "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1095 @set -e; for x in dummy $(HTMLDOCS7); do \
1096 if [ "$$x" = "dummy" ]; then continue; fi; \
1097 fn=`basename $$x`; \
1098 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1099 cp $$x "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1100 chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1103 uninstall_html_docs: uninstall_image_docs
1104 @$(ECHO) "*** Uninstalling HTML manpages"
1105 @set -e; for x in dummy $(HTMLDOCS1); do \
1106 if [ "$$x" = "dummy" ]; then continue; fi; \
1107 fn=`basename $$x`; \
1108 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1109 $(RM) "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1111 @set -e; for x in dummy $(HTMLDOCS3); do \
1112 if [ "$$x" = "dummy" ]; then continue; fi; \
1113 fn=`basename $$x`; \
1114 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1115 $(RM) "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1117 @set -e; for x in dummy $(HTMLDOCS5); do \
1118 if [ "$$x" = "dummy" ]; then continue; fi; \
1119 fn=`basename $$x`; \
1120 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1121 $(RM) "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1123 @set -e; for x in dummy $(HTMLDOCS7); do \
1124 if [ "$$x" = "dummy" ]; then continue; fi; \
1125 fn=`basename $$x`; \
1126 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1127 $(RM) "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1131 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7/img"
1132 @set -e; for x in dummy $(IMAGEDOCS7); do \
1133 if [ "$$x" = "dummy" ]; then continue; fi; \
1134 fn=`basename $$x`; \
1135 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1136 cp $(SRCDIR)/$$x "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1137 chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1140 uninstall_image_docs:
1141 @set -e; for x in dummy $(IMAGEDOCS7); do \
1142 if [ "$$x" = "dummy" ]; then continue; fi; \
1143 fn=`basename $$x`; \
1144 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1145 $(RM) "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1148 # Developer targets (note: these are only available on Unix) #########
1149 ##@ Code maintenance
1151 # It's important that generate_buildinfo comes after ordinals, as ordinals
1152 # is sensitive to build.info changes.
1153 update: generate errors ordinals generate_buildinfo ## Update errors, ordinals and build info
1155 .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \
1156 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1157 generate: generate_apps generate_crypto_bn generate_crypto_objects \
1158 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1160 .PHONY: generate_buildinfo generate_doc_buildinfo
1161 generate_buildinfo: generate_doc_buildinfo
1163 .PHONY: doc-nits md-nits
1164 doc-nits: build_generated_pods ## Evaluate OpenSSL documentation
1165 $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e
1167 # This uses "mdl", the markdownlint application, which is written in ruby.
1168 # The source is at https://github.com/markdownlint/markdownlint
1169 # If you have ruby installed, "gem install mdl" should work.
1170 # Another option is at https://snapcraft.io/install/mdl/debian
1171 # Finally, there's a Node.js version, which we haven't tried, that
1172 # can be found at https://github.com/DavidAnson/markdownlint
1173 md-nits: ## Evaluate markdown files via "mdl"
1174 mdl -s $(SRCDIR)/util/markdownlint.rb .
1176 # Test coverage is a good idea for the future
1177 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1181 lint: ## Evaluate C code via "splint"
1183 echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \
1184 -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) )
1186 .PHONY: check-format
1187 check-format: ## Evaluate C code according to OpenSSL coding standards
1188 ( cd $(SRCDIR); $(PERL) util/check-format.pl \
1189 $(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) )
1192 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1193 < apps/openssl.cnf > apps/openssl-vms.cnf )
1196 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1198 generate_crypto_objects:
1199 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1200 crypto/objects/objects.txt \
1201 crypto/objects/obj_mac.num \
1202 > crypto/objects/obj_mac.new && \
1203 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1204 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1205 crypto/objects/objects.txt \
1206 crypto/objects/obj_mac.num \
1207 > include/openssl/obj_mac.h )
1208 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1209 include/openssl/obj_mac.h \
1210 > crypto/objects/obj_dat.h )
1211 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1212 crypto/objects/obj_mac.num \
1213 crypto/objects/obj_xref.txt \
1214 > crypto/objects/obj_xref.h )
1215 ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1217 generate_crypto_conf:
1218 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1219 > crypto/conf/conf_def.h )
1221 generate_crypto_asn1:
1222 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1223 > crypto/asn1/charmap.h )
1226 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1227 crypto/objects/obj_dat.h \
1230 generate_doc_buildinfo:
1231 ( $(PERL) -I$(BLDDIR) -Mconfigdata \
1232 $(SRCDIR)/util/dofile.pl -o Makefile \
1233 $(SRCDIR)/doc/build.info.in \
1234 > $(SRCDIR)/doc/build.info.new; \
1235 if ( test -e $(SRCDIR)/doc/build.info \
1236 && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
1239 rm $(SRCDIR)/doc/build.info.new; \
1241 mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
1244 generate_fips_sources: providers/fips.module.sources.new
1245 providers/fips.module.sources.new: configdata.pm
1249 srcdir=`cd $(SRCDIR); pwd`; \
1251 && $$srcdir/Configure --banner=Configured enable-fips -O0 \
1252 && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \
1253 && $(MAKE) -sj 4 build_generated providers/fips.so \
1254 && find . -name '*.d' | xargs cat > dep1 \
1255 && $(MAKE) distclean \
1256 && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \
1257 && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \
1258 && $(MAKE) -sj 4 build_generated providers/fips.so \
1259 && find . -name '*.d' | xargs cat > dep2 \
1260 && cat sources1 sources2 \
1261 | grep -v ' : \\$$' | grep -v util/providers.num \
1262 | sed -e 's/^ *//' -e 's/ *\\$$//' \
1263 | sort | uniq > sources \
1265 | $(PERL) -p -e 's/\\\n//' \
1266 | sed -e 's/^.*: *//' -e 's/ */ /g' \
1267 | fgrep -f sources \
1269 | sort | uniq > deps.raw \
1271 | xargs ./configdata.pm --query 'get_sources(@ARGV)' \
1272 | $(PERL) -p -e 's/\\\n//' \
1273 | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \
1275 && cat deps.raw | sed -f deps.sed > deps \
1278 cat sources-tmp/sources sources-tmp/deps \
1279 | $(PERL) -p -e 's:^ *\Q../\E:: ;' \
1280 -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \
1281 -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \
1283 for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \
1284 crypto/aes/asm/*.pl crypto/aes/asm/*.S \
1285 crypto/ec/asm/*.pl \
1286 crypto/modes/asm/*.pl \
1287 crypto/sha/asm/*.pl \
1288 crypto/*cpuid.pl crypto/*cpuid.S \
1292 ) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new
1295 # Set to -force to force a rebuild
1298 ( b=`pwd`; set -e; cd $(SRCDIR); \
1299 $(PERL) util/ck_errf.pl -strict -internal; \
1300 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1301 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1302 for E in *.ec ; do \
1303 $(PERL) ../util/ck_errf.pl -strict \
1304 -conf $$E `basename $$E .ec`.c; \
1305 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1306 -conf $$E `basename $$E .ec`.c ; \
1309 {- use File::Basename;
1311 my @sslheaders_tmpl =
1312 qw( include/openssl/ssl.h
1313 include/openssl/ssl2.h
1314 include/openssl/ssl3.h
1315 include/openssl/sslerr.h
1316 include/openssl/tls1.h
1317 include/openssl/dtls1.h
1318 include/openssl/srtp.h
1319 include/openssl/quic.h
1320 include/openssl/sslerr_legacy.h );
1321 my @cryptoheaders_tmpl =
1322 qw( include/internal/dso.h
1323 include/internal/o_dir.h
1324 include/internal/err.h
1325 include/internal/evp.h
1326 include/internal/pem.h
1327 include/internal/asn1.h
1328 include/internal/sslconf.h );
1329 my @cryptoskipheaders = ( @sslheaders_tmpl,
1330 qw( include/openssl/asn1_mac.h
1331 include/openssl/conf_api.h
1332 include/openssl/ebcdic.h
1333 include/openssl/opensslconf.h
1334 include/openssl/symhacks.h ) );
1335 our %cryptoheaders = ();
1336 our %sslheaders = ();
1337 foreach my $d ( qw( include/openssl include/internal ) ) {
1338 my @header_patterns =
1339 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1340 foreach my $f ( map { glob($_) } @header_patterns ) {
1341 my $base = basename($f);
1342 my $base_in = basename($f, '.in');
1343 my $dir = catfile($config{sourcedir}, $d);
1344 if ($base ne $base_in) {
1345 # We have a .h.in file, which means the header file is in the
1348 $dir = catfile($config{builddir}, $d);
1350 my $new_f = catfile($dir, $base);
1351 my $fn = "$d/$base";
1352 # The logic to add files to @cryptoheaders is a bit complex. The
1353 # file to be added must be either in the public header directory
1354 # or one of the pre-declared internal headers, and must under no
1355 # circumstances be one of those that must be skipped.
1356 $cryptoheaders{$new_f} = 1
1357 if (($d eq 'include/openssl'
1358 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1359 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1360 # The logic to add files to @sslheaders is much simpler...
1361 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1367 sub uniq { my %seen; grep !$seen{$_}++, @_; }
1368 sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; }
1369 join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5,
1370 uniq(grep /\.(c|cc|cpp)$/,
1371 flat (map { $unified_info{sources}->{$_} }
1372 (sort keys %{$unified_info{sources}})))))
1374 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1375 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1376 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1377 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1379 renumber: build_generated
1380 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1381 --ordinals $(SRCDIR)/util/libcrypto.num \
1382 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1385 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1386 --ordinals $(SRCDIR)/util/libssl.num \
1387 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1392 ordinals: build_generated
1393 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1394 --ordinals $(SRCDIR)/util/libcrypto.num \
1395 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1397 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1398 --ordinals $(SRCDIR)/util/libssl.num \
1399 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1403 $(MAKE) run_tests TESTS=test_ordinals
1407 -( cd $(SRCDIR); util/ctags.sh )
1408 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1410 providers/fips.checksum.new: providers/fips.module.sources.new
1411 @which unifdef > /dev/null || \
1412 ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \
1414 ( sources=`pwd`/providers/fips.module.sources.new; \
1417 | xargs ./util/fips-checksums.sh ) \
1418 > providers/fips-sources.checksums.new \
1419 && sha256sum providers/fips-sources.checksums.new \
1420 | sed -e 's|\.new||' > providers/fips.checksum.new
1422 fips-checksums: providers/fips.checksum.new
1424 $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new
1425 cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources
1426 cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums
1427 cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum
1429 update-fips-checksums: $(SRCDIR)/providers/fips.checksum
1431 diff-fips-checksums: fips-checksums
1432 diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new
1433 diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new
1434 diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new
1436 # Release targets (note: only available on Unix) #####################
1439 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1441 # Helper targets #####################################################
1443 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf
1445 $(BLDDIR)/util/opensslwrap.sh: Makefile
1446 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1447 mkdir -p "$(BLDDIR)/util"; \
1448 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1451 $(BLDDIR)/apps/openssl.cnf: Makefile
1452 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1453 mkdir -p "$(BLDDIR)/apps"; \
1454 ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
1459 # Building targets ###################################################
1461 Makefile: configdata.pm \
1462 {- join(" \\\n" . ' ' x 10,
1463 fill_lines(" ", $COLUMNS - 10,
1464 @{$config{build_file_templates}})) -}
1465 @echo "Detected changed: $?"
1466 $(PERL) configdata.pm
1467 @echo "**************************************************"
1469 @echo "*** Please run the same make command again ***"
1471 @echo "**************************************************"
1474 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1475 {- join(" \\\n" . ' ' x 15,
1476 fill_lines(" ", $COLUMNS - 15,
1477 @{$config{build_infos}},
1478 @{$config{conf_files}})) -}
1479 @echo "Detected changed: $?"
1480 $(PERL) configdata.pm -r
1481 @echo "**************************************************"
1483 @echo "*** Please run the same make command again ***"
1485 @echo "**************************************************"
1489 $(PERL) configdata.pm -r
1493 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1495 # Helper function to convert dependencies in platform agnostic form to
1496 # dependencies in platform form.
1497 sub compute_platform_depends {
1500 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
1501 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
1502 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
1503 or platform->convertext($x); } @_;
1506 # Helper function to figure out dependencies on libraries
1507 # It takes a list of library names and outputs a list of dependencies
1508 sub compute_lib_depends {
1509 # Depending on shared libraries:
1510 # On Windows POSIX layers, we depend on {libname}.dll.a
1511 # On Unix platforms, we depend on {shlibname}.so
1512 return map { platform->sharedlib_simple($_)
1513 // platform->sharedlib_import($_)
1514 // platform->sharedlib($_)
1515 // platform->staticlib($_)
1519 sub generatetarget {
1521 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
1523 $args{target}: $deps
1529 my $gen0 = $args{generator}->[0];
1530 my $gen_args = join('', map { " $_" }
1531 @{$args{generator}}[1..$#{$args{generator}}]);
1532 my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1533 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1534 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1535 my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}},
1538 if ($args{src} =~ /\.html$/) {
1542 my $title = basename($args{src}, ".html");
1546 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1548 } elsif ($args{src} =~ /\.(\d)$/) {
1550 # Man-page generator
1553 my $name = uc basename($args{src}, ".$section");
1557 pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
1558 --release=\$(VERSION) $pod >\$\@
1560 } elsif (platform->isdef($args{src})) {
1562 # Linker script-ish generator
1564 my $target = platform->def($args{src});
1565 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1566 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
1567 my $ord_name = $args{generator}->[1] || $args{product};
1569 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
1570 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
1572 } elsif (platform->isasm($args{src})
1573 || platform->iscppasm($args{src})) {
1575 # Assembler generator
1578 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1579 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1580 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1581 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1582 } -> {$args{intent}};
1585 if ($gen0 =~ /\.pl$/) {
1586 $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
1587 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1588 } elsif ($gen0 =~ /\.m4$/) {
1589 $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
1590 } elsif ($gen0 =~ /\.S$/) {
1593 die "Generator type for $args{src} unknown: $gen0\n";
1596 if (defined($generator)) {
1598 $args{src}: $gen0 $deps
1603 $args{src}: $gen0 $deps
1604 \$(CC) $incs $cppflags $defs -E $gen0 | \\
1605 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1607 } elsif ($gen0 =~ m|^.*\.in$|) {
1609 # "dofile" generator (file.in -> file)
1611 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1612 "util", "dofile.pl")),
1613 rel2abs($config{builddir}));
1614 my @perlmodules = ();
1615 my %perlmoduleincs = ();
1616 my %perlmoduledeps = ();
1617 foreach my $x (('configdata.pm', @{$args{deps}})) {
1618 # Compute (i)nclusion directory, (m)odule name and (d)ependency
1624 # Massage the module part to become a real perl module spec
1627 # Directory specs are :: in perl package names
1630 # Full file name of the dependency
1631 $d = catfile($i, $d) if $i;
1632 } elsif ($x =~ /\.pm$/) {
1634 $m = basename($x, '.pm');
1637 # All other dependencies are simply collected
1640 push @perlmodules, '"-M'.$m.'"' if $m;
1641 $perlmoduledeps{$d} = 1;
1642 $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i;
1645 # Because of the special treatment of dependencies, we need to
1646 # recompute $deps completely
1648 = join(" ", compute_platform_depends(@{$args{generator_deps}},
1649 sort keys %perlmoduledeps));
1650 my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules);
1653 $args{src}: $gen0 $deps
1654 \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
1656 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1658 # Generic generator using OpenSSL programs
1661 # Redo $gen0, to ensure that we have the proper extension where
1663 $gen0 = platform->bin($gen0);
1664 # Use $(PERL) to execute wrap.pl directly to avoid calling env
1666 $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
1667 \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
1671 # Generic generator using Perl
1674 $args{src}: $gen0 $deps
1675 \$(PERL)$gen_incs $gen0$gen_args > \$@
1680 # Should one wonder about the end of the Perl snippet, it's because this
1681 # second regexp eats up line endings as well, if the removed path is the
1682 # last in the line. We may therefore need to put back a line ending.
1685 my $obj = platform->convertext($args{obj});
1686 my $dep = platform->dep($args{obj});
1687 my @srcs = @{$args{srcs}};
1688 my $srcs = join(" ", @srcs);
1689 my $deps = join(" ", @srcs, @{$args{deps}});
1690 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1691 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1695 if (grep /\.rc$/, @srcs) {
1697 $cmdflags = '$(RCFLAGS)';
1699 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1701 $cmdcompile = ' -c';
1703 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1704 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1705 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1706 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1707 } -> {$args{intent}};
1710 $cmdcompile = ' -c';
1712 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1713 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1714 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1715 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1716 } -> {$args{intent}};
1719 # extension-specific rules
1720 if (grep /\.s$/, @srcs) {
1723 $cmd $cmdflags -c -o \$\@ $srcs
1725 } elsif (grep /\.S$/, @srcs) {
1726 # Originally there was multi-step rule with $(CC) -E file.S
1727 # followed by $(CC) -c file.s. It compensated for one of
1728 # legacy platform compiler's inability to handle .S files.
1729 # The platform is long discontinued by vendor so there is
1730 # hardly a point to drag it along...
1733 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1735 } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
1738 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1740 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1743 mv $dep.tmp $dep; \\
1749 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1751 if ($makedep_scheme eq 'makedepend') {
1753 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1760 # We *know* this routine is only called when we've configure 'shared'.
1765 foreach (@{$args{deps}}) {
1766 if (platform->isstaticlib($_)) {
1767 push @linklibs, platform->convertext($_);
1769 my $d = "-L" . dirname($_);
1770 my $l = basename($_);
1774 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1777 my $linkflags = join("", map { $_." " } @linkdirs);
1778 my $linklibs = join("", map { $_." " } @linklibs);
1779 my @objs = map { platform->convertext($_) }
1780 grep { !platform->isdef($_) }
1782 my @defs = map { platform->def($_) }
1783 grep { platform->isdef($_) }
1785 my @deps = compute_lib_depends(@{$args{deps}});
1786 die "More than one exported symbol map" if scalar @defs > 1;
1788 my $full = platform->sharedlib($args{lib});
1789 # $import is for Windows and subsystems thereof, where static import
1790 # libraries for DLLs are a thing. On platforms that have this mechanism,
1791 # $import has the name of this import library. On platforms that don't
1792 # have this mechanism, $import will be |undef|.
1793 my $import = platform->sharedlib_import($args{lib});
1794 # $simple is for platforms where full shared library names include the
1795 # shared library version, and there's a simpler name that doesn't include
1796 # that version. On such platforms, $simple has the simpler name. On
1797 # other platforms, it will be |undef|.
1798 my $simple = platform->sharedlib_simple($args{lib});
1800 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1801 my $shared_soname = "";
1802 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1803 if defined $target{shared_sonameflag};
1804 my $shared_imp = "";
1805 $shared_imp .= ' '.$target{shared_impflag}.basename($import)
1806 if defined $target{shared_impflag} && defined $import;
1807 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1809 # There is at least one platform where the compiler-as-linker needs to
1810 # have one object file directly on the command line. That won't hurt
1811 # any other platform, so we do that for everyone when there's an argfile
1812 # to be had. This depends heavily on splice, which removes elements from
1813 # the given array, and returns them so they can be captured.
1814 my @argfileobjs = $argfile
1817 my $argfilecmds = $argfile
1818 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1820 my $argfiledeps = $argfile
1821 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1822 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1824 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1827 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1830 join(" \\\n" . ' ' x (length($full) + 2),
1831 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1833 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1837 if (defined $simple && $simple ne $full) {
1842 \$(AR) r $simple $full
1852 if (defined $import) {
1859 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1860 -o $full$shared_def \\
1862 $linklibs \$(LIB_EX_LIBS)
1871 if (!$disabled{tests}) {
1878 $recipe .= <<"EOF" if defined $argfile;
1879 $argfile: $argfiledeps
1887 my $dso = platform->dso($args{module});
1890 foreach (@{$args{deps}}) {
1891 next unless defined $_;
1892 if (platform->isstaticlib($_)) {
1893 push @linklibs, platform->convertext($_);
1895 my $d = "-L" . dirname($_);
1896 my $l = basename($_);
1900 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1903 my $linkflags = join("", map { $_." " } @linkdirs);
1904 my $linklibs = join("", map { $_." " } @linklibs);
1905 my @objs = map { platform->convertext($_) }
1906 grep { !platform->isdef($_) }
1908 my @defs = map { platform->def($_) }
1909 grep { platform->isdef($_) }
1911 my @deps = compute_lib_depends(@{$args{deps}});
1912 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1913 # Next line needs to become "less magic" (see PR #11950)
1914 $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/);
1915 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1916 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1917 fill_lines(' ', $COLUMNS - length($dso) - 2,
1918 @objs, @defs, @deps));
1922 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1923 -o $dso$shared_def \\
1925 $linklibs\$(DSO_EX_LIBS)
1930 my $lib = platform->staticlib($args{lib});
1931 my @objs = map { platform->obj($_) } @{$args{objs}};
1932 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1933 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1934 my $max_per_call = 500;
1936 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1938 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1943 \$(RANLIB) \$\@ || echo Never mind.
1948 my $bin = platform->bin($args{bin});
1949 my @objs = map { platform->obj($_) } @{$args{objs}};
1950 my @deps = compute_lib_depends(@{$args{deps}});
1951 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1952 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1955 foreach (@{$args{deps}}) {
1956 next unless defined $_;
1957 if (platform->isstaticlib($_)) {
1958 push @linklibs, platform->convertext($_);
1960 my $d = "-L" . dirname($_);
1961 my $l = basename($_);
1965 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1968 my $linkflags = join("", map { $_." " } @linkdirs);
1969 my $linklibs = join("", map { $_." " } @linklibs);
1971 my $cmdflags = '$(BIN_CFLAGS)';
1972 if (grep /_cc\.o$/, @{$args{objs}}) {
1974 $cmdflags = '$(BIN_CXXFLAGS)';
1977 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1978 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1979 fill_lines(' ', $COLUMNS - length($bin) - 2,
1985 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1988 $linklibs\$(BIN_EX_LIBS)
1993 my $script = $args{script};
1994 my $sources = join(" ", @{$args{sources}});
1995 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1996 "util", "dofile.pl")),
1997 rel2abs($config{builddir}));
1999 $script: $sources configdata.pm
2001 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
2002 "-o$target{build_file}" $sources > "$script"
2008 my $dir = $args{dir};
2009 my @deps = compute_platform_depends(@{$args{deps}});
2012 # We already have a 'test' target, and the top directory is just plain
2014 return if $dir eq "test" || $dir eq ".";
2016 foreach my $type (("dso", "lib", "bin", "script")) {
2017 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
2018 # For lib object files, we could update the library. However, it
2019 # was decided that it's enough to build the directory local object
2020 # files, so we don't need to add any actions, and the dependencies
2021 # are already taken care of.
2022 if ($type ne "lib") {
2023 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
2024 if (dirname($prod) eq $dir) {
2025 push @deps, compute_platform_depends($prod);
2027 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
2033 my $target = "$dir $dir/";
2034 my $deps = join(" \\\n\t",
2035 fill_lines(' ', $COLUMNS - 8, @deps));
2036 my $comments = join("\n", "", @comments);
2042 "" # Important! This becomes part of the template result.