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 run_tests
564 @ : {- output_off() if $disabled{tests}; "" -}
568 FIPSKEY="$(FIPSKEY)" \
569 EXE_EXT={- platform->binext() -} \
570 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
571 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
572 @echo "Tests are not supported with your chosen Configure options"
573 @ : {- output_on() if !$disabled{tests}; "" -}
575 list-tests: ## List available tests that can be invoked via "make test TESTS=<name>"
576 @ : {- output_off() if $disabled{tests}; "" -}
577 $(MAKE) run_tests TESTS=list
578 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
579 @echo "Tests are not supported with your chosen Configure options"
580 @ : {- output_on() if !$disabled{tests}; "" -}
582 ##@ Workspace cleaning
585 @set -e; for s in $(SHLIB_INFO); do \
586 if [ "$$s" = ";" ]; then continue; fi; \
587 s1=`echo "$$s" | cut -f1 -d";"`; \
588 s2=`echo "$$s" | cut -f2 -d";"`; \
589 s3=`echo "$$s" | cut -f3 -d";"`; \
590 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
593 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
595 if [ "$$s2" != "" ]; then \
596 $(ECHO) $(RM) $$s2; \
599 if [ "$$s3" != "" ]; then \
600 $(ECHO) $(RM) $$s3; \
605 $(RM) *{- platform->defext() -}
607 clean: libclean ## Clean the workspace, keep the configuration
616 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS)
617 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
618 -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
619 -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
621 $(RM) tags TAGS doc-nits md-nits
622 $(RM) -r test/test-runs
623 $(RM) providers/fips*.new
624 -find . -type l \! -name '.*' -exec $(RM) {} \;
626 distclean: clean ## Clean and remove the configuration
627 $(RM) include/openssl/configuration.h
631 # We check if any depfile is newer than Makefile and decide to
632 # concatenate only if that is true.
634 @: {- output_off() if $disabled{makedepend}; "" -}
635 @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}"
636 @: {- output_on() if $disabled{makedepend}; "" -}
638 # Install helper targets #############################################
641 install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} ## Install software and documentation, create OpenSSL directories
643 uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation
645 install_sw: install_dev install_engines install_modules install_runtime ## Install just the software and libraries
647 uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev ## Uninstall the software and libraries
649 install_docs: install_man_docs install_html_docs ## Install manpages and HTML documentation
651 uninstall_docs: uninstall_man_docs uninstall_html_docs ## Uninstall manpages and HTML documentation
652 $(RM) -r "$(DESTDIR)$(DOCDIR)"
654 {- output_off() if $disabled{fips}; "" -}
655 install_fips: build_sw $(INSTALL_FIPSMODULECONF)
656 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
657 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)"
658 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)"
659 @$(ECHO) "*** Installing FIPS module"
660 @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
661 @cp "$(INSTALL_FIPSMODULE)" "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
662 @chmod 755 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
663 @mv -f "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" \
664 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
665 @$(ECHO) "*** Installing FIPS module configuration"
666 @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
667 @cp $(INSTALL_FIPSMODULECONF) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
670 @$(ECHO) "*** Uninstalling FIPS module configuration"
671 $(RM) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
672 @$(ECHO) "*** Uninstalling FIPS module"
673 $(RM) "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
674 {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
676 @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
679 @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
680 {- output_on() if !$disabled{fips}; "" -}
684 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs"
685 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private"
686 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc"
687 @set -e; for x in dummy $(MISC_SCRIPTS); do \
688 if [ "$$x" = "dummy" ]; then continue; fi; \
689 x1=`echo "$$x" | cut -f1 -d:`; \
690 x2=`echo "$$x" | cut -f2 -d:`; \
691 fn=`basename $$x1`; \
692 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
693 cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
694 chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
695 mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \
696 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
697 if [ "$$x1" != "$$x2" ]; then \
698 ln=`basename "$$x2"`; \
699 : {- output_off() unless windowsdll(); "" -}; \
700 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
701 cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
702 : {- output_on() unless windowsdll();
703 output_off() if windowsdll(); "" -}; \
704 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
705 ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
706 : {- output_on() if windowsdll(); "" -}; \
709 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
710 @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
711 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
712 @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
713 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
714 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
715 cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
716 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
718 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
719 @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
720 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
721 @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
722 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
723 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
724 cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
725 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
728 install_dev: install_runtime_libs
729 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
730 @$(ECHO) "*** Installing development files"
731 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl"
732 @ : {- output_off() if $disabled{uplink}; "" -}
733 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
734 @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
735 @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
736 @ : {- output_on() if $disabled{uplink}; "" -}
737 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
738 $(BLDDIR)/include/openssl/*.h; do \
740 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
741 cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
742 chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
744 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
745 @set -e; for l in $(INSTALL_LIBS); do \
747 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
748 cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \
749 $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \
750 chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \
751 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
752 "$(DESTDIR)$(libdir)/$$fn"; \
754 @ : {- output_off() if $disabled{shared}; "" -}
755 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
756 s1=`echo "$$s" | cut -f1 -d";"`; \
757 s2=`echo "$$s" | cut -f2 -d";"`; \
758 s3=`echo "$$s" | cut -f3 -d";"`; \
759 fn1=`basename "$$s1"`; \
760 fn2=`basename "$$s2"`; \
761 fn3=`basename "$$s3"`; \
762 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
763 if [ "$$fn2" != "" ]; then \
764 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
765 ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \
767 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
768 if [ "$$fn3" != "" ]; then \
769 $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
770 cp $$s3 "$(DESTDIR)$(libdir)/$$fn3.new"; \
771 chmod 755 "$(DESTDIR)$(libdir)/$$fn3.new"; \
772 mv -f "$(DESTDIR)$(libdir)/$$fn3.new" \
773 "$(DESTDIR)$(libdir)/$$fn3"; \
775 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
776 a="$(DESTDIR)$(libdir)/$$fn2"; \
777 $(ECHO) "install $$s1 -> $$a"; \
778 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
779 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
781 for so in `$(AR) t $$a`; do \
784 strip -X32_64 -e $$so; \
785 $(AR) r $$a.new $$so; \
788 $(AR) r $$a.new $$s1; \
790 : {- output_off() if sharedaix(); output_on(); "" -}; \
792 @ : {- output_on() if $disabled{shared}; "" -}
793 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(PKGCONFIGDIR)"
794 @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \
796 $(ECHO) "install $$e -> $(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
797 cp $$e "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
798 chmod 644 "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
800 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(CMAKECONFIGDIR)
801 @for e in $(INSTALL_EXPORTERS_CMAKE); do \
803 $(ECHO) "install $$e -> $(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \
804 cp $$e $(DESTDIR)$(CMAKECONFIGDIR)/$$fn; \
805 chmod 644 $(DESTDIR)$(CMAKECONFIGDIR)/$$fn; \
808 uninstall_dev: uninstall_runtime_libs
809 @$(ECHO) "*** Uninstalling development files"
810 @ : {- output_off() if $disabled{uplink}; "" -}
811 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
812 @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
813 @ : {- output_on() if $disabled{uplink}; "" -}
814 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
815 $(BLDDIR)/include/openssl/*.h; do \
817 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
818 $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
820 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl"
821 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include"
822 @set -e; for l in $(INSTALL_LIBS); do \
824 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
825 $(RM) "$(DESTDIR)$(libdir)/$$fn"; \
827 @ : {- output_off() if $disabled{shared}; "" -}
828 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
829 s1=`echo "$$s" | cut -f1 -d";"`; \
830 s2=`echo "$$s" | cut -f2 -d";"`; \
831 s3=`echo "$$s" | cut -f3 -d";"`; \
832 fn1=`basename "$$s1"`; \
833 fn2=`basename "$$s2"`; \
834 fn3=`basename "$$s3"`; \
835 : {- output_off() if windowsdll(); "" -}; \
836 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
837 $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \
838 if [ -n "$$fn2" ]; then \
839 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
840 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \
842 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
843 if [ -n "$$fn3" ]; then \
844 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
845 $(RM) "$(DESTDIR)$(libdir)/$$fn3"; \
847 : {- output_on() unless windowsdll(); "" -}; \
849 @ : {- output_on() if $disabled{shared}; "" -}
850 @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \
851 fn=`basename "$$e"`; \
852 $(RM) "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \
854 @for e in $(INSTALL_EXPORTERS_CMAKE); do \
855 fn=`basename "$$e"`; \
856 $(RM) "$(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \
858 -$(RMDIR) "$(DESTDIR)$(PKGCONFIGDIR)"
859 -$(RMDIR) "$(DESTDIR)$(CMAKECONFIGDIR)"
860 -$(RMDIR) "$(DESTDIR)$(libdir)"
862 _install_modules_deps: install_runtime_libs build_modules
864 install_engines: _install_modules_deps
865 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
866 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/"
867 @$(ECHO) "*** Installing engines"
868 @set -e; for e in dummy $(INSTALL_ENGINES); do \
869 if [ "$$e" = "dummy" ]; then continue; fi; \
871 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
872 cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
873 chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
874 mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \
875 "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
879 @$(ECHO) "*** Uninstalling engines"
880 @set -e; for e in dummy $(INSTALL_ENGINES); do \
881 if [ "$$e" = "dummy" ]; then continue; fi; \
883 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
884 $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
886 -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)"
888 install_modules: _install_modules_deps
889 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
890 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/"
891 @$(ECHO) "*** Installing modules"
892 @set -e; for e in dummy $(INSTALL_MODULES); do \
893 if [ "$$e" = "dummy" ]; then continue; fi; \
895 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
896 cp $$e "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
897 chmod 755 "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
898 mv -f "$(DESTDIR)$(MODULESDIR)/$$fn.new" \
899 "$(DESTDIR)$(MODULESDIR)/$$fn"; \
903 @$(ECHO) "*** Uninstalling modules"
904 @set -e; for e in dummy $(INSTALL_MODULES); do \
905 if [ "$$e" = "dummy" ]; then continue; fi; \
907 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
908 $(RM) "$(DESTDIR)$(MODULESDIR)/$$fn"; \
910 -$(RMDIR) "$(DESTDIR)$(MODULESDIR)"
912 install_runtime: install_programs
914 install_runtime_libs: build_libs
915 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
916 @ : {- output_off() if windowsdll(); "" -}
917 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
918 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
919 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)/"
920 @ : {- output_on() unless windowsdll(); "" -}
921 @$(ECHO) "*** Installing runtime libraries"
922 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
923 if [ "$$s" = "dummy" ]; then continue; fi; \
925 : {- output_off() unless windowsdll(); "" -}; \
926 $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \
927 cp $$s "$(DESTDIR)$(bindir)/$$fn.new"; \
928 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
929 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
930 "$(DESTDIR)$(bindir)/$$fn"; \
931 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
932 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
933 cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \
934 chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \
935 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
936 "$(DESTDIR)$(libdir)/$$fn"; \
937 : {- output_on() if windowsdll(); "" -}; \
940 install_programs: install_runtime_libs build_programs
941 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
942 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)"
943 @$(ECHO) "*** Installing runtime programs"
944 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
945 if [ "$$x" = "dummy" ]; then continue; fi; \
947 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
948 cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
949 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
950 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
951 "$(DESTDIR)$(bindir)/$$fn"; \
953 @set -e; for x in dummy $(BIN_SCRIPTS); do \
954 if [ "$$x" = "dummy" ]; then continue; fi; \
956 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
957 cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
958 chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
959 mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
960 "$(DESTDIR)$(bindir)/$$fn"; \
963 uninstall_runtime: uninstall_programs uninstall_runtime_libs
966 @$(ECHO) "*** Uninstalling runtime programs"
967 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
969 if [ "$$x" = "dummy" ]; then continue; fi; \
971 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
972 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
974 @set -e; for x in dummy $(BIN_SCRIPTS); \
976 if [ "$$x" = "dummy" ]; then continue; fi; \
978 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
979 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
981 -$(RMDIR) "$(DESTDIR)$(bindir)"
983 uninstall_runtime_libs:
984 @$(ECHO) "*** Uninstalling runtime libraries"
985 @ : {- output_off() unless windowsdll(); "" -}
986 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
987 if [ "$$s" = "dummy" ]; then continue; fi; \
989 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
990 $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
992 @ : {- output_on() unless windowsdll(); "" -}
995 install_man_docs: build_man_docs
996 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
997 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man1"
998 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man3"
999 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man5"
1000 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man7"
1001 @$(ECHO) "*** Installing manpages"
1002 @set -e; for x in dummy $(MANDOCS1); do \
1003 if [ "$$x" = "dummy" ]; then continue; fi; \
1004 fn=`basename $$x`; \
1005 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1006 cp $$x "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1007 chmod 644 "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1008 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
1010 @set -e; for x in dummy $(MANDOCS3); do \
1011 if [ "$$x" = "dummy" ]; then continue; fi; \
1012 fn=`basename $$x`; \
1013 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1014 cp $$x "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1015 chmod 644 "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1016 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
1018 @set -e; for x in dummy $(MANDOCS5); do \
1019 if [ "$$x" = "dummy" ]; then continue; fi; \
1020 fn=`basename $$x`; \
1021 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1022 cp $$x "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1023 chmod 644 "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1024 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
1026 @set -e; for x in dummy $(MANDOCS7); do \
1027 if [ "$$x" = "dummy" ]; then continue; fi; \
1028 fn=`basename $$x`; \
1029 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1030 cp $$x "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1031 chmod 644 "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1032 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
1035 uninstall_man_docs: build_man_docs
1036 @$(ECHO) "*** Uninstalling manpages"
1037 @set -e; for x in dummy $(MANDOCS1); do \
1038 if [ "$$x" = "dummy" ]; then continue; fi; \
1039 fn=`basename $$x`; \
1040 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1041 $(RM) "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1042 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
1044 @set -e; for x in dummy $(MANDOCS3); do \
1045 if [ "$$x" = "dummy" ]; then continue; fi; \
1046 fn=`basename $$x`; \
1047 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1048 $(RM) "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1049 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
1051 @set -e; for x in dummy $(MANDOCS5); do \
1052 if [ "$$x" = "dummy" ]; then continue; fi; \
1053 fn=`basename $$x`; \
1054 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1055 $(RM) "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1056 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
1058 @set -e; for x in dummy $(MANDOCS7); do \
1059 if [ "$$x" = "dummy" ]; then continue; fi; \
1060 fn=`basename $$x`; \
1061 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1062 $(RM) "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1063 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
1066 install_html_docs: install_image_docs build_html_docs
1067 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
1068 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man1"
1069 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man3"
1070 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man5"
1071 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7"
1072 @$(ECHO) "*** Installing HTML manpages"
1073 @set -e; for x in dummy $(HTMLDOCS1); do \
1074 if [ "$$x" = "dummy" ]; then continue; fi; \
1075 fn=`basename $$x`; \
1076 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1077 cp $$x "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1078 chmod 644 "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1080 @set -e; for x in dummy $(HTMLDOCS3); do \
1081 if [ "$$x" = "dummy" ]; then continue; fi; \
1082 fn=`basename $$x`; \
1083 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1084 cp $$x "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1085 chmod 644 "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1087 @set -e; for x in dummy $(HTMLDOCS5); do \
1088 if [ "$$x" = "dummy" ]; then continue; fi; \
1089 fn=`basename $$x`; \
1090 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1091 cp $$x "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1092 chmod 644 "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1094 @set -e; for x in dummy $(HTMLDOCS7); do \
1095 if [ "$$x" = "dummy" ]; then continue; fi; \
1096 fn=`basename $$x`; \
1097 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1098 cp $$x "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1099 chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1102 uninstall_html_docs: uninstall_image_docs
1103 @$(ECHO) "*** Uninstalling HTML manpages"
1104 @set -e; for x in dummy $(HTMLDOCS1); do \
1105 if [ "$$x" = "dummy" ]; then continue; fi; \
1106 fn=`basename $$x`; \
1107 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1108 $(RM) "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1110 @set -e; for x in dummy $(HTMLDOCS3); do \
1111 if [ "$$x" = "dummy" ]; then continue; fi; \
1112 fn=`basename $$x`; \
1113 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1114 $(RM) "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1116 @set -e; for x in dummy $(HTMLDOCS5); do \
1117 if [ "$$x" = "dummy" ]; then continue; fi; \
1118 fn=`basename $$x`; \
1119 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1120 $(RM) "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1122 @set -e; for x in dummy $(HTMLDOCS7); do \
1123 if [ "$$x" = "dummy" ]; then continue; fi; \
1124 fn=`basename $$x`; \
1125 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1126 $(RM) "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1130 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7/img"
1131 @set -e; for x in dummy $(IMAGEDOCS7); do \
1132 if [ "$$x" = "dummy" ]; then continue; fi; \
1133 fn=`basename $$x`; \
1134 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1135 cp $(SRCDIR)/$$x "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1136 chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1139 uninstall_image_docs:
1140 @set -e; for x in dummy $(IMAGEDOCS7); do \
1141 if [ "$$x" = "dummy" ]; then continue; fi; \
1142 fn=`basename $$x`; \
1143 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1144 $(RM) "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1147 # Developer targets (note: these are only available on Unix) #########
1148 ##@ Code maintenance
1150 # It's important that generate_buildinfo comes after ordinals, as ordinals
1151 # is sensitive to build.info changes.
1152 update: generate errors ordinals generate_buildinfo ## Update errors, ordinals and build info
1154 .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \
1155 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1156 generate: generate_apps generate_crypto_bn generate_crypto_objects \
1157 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1159 .PHONY: generate_buildinfo generate_doc_buildinfo
1160 generate_buildinfo: generate_doc_buildinfo
1162 .PHONY: doc-nits md-nits
1163 doc-nits: build_generated_pods ## Evaluate OpenSSL documentation
1164 $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e
1166 # This uses "mdl", the markdownlint application, which is written in ruby.
1167 # The source is at https://github.com/markdownlint/markdownlint
1168 # If you have ruby installed, "gem install mdl" should work.
1169 # Another option is at https://snapcraft.io/install/mdl/debian
1170 # Finally, there's a Node.js version, which we haven't tried, that
1171 # can be found at https://github.com/DavidAnson/markdownlint
1172 md-nits: ## Evaluate markdown files via "mdl"
1173 mdl -s $(SRCDIR)/util/markdownlint.rb .
1175 # Test coverage is a good idea for the future
1176 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1180 lint: ## Evaluate C code via "splint"
1182 echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \
1183 -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) )
1185 .PHONY: check-format
1186 check-format: ## Evaluate C code according to OpenSSL coding standards
1187 ( cd $(SRCDIR); $(PERL) util/check-format.pl \
1188 $(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) )
1191 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1192 < apps/openssl.cnf > apps/openssl-vms.cnf )
1195 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1197 generate_crypto_objects:
1198 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1199 crypto/objects/objects.txt \
1200 crypto/objects/obj_mac.num \
1201 > crypto/objects/obj_mac.new && \
1202 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1203 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1204 crypto/objects/objects.txt \
1205 crypto/objects/obj_mac.num \
1206 > include/openssl/obj_mac.h )
1207 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1208 include/openssl/obj_mac.h \
1209 > crypto/objects/obj_dat.h )
1210 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1211 crypto/objects/obj_mac.num \
1212 crypto/objects/obj_xref.txt \
1213 > crypto/objects/obj_xref.h )
1214 ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1216 generate_crypto_conf:
1217 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1218 > crypto/conf/conf_def.h )
1220 generate_crypto_asn1:
1221 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1222 > crypto/asn1/charmap.h )
1225 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1226 crypto/objects/obj_dat.h \
1229 generate_doc_buildinfo:
1230 ( $(PERL) -I$(BLDDIR) -Mconfigdata \
1231 $(SRCDIR)/util/dofile.pl -o Makefile \
1232 $(SRCDIR)/doc/build.info.in \
1233 > $(SRCDIR)/doc/build.info.new; \
1234 if ( test -e $(SRCDIR)/doc/build.info \
1235 && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
1238 rm $(SRCDIR)/doc/build.info.new; \
1240 mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
1243 generate_fips_sources: providers/fips.module.sources.new
1244 providers/fips.module.sources.new: configdata.pm
1248 srcdir=`cd $(SRCDIR); pwd`; \
1250 && $$srcdir/Configure --banner=Configured enable-fips -O0 \
1251 && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \
1252 && $(MAKE) -sj 4 build_generated providers/fips.so \
1253 && find . -name '*.d' | xargs cat > dep1 \
1254 && $(MAKE) distclean \
1255 && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \
1256 && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \
1257 && $(MAKE) -sj 4 build_generated providers/fips.so \
1258 && find . -name '*.d' | xargs cat > dep2 \
1259 && cat sources1 sources2 \
1260 | grep -v ' : \\$$' | grep -v util/providers.num \
1261 | sed -e 's/^ *//' -e 's/ *\\$$//' \
1262 | sort | uniq > sources \
1264 | $(PERL) -p -e 's/\\\n//' \
1265 | sed -e 's/^.*: *//' -e 's/ */ /g' \
1266 | fgrep -f sources \
1268 | sort | uniq > deps.raw \
1270 | xargs ./configdata.pm --query 'get_sources(@ARGV)' \
1271 | $(PERL) -p -e 's/\\\n//' \
1272 | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \
1274 && cat deps.raw | sed -f deps.sed > deps \
1277 cat sources-tmp/sources sources-tmp/deps \
1278 | $(PERL) -p -e 's:^ *\Q../\E:: ;' \
1279 -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \
1280 -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \
1282 for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \
1283 crypto/aes/asm/*.pl crypto/aes/asm/*.S \
1284 crypto/ec/asm/*.pl \
1285 crypto/modes/asm/*.pl \
1286 crypto/sha/asm/*.pl \
1287 crypto/*cpuid.pl crypto/*cpuid.S \
1291 ) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new
1294 # Set to -force to force a rebuild
1297 ( b=`pwd`; set -e; cd $(SRCDIR); \
1298 $(PERL) util/ck_errf.pl -strict -internal; \
1299 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1300 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1301 for E in *.ec ; do \
1302 $(PERL) ../util/ck_errf.pl -strict \
1303 -conf $$E `basename $$E .ec`.c; \
1304 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1305 -conf $$E `basename $$E .ec`.c ; \
1308 {- use File::Basename;
1310 my @sslheaders_tmpl =
1311 qw( include/openssl/ssl.h
1312 include/openssl/ssl2.h
1313 include/openssl/ssl3.h
1314 include/openssl/sslerr.h
1315 include/openssl/tls1.h
1316 include/openssl/dtls1.h
1317 include/openssl/srtp.h
1318 include/openssl/quic.h
1319 include/openssl/sslerr_legacy.h );
1320 my @cryptoheaders_tmpl =
1321 qw( include/internal/dso.h
1322 include/internal/o_dir.h
1323 include/internal/err.h
1324 include/internal/evp.h
1325 include/internal/pem.h
1326 include/internal/asn1.h
1327 include/internal/sslconf.h );
1328 my @cryptoskipheaders = ( @sslheaders_tmpl,
1329 qw( include/openssl/asn1_mac.h
1330 include/openssl/conf_api.h
1331 include/openssl/ebcdic.h
1332 include/openssl/opensslconf.h
1333 include/openssl/symhacks.h ) );
1334 our %cryptoheaders = ();
1335 our %sslheaders = ();
1336 foreach my $d ( qw( include/openssl include/internal ) ) {
1337 my @header_patterns =
1338 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1339 foreach my $f ( map { glob($_) } @header_patterns ) {
1340 my $base = basename($f);
1341 my $base_in = basename($f, '.in');
1342 my $dir = catfile($config{sourcedir}, $d);
1343 if ($base ne $base_in) {
1344 # We have a .h.in file, which means the header file is in the
1347 $dir = catfile($config{builddir}, $d);
1349 my $new_f = catfile($dir, $base);
1350 my $fn = "$d/$base";
1351 # The logic to add files to @cryptoheaders is a bit complex. The
1352 # file to be added must be either in the public header directory
1353 # or one of the pre-declared internal headers, and must under no
1354 # circumstances be one of those that must be skipped.
1355 $cryptoheaders{$new_f} = 1
1356 if (($d eq 'include/openssl'
1357 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1358 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1359 # The logic to add files to @sslheaders is much simpler...
1360 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1366 sub uniq { my %seen; grep !$seen{$_}++, @_; }
1367 sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; }
1368 join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5,
1369 uniq(grep /\.(c|cc|cpp)$/,
1370 flat (map { $unified_info{sources}->{$_} }
1371 (sort keys %{$unified_info{sources}})))))
1373 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1374 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1375 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1376 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1378 renumber: build_generated
1379 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1380 --ordinals $(SRCDIR)/util/libcrypto.num \
1381 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1384 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1385 --ordinals $(SRCDIR)/util/libssl.num \
1386 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1391 ordinals: build_generated
1392 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1393 --ordinals $(SRCDIR)/util/libcrypto.num \
1394 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1396 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1397 --ordinals $(SRCDIR)/util/libssl.num \
1398 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1402 $(MAKE) run_tests TESTS=test_ordinals
1406 -( cd $(SRCDIR); util/ctags.sh )
1407 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1409 providers/fips.checksum.new: providers/fips.module.sources.new
1410 @which unifdef > /dev/null || \
1411 ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \
1413 ( sources=`pwd`/providers/fips.module.sources.new; \
1416 | xargs ./util/fips-checksums.sh ) \
1417 > providers/fips-sources.checksums.new \
1418 && sha256sum providers/fips-sources.checksums.new \
1419 | sed -e 's|\.new||' > providers/fips.checksum.new
1421 fips-checksums: providers/fips.checksum.new
1423 $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new
1424 cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources
1425 cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums
1426 cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum
1428 update-fips-checksums: $(SRCDIR)/providers/fips.checksum
1430 diff-fips-checksums: fips-checksums
1431 diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new
1432 diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new
1433 diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new
1435 # Release targets (note: only available on Unix) #####################
1438 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1440 # Helper targets #####################################################
1442 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf
1444 $(BLDDIR)/util/opensslwrap.sh: Makefile
1445 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1446 mkdir -p "$(BLDDIR)/util"; \
1447 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1450 $(BLDDIR)/apps/openssl.cnf: Makefile
1451 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1452 mkdir -p "$(BLDDIR)/apps"; \
1453 ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
1458 # Building targets ###################################################
1460 Makefile: configdata.pm \
1461 {- join(" \\\n" . ' ' x 10,
1462 fill_lines(" ", $COLUMNS - 10,
1463 @{$config{build_file_templates}})) -}
1464 @echo "Detected changed: $?"
1465 $(PERL) configdata.pm
1466 @echo "**************************************************"
1468 @echo "*** Please run the same make command again ***"
1470 @echo "**************************************************"
1473 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1474 {- join(" \\\n" . ' ' x 15,
1475 fill_lines(" ", $COLUMNS - 15,
1476 @{$config{build_infos}},
1477 @{$config{conf_files}})) -}
1478 @echo "Detected changed: $?"
1479 $(PERL) configdata.pm -r
1480 @echo "**************************************************"
1482 @echo "*** Please run the same make command again ***"
1484 @echo "**************************************************"
1488 $(PERL) configdata.pm -r
1492 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1494 # Helper function to convert dependencies in platform agnostic form to
1495 # dependencies in platform form.
1496 sub compute_platform_depends {
1499 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
1500 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
1501 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
1502 or platform->convertext($x); } @_;
1505 # Helper function to figure out dependencies on libraries
1506 # It takes a list of library names and outputs a list of dependencies
1507 sub compute_lib_depends {
1508 # Depending on shared libraries:
1509 # On Windows POSIX layers, we depend on {libname}.dll.a
1510 # On Unix platforms, we depend on {shlibname}.so
1511 return map { platform->sharedlib_simple($_)
1512 // platform->sharedlib_import($_)
1513 // platform->sharedlib($_)
1514 // platform->staticlib($_)
1518 sub generatetarget {
1520 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
1522 $args{target}: $deps
1528 my $gen0 = $args{generator}->[0];
1529 my $gen_args = join('', map { " $_" }
1530 @{$args{generator}}[1..$#{$args{generator}}]);
1531 my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1532 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1533 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1534 my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}},
1537 if ($args{src} =~ /\.html$/) {
1541 my $title = basename($args{src}, ".html");
1545 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1547 } elsif ($args{src} =~ /\.(\d)$/) {
1549 # Man-page generator
1552 my $name = uc basename($args{src}, ".$section");
1556 pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
1557 --release=\$(VERSION) $pod >\$\@
1559 } elsif (platform->isdef($args{src})) {
1561 # Linker script-ish generator
1563 my $target = platform->def($args{src});
1564 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1565 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
1566 my $ord_name = $args{generator}->[1] || $args{product};
1568 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
1569 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
1571 } elsif (platform->isasm($args{src})
1572 || platform->iscppasm($args{src})) {
1574 # Assembler generator
1577 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1578 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1579 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1580 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1581 } -> {$args{intent}};
1584 if ($gen0 =~ /\.pl$/) {
1585 $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
1586 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1587 } elsif ($gen0 =~ /\.m4$/) {
1588 $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
1589 } elsif ($gen0 =~ /\.S$/) {
1592 die "Generator type for $args{src} unknown: $gen0\n";
1595 if (defined($generator)) {
1597 $args{src}: $gen0 $deps
1602 $args{src}: $gen0 $deps
1603 \$(CC) $incs $cppflags $defs -E $gen0 | \\
1604 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1606 } elsif ($gen0 =~ m|^.*\.in$|) {
1608 # "dofile" generator (file.in -> file)
1610 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1611 "util", "dofile.pl")),
1612 rel2abs($config{builddir}));
1613 my @perlmodules = ();
1614 my %perlmoduleincs = ();
1615 my %perlmoduledeps = ();
1616 foreach my $x (('configdata.pm', @{$args{deps}})) {
1617 # Compute (i)nclusion directory, (m)odule name and (d)ependency
1623 # Massage the module part to become a real perl module spec
1626 # Directory specs are :: in perl package names
1629 # Full file name of the dependency
1630 $d = catfile($i, $d) if $i;
1631 } elsif ($x =~ /\.pm$/) {
1633 $m = basename($x, '.pm');
1636 # All other dependencies are simply collected
1639 push @perlmodules, '"-M'.$m.'"' if $m;
1640 $perlmoduledeps{$d} = 1;
1641 $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i;
1644 # Because of the special treatment of dependencies, we need to
1645 # recompute $deps completely
1647 = join(" ", compute_platform_depends(@{$args{generator_deps}},
1648 sort keys %perlmoduledeps));
1649 my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules);
1652 $args{src}: $gen0 $deps
1653 \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
1655 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1657 # Generic generator using OpenSSL programs
1660 # Redo $gen0, to ensure that we have the proper extension where
1662 $gen0 = platform->bin($gen0);
1663 # Use $(PERL) to execute wrap.pl directly to avoid calling env
1665 $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
1666 \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
1670 # Generic generator using Perl
1673 $args{src}: $gen0 $deps
1674 \$(PERL)$gen_incs $gen0$gen_args > \$@
1679 # Should one wonder about the end of the Perl snippet, it's because this
1680 # second regexp eats up line endings as well, if the removed path is the
1681 # last in the line. We may therefore need to put back a line ending.
1684 my $obj = platform->convertext($args{obj});
1685 my $dep = platform->dep($args{obj});
1686 my @srcs = @{$args{srcs}};
1687 my $srcs = join(" ", @srcs);
1688 my $deps = join(" ", @srcs, @{$args{deps}});
1689 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1690 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1694 if (grep /\.rc$/, @srcs) {
1696 $cmdflags = '$(RCFLAGS)';
1698 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1700 $cmdcompile = ' -c';
1702 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1703 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1704 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1705 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1706 } -> {$args{intent}};
1709 $cmdcompile = ' -c';
1711 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1712 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1713 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1714 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1715 } -> {$args{intent}};
1718 # extension-specific rules
1719 if (grep /\.s$/, @srcs) {
1722 $cmd $cmdflags -c -o \$\@ $srcs
1724 } elsif (grep /\.S$/, @srcs) {
1725 # Originally there was multi-step rule with $(CC) -E file.S
1726 # followed by $(CC) -c file.s. It compensated for one of
1727 # legacy platform compiler's inability to handle .S files.
1728 # The platform is long discontinued by vendor so there is
1729 # hardly a point to drag it along...
1732 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1734 } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
1737 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1739 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1742 mv $dep.tmp $dep; \\
1748 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1750 if ($makedep_scheme eq 'makedepend') {
1752 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1759 # We *know* this routine is only called when we've configure 'shared'.
1764 foreach (@{$args{deps}}) {
1765 if (platform->isstaticlib($_)) {
1766 push @linklibs, platform->convertext($_);
1768 my $d = "-L" . dirname($_);
1769 my $l = basename($_);
1773 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1776 my $linkflags = join("", map { $_." " } @linkdirs);
1777 my $linklibs = join("", map { $_." " } @linklibs);
1778 my @objs = map { platform->convertext($_) }
1779 grep { !platform->isdef($_) }
1781 my @defs = map { platform->def($_) }
1782 grep { platform->isdef($_) }
1784 my @deps = compute_lib_depends(@{$args{deps}});
1785 die "More than one exported symbol map" if scalar @defs > 1;
1787 my $full = platform->sharedlib($args{lib});
1788 # $import is for Windows and subsystems thereof, where static import
1789 # libraries for DLLs are a thing. On platforms that have this mechanism,
1790 # $import has the name of this import library. On platforms that don't
1791 # have this mechanism, $import will be |undef|.
1792 my $import = platform->sharedlib_import($args{lib});
1793 # $simple is for platforms where full shared library names include the
1794 # shared library version, and there's a simpler name that doesn't include
1795 # that version. On such platforms, $simple has the simpler name. On
1796 # other platforms, it will be |undef|.
1797 my $simple = platform->sharedlib_simple($args{lib});
1799 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1800 my $shared_soname = "";
1801 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1802 if defined $target{shared_sonameflag};
1803 my $shared_imp = "";
1804 $shared_imp .= ' '.$target{shared_impflag}.basename($import)
1805 if defined $target{shared_impflag} && defined $import;
1806 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1808 # There is at least one platform where the compiler-as-linker needs to
1809 # have one object file directly on the command line. That won't hurt
1810 # any other platform, so we do that for everyone when there's an argfile
1811 # to be had. This depends heavily on splice, which removes elements from
1812 # the given array, and returns them so they can be captured.
1813 my @argfileobjs = $argfile
1816 my $argfilecmds = $argfile
1817 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1819 my $argfiledeps = $argfile
1820 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1821 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1823 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1826 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1829 join(" \\\n" . ' ' x (length($full) + 2),
1830 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1832 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1836 if (defined $simple && $simple ne $full) {
1841 \$(AR) r $simple $full
1851 if (defined $import) {
1858 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1859 -o $full$shared_def \\
1861 $linklibs \$(LIB_EX_LIBS)
1870 if (!$disabled{tests}) {
1877 $recipe .= <<"EOF" if defined $argfile;
1878 $argfile: $argfiledeps
1886 my $dso = platform->dso($args{module});
1889 foreach (@{$args{deps}}) {
1890 next unless defined $_;
1891 if (platform->isstaticlib($_)) {
1892 push @linklibs, platform->convertext($_);
1894 my $d = "-L" . dirname($_);
1895 my $l = basename($_);
1899 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1902 my $linkflags = join("", map { $_." " } @linkdirs);
1903 my $linklibs = join("", map { $_." " } @linklibs);
1904 my @objs = map { platform->convertext($_) }
1905 grep { !platform->isdef($_) }
1907 my @defs = map { platform->def($_) }
1908 grep { platform->isdef($_) }
1910 my @deps = compute_lib_depends(@{$args{deps}});
1911 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1912 # Next line needs to become "less magic" (see PR #11950)
1913 $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/);
1914 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1915 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1916 fill_lines(' ', $COLUMNS - length($dso) - 2,
1917 @objs, @defs, @deps));
1921 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1922 -o $dso$shared_def \\
1924 $linklibs\$(DSO_EX_LIBS)
1929 my $lib = platform->staticlib($args{lib});
1930 my @objs = map { platform->obj($_) } @{$args{objs}};
1931 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1932 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1933 my $max_per_call = 500;
1935 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1937 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1942 \$(RANLIB) \$\@ || echo Never mind.
1947 my $bin = platform->bin($args{bin});
1948 my @objs = map { platform->obj($_) } @{$args{objs}};
1949 my @deps = compute_lib_depends(@{$args{deps}});
1950 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1951 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1954 foreach (@{$args{deps}}) {
1955 next unless defined $_;
1956 if (platform->isstaticlib($_)) {
1957 push @linklibs, platform->convertext($_);
1959 my $d = "-L" . dirname($_);
1960 my $l = basename($_);
1964 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1967 my $linkflags = join("", map { $_." " } @linkdirs);
1968 my $linklibs = join("", map { $_." " } @linklibs);
1970 my $cmdflags = '$(BIN_CFLAGS)';
1971 if (grep /_cc\.o$/, @{$args{objs}}) {
1973 $cmdflags = '$(BIN_CXXFLAGS)';
1976 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1977 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1978 fill_lines(' ', $COLUMNS - length($bin) - 2,
1984 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1987 $linklibs\$(BIN_EX_LIBS)
1992 my $script = $args{script};
1993 my $sources = join(" ", @{$args{sources}});
1994 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1995 "util", "dofile.pl")),
1996 rel2abs($config{builddir}));
1998 $script: $sources configdata.pm
2000 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
2001 "-o$target{build_file}" $sources > "$script"
2007 my $dir = $args{dir};
2008 my @deps = compute_platform_depends(@{$args{deps}});
2011 # We already have a 'test' target, and the top directory is just plain
2013 return if $dir eq "test" || $dir eq ".";
2015 foreach my $type (("dso", "lib", "bin", "script")) {
2016 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
2017 # For lib object files, we could update the library. However, it
2018 # was decided that it's enough to build the directory local object
2019 # files, so we don't need to add any actions, and the dependencies
2020 # are already taken care of.
2021 if ($type ne "lib") {
2022 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
2023 if (dirname($prod) eq $dir) {
2024 push @deps, compute_platform_depends($prod);
2026 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
2032 my $target = "$dir $dir/";
2033 my $deps = join(" \\\n\t",
2034 fill_lines(' ', $COLUMNS - 8, @deps));
2035 my $comments = join("\n", "", @comments);
2041 "" # Important! This becomes part of the template result.