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
24 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
27 our $COLUMNS = $ENV{COLUMNS};
28 if ($COLUMNS =~ /^\d+$/) {
29 $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
35 my $item_sep = shift; # string
36 my $line_length = shift; # number of chars
42 my $fill_line = $result[$resultpos] // '';
44 ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
46 if (length($newline) > $line_length) {
47 # If this is a single item and the intended result line
48 # is empty, we put it there anyway
49 if ($fill_line eq '') {
50 $result[$resultpos++] = $newline;
52 $result[++$resultpos] = $_;
55 $result[$resultpos] = $newline;
62 PLATFORM={- $config{target} -}
63 OPTIONS={- $config{options} -}
64 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
65 SRCDIR={- $config{sourcedir} -}
66 BLDDIR={- $config{builddir} -}
67 FIPSKEY={- $config{FIPSKEY} -}
69 VERSION={- "$config{full_version}" -}
70 VERSION_NUMBER={- "$config{version}" -}
71 MAJOR={- $config{major} -}
72 MINOR={- $config{minor} -}
73 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
74 SHLIB_TARGET={- $target{shared_target} -}
76 LIBS={- join(" \\\n" . ' ' x 5,
77 fill_lines(" ", $COLUMNS - 5,
78 map { platform->staticlib($_) // () }
79 @{$unified_info{libraries}})) -}
80 SHLIBS={- join(" \\\n" . ' ' x 7,
81 fill_lines(" ", $COLUMNS - 7,
82 map { platform->sharedlib($_) // () }
83 @{$unified_info{libraries}})) -}
84 SHLIB_INFO={- join(" \\\n" . ' ' x 11,
85 fill_lines(" ", $COLUMNS - 11,
86 map { my $x = platform->sharedlib($_);
87 my $y = platform->sharedlib_simple($_) // '';
88 my $z = platform->sharedlib_import($_) // '';
89 $x ? "\"$x;$y;$z\"" : () }
90 @{$unified_info{libraries}})) -}
91 MODULES={- join(" \\\n" . ' ' x 8,
92 fill_lines(" ", $COLUMNS - 8,
93 map { platform->dso($_) }
94 # Drop all modules that are dependencies, they will
95 # be processed through their dependents
97 !grep { grep { $_ eq $x } @$_ }
98 values %{$unified_info{depends}} }
99 @{$unified_info{modules}})) -}
100 FIPSMODULE={- # We do some extra checking here, as there should be only one
103 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
104 && $unified_info{attributes}->{modules}->{$_}->{fips} }
105 @{$unified_info{modules}};
106 die "More that one FIPS module" if scalar @fipsmodules > 1;
107 join(" ", map { platform->dso($_) } @fipsmodules) -}
108 FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
109 join(" ", map { basename(platform->dso($_)) } @fipsmodules) -}
111 PROGRAMS={- join(" \\\n" . ' ' x 9,
112 fill_lines(" ", $COLUMNS - 9,
113 map { platform->bin($_) }
114 @{$unified_info{programs}})) -}
115 SCRIPTS={- join(" \\\n" . ' ' x 8,
116 fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
117 {- output_off() if $disabled{makedepend}; "" -}
118 DEPS={- join(" \\\n" . ' ' x 5,
119 fill_lines(" ", $COLUMNS - 5,
120 map { platform->isobj($_) ? platform->dep($_) : () }
121 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
122 keys %{$unified_info{sources}})); -}
123 {- output_on() if $disabled{makedepend}; "" -}
124 GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
125 fill_lines(" ", $COLUMNS - 20,
126 @{$unified_info{depends}->{""}})) -}
127 GENERATED_PODS={- # common0.tmpl provides @generated
128 join(" \\\n" . ' ' x 15,
129 fill_lines(" ", $COLUMNS - 15,
133 $unified_info{attributes}->{depends}
134 ->{$x}->{$_}->{pod} // 0
136 keys %{$unified_info{attributes}->{depends}->{$x}}
140 GENERATED={- # common0.tmpl provides @generated
141 join(" \\\n" . ' ' x 5,
142 fill_lines(" ", $COLUMNS - 5,
143 map { platform->convertext($_) } @generated )) -}
146 join(" \\\n" . ' ' x 13,
147 fill_lines(" ", $COLUMNS - 13,
148 map { platform->staticlib($_) // () }
149 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
150 @{$unified_info{libraries}}))
153 join(" \\\n" . ' ' x 15,
154 fill_lines(" ", $COLUMNS - 15,
155 map { platform->sharedlib($_) // () }
156 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
157 @{$unified_info{libraries}}))
159 INSTALL_SHLIB_INFO={-
160 join(" \\\n" . ' ' x 19,
161 fill_lines(" ", $COLUMNS - 19,
162 map { my $x = platform->sharedlib($_);
163 my $y = platform->sharedlib_simple($_) // '';
164 my $z = platform->sharedlib_import($_) // '';
165 $x ? "\"$x;$y;$z\"" : () }
166 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
167 @{$unified_info{libraries}}))
170 join(" \\\n" . ' ' x 16,
171 fill_lines(" ", $COLUMNS - 16,
172 map { platform->dso($_) }
173 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
174 && $unified_info{attributes}->{modules}->{$_}->{engine} }
175 @{$unified_info{modules}}))
178 join(" \\\n" . ' ' x 16,
179 fill_lines(" ", $COLUMNS - 16,
180 map { platform->dso($_) }
181 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
182 && !$unified_info{attributes}->{modules}->{$_}->{engine}
183 && !$unified_info{attributes}->{modules}->{$_}->{fips} }
184 @{$unified_info{modules}}))
186 INSTALL_FIPSMODULE={-
187 join(" \\\n" . ' ' x 16,
188 fill_lines(" ", $COLUMNS - 16,
189 map { platform->dso($_) }
190 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
191 && $unified_info{attributes}->{modules}->{$_}->{fips} }
192 @{$unified_info{modules}}))
194 INSTALL_FIPSMODULECONF=providers/fipsmodule.cnf
196 join(" \\\n" . ' ' x 16,
197 fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
198 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
199 @{$unified_info{programs}}))
202 join(" \\\n" . ' ' x 12,
203 fill_lines(" ", $COLUMNS - 12,
204 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
206 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
207 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
208 @{$unified_info{scripts}}))
211 join(" \\\n" . ' ' x 13,
212 fill_lines(" ", $COLUMNS - 13,
213 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
215 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
216 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
217 @{$unified_info{scripts}}))
220 join(" \\\n" . ' ' x 10,
221 fill_lines(" ", $COLUMNS - 10,
222 @{$unified_info{imagedocs}->{man1}})) -}
224 join(" \\\n" . ' ' x 10,
225 fill_lines(" ", $COLUMNS - 10,
226 @{$unified_info{imagedocs}->{man3}})) -}
228 join(" \\\n" . ' ' x 10,
229 fill_lines(" ", $COLUMNS - 10,
230 @{$unified_info{imagedocs}->{man5}})) -}
232 join(" \\\n" . ' ' x 10,
233 fill_lines(" ", $COLUMNS - 10,
234 @{$unified_info{imagedocs}->{man7}})) -}
236 join(" \\\n" . ' ' x 10,
237 fill_lines(" ", $COLUMNS - 10,
238 @{$unified_info{htmldocs}->{man1}})) -}
240 join(" \\\n" . ' ' x 10,
241 fill_lines(" ", $COLUMNS - 10,
242 @{$unified_info{htmldocs}->{man3}})) -}
244 join(" \\\n" . ' ' x 10,
245 fill_lines(" ", $COLUMNS - 10,
246 @{$unified_info{htmldocs}->{man5}})) -}
248 join(" \\\n" . ' ' x 10,
249 fill_lines(" ", $COLUMNS - 10,
250 @{$unified_info{htmldocs}->{man7}})) -}
252 join(" \\\n" . ' ' x 9,
253 fill_lines(" ", $COLUMNS - 9,
254 @{$unified_info{mandocs}->{man1}})) -}
256 join(" \\\n" . ' ' x 9,
257 fill_lines(" ", $COLUMNS - 9,
258 @{$unified_info{mandocs}->{man3}})) -}
260 join(" \\\n" . ' ' x 9,
261 fill_lines(" ", $COLUMNS - 9,
262 @{$unified_info{mandocs}->{man5}})) -}
264 join(" \\\n" . ' ' x 9,
265 fill_lines(" ", $COLUMNS - 9,
266 @{$unified_info{mandocs}->{man7}})) -}
268 APPS_OPENSSL="{- use File::Spec::Functions;
269 catfile("apps","openssl") -}"
271 # DESTDIR is for package builders so that they can configure for, say,
272 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
273 # Normally it is left empty.
276 # Do not edit these manually. Use Configure with --prefix or --openssldir
277 # to change this! Short explanation in the top comment in Configure
278 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
280 our $prefix = $config{prefix} || "/usr/local";
283 # The logic here is that if no --openssldir was given,
284 # OPENSSLDIR will get the value from $prefix plus "/ssl".
285 # If --openssldir was given and the value is an absolute
286 # path, OPENSSLDIR will get its value without change.
287 # If the value from --openssldir is a relative path,
288 # OPENSSLDIR will get $prefix with the --openssldir
289 # value appended as a subdirectory.
291 use File::Spec::Functions;
293 $config{openssldir} ?
294 (file_name_is_absolute($config{openssldir}) ?
296 : catdir($prefix, $config{openssldir}))
297 : catdir($prefix, "ssl");
299 LIBDIR={- our $libdir = $config{libdir};
301 $libdir = "lib$target{multilib}";
303 file_name_is_absolute($libdir) ? "" : $libdir -}
304 # $(libdir) is chosen to be compatible with the GNU coding standards
305 libdir={- file_name_is_absolute($libdir)
306 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
307 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
308 MODULESDIR=$(libdir)/ossl-modules
310 # Convenience variable for those who want to set the rpath in shared
311 # libraries and applications
314 BINDIR={- our $bindir = $config{bindir};
316 $bindir = "bin$target{multibin}";
318 file_name_is_absolute($bindir) ? "" : $bindir -}
319 bindir={- file_name_is_absolute($bindir)
320 ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -}
322 MANDIR=$(INSTALLTOP)/share/man
323 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
324 HTMLDIR=$(DOCDIR)/html
326 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
327 # appended after the manpage file section number. "ssl" is popular,
328 # resulting in files such as config.5ssl rather than config.5.
332 # For "optional" echo messages, to get "real" silence
335 ##### User defined commands and flags ################################
337 # We let the C compiler driver to take care of .s files. This is done in
338 # order to be excused from maintaining a separate set of architecture
339 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
340 # gcc, then the driver will automatically translate it to -xarch=v8plus
341 # and pass it down to assembler. In any case, we do not define AS or
342 # ASFLAGS for this reason.
344 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
345 CC=$(CROSS_COMPILE){- $config{CC} -}
346 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
347 CPPFLAGS={- our $cppflags1 = join(" ",
348 (map { "-D".$_} @{$config{CPPDEFINES}}),
349 (map { "-I".$_} @{$config{CPPINCLUDES}}),
350 @{$config{CPPFLAGS}}) -}
351 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
352 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
353 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
354 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
356 MAKEDEPEND={- $config{makedepcmd} -}
358 PERL={- $config{PERL} -}
360 AR=$(CROSS_COMPILE){- $config{AR} -}
361 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
362 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
363 RC= $(CROSS_COMPILE){- $config{RC} -}
364 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
368 TAR= {- $target{TAR} || "tar" -}
369 TARFLAGS= {- $target{TARFLAGS} -}
372 NAME= $(BASENAME)-$(VERSION)
373 # Relative to $(SRCDIR)
374 TARFILE= ../$(NAME).tar
376 ##### Project flags ##################################################
378 # Variables starting with CNF_ are common variables for all product types
380 CNF_CPPFLAGS={- our $cppflags2 =
381 join(' ', $target{cppflags} || (),
382 (map { "-D".$_} @{$target{defines}},
383 @{$config{defines}}),
384 (map { "-I".$_} @{$target{includes}},
385 @{$config{includes}}),
386 @{$config{cppflags}}) -}
387 CNF_CFLAGS={- join(' ', $target{cflags} || (),
388 @{$config{cflags}}) -}
389 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
390 @{$config{cxxflags}}) -}
391 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
392 @{$config{lflags}}) -}
393 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
394 @{$config{ex_libs}}) -}
396 # Variables starting with LIB_ are used to build library object files
397 # and shared libraries.
398 # Variables starting with DSO_ are used to build DSOs and their object files.
399 # Variables starting with BIN_ are used to build programs and their object
402 LIB_CPPFLAGS={- our $lib_cppflags =
403 join(' ', $target{lib_cppflags} || (),
404 $target{shared_cppflag} || (),
406 @{$target{lib_defines} || ()},
407 @{$target{shared_defines} || ()},
408 @{$config{lib_defines} || ()},
409 @{$config{shared_defines} || ()}),
410 (map { '-I'.quotify1($_) }
411 @{$target{lib_includes}},
412 @{$target{shared_includes}},
413 @{$config{lib_includes}},
414 @{$config{shared_includes}}),
415 @{$config{lib_cppflags}},
416 @{$config{shared_cppflag}});
417 join(' ', $lib_cppflags,
419 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
420 'ENGINESDIR="\"$(ENGINESDIR)\""',
421 'MODULESDIR="\"$(MODULESDIR)\""'),
422 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
423 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
424 $target{shared_cflag} || (),
425 @{$config{lib_cflags}},
426 @{$config{shared_cflag}},
427 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
428 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
429 $target{shared_cxxflag} || (),
430 @{$config{lib_cxxflags}},
431 @{$config{shared_cxxflag}},
432 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
433 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
434 $config{shared_ldflag} || (),
435 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
436 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
437 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
438 $target{module_cppflags} || (),
440 @{$target{dso_defines}},
441 @{$target{module_defines}},
442 @{$config{dso_defines} || ()},
443 @{$config{module_defines} || ()}),
444 (map { '-I'.quotify1($_) }
445 @{$target{dso_includes}},
446 @{$target{module_includes}},
447 @{$config{dso_includes}},
448 @{$config{module_includes}}),
449 @{$config{dso_cppflags}},
450 @{$config{module_cppflags}},
451 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
452 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
453 $target{module_cflags} || (),
454 @{$config{dso_cflags}},
455 @{$config{module_cflags}},
456 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
457 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
458 $target{module_cxxflags} || (),
459 @{$config{dso_cxxflags}},
460 @{$config{module_cxxflag}},
461 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
462 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
463 $target{module_ldflags} || (),
464 @{$config{dso_ldflags}},
465 @{$config{module_ldflags}},
466 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
467 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
468 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
469 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
470 @{$config{bin_cppflags}},
471 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
472 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
473 @{$config{bin_cflags}},
474 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
475 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
476 @{$config{bin_cxxflags}},
477 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
478 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
479 @{$config{bin_lflags}},
480 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
481 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
483 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
484 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
485 $cppflags2 =~ s|([\\"])|\\$1|g;
486 $lib_cppflags =~ s|([\\"])|\\$1|g;
487 join(' ', $lib_cppflags || (), $cppflags2 || (),
490 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
492 # For x86 assembler: Set PROCESSOR to 386 if you want to support
494 PROCESSOR= {- $config{processor} -}
496 # We want error [and other] messages in English. Trouble is that make(1)
497 # doesn't pass macros down as environment variables unless there already
498 # was corresponding variable originally set. In other words we can only
499 # reassign environment variables, but not set new ones, not in portable
500 # manner that is. That's why we reassign several, just to be sure...
505 # The main targets ###################################################
507 {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
508 {- dependmagic('build_libs'); -}: build_libs_nodep
509 {- dependmagic('build_modules'); -}: build_modules_nodep
510 {- dependmagic('build_programs'); -}: build_programs_nodep
512 build_generated_pods: $(GENERATED_PODS)
513 build_docs: build_man_docs build_html_docs
514 build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
515 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
517 build_generated: $(GENERATED_MANDATORY)
518 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
519 build_modules_nodep: $(MODULES)
520 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
522 # Kept around for backward compatibility
523 build_apps build_tests: build_programs
525 # Convenience target to prebuild all generated files, not just the mandatory
527 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
528 @ : {- output_off() if $disabled{makedepend}; "" -}
529 @echo "Warning: consider configuring with no-makedepend, because if"
530 @echo " target system doesn't have $(PERL),"
531 @echo " then make will fail..."
532 @ : {- output_on() if $disabled{makedepend}; "" -}
534 all: build_sw build_docs
537 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils run_tests
539 @ : {- output_off() if $disabled{tests}; "" -}
543 FIPSKEY="$(FIPSKEY)" \
544 EXE_EXT={- platform->binext() -} \
545 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
546 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
547 @echo "Tests are not supported with your chosen Configure options"
548 @ : {- output_on() if !$disabled{tests}; "" -}
551 @ : {- output_off() if $disabled{tests}; "" -}
552 $(MAKE) run_tests TESTS=list
553 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
554 @echo "Tests are not supported with your chosen Configure options"
555 @ : {- output_on() if !$disabled{tests}; "" -}
557 install: install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -}
559 uninstall: uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}
562 @set -e; for s in $(SHLIB_INFO); do \
563 if [ "$$s" = ";" ]; then continue; fi; \
564 s1=`echo "$$s" | cut -f1 -d";"`; \
565 s2=`echo "$$s" | cut -f2 -d";"`; \
566 s3=`echo "$$s" | cut -f3 -d";"`; \
567 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
570 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
572 if [ "$$s2" != "" ]; then \
573 $(ECHO) $(RM) $$s2; \
576 if [ "$$s3" != "" ]; then \
577 $(ECHO) $(RM) $$s3; \
582 $(RM) *{- platform->defext() -}
593 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS)
594 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
595 -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
596 -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
598 $(RM) tags TAGS doc-nits md-nits
599 $(RM) -r test/test-runs
600 $(RM) providers/fips*.new
601 $(RM) openssl.pc libcrypto.pc libssl.pc
602 -find . -type l \! -name '.*' -exec $(RM) {} \;
605 $(RM) include/openssl/configuration.h
609 # We check if any depfile is newer than Makefile and decide to
610 # concatenate only if that is true.
612 @: {- output_off() if $disabled{makedepend}; "" -}
613 @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}"
614 @: {- output_on() if $disabled{makedepend}; "" -}
616 # Install helper targets #############################################
618 install_sw: install_dev install_engines install_modules install_runtime
620 uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
622 install_docs: install_man_docs install_html_docs
624 uninstall_docs: uninstall_man_docs uninstall_html_docs
625 $(RM) -r $(DESTDIR)$(DOCDIR)
627 {- output_off() if $disabled{fips}; "" -}
628 install_fips: build_sw $(INSTALL_FIPSMODULECONF)
629 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
630 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)
631 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)
632 @$(ECHO) "*** Installing FIPS module"
633 @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
634 @cp "$(INSTALL_FIPSMODULE)" $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new
635 @chmod 755 $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new
636 @mv -f $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new \
637 $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)
638 @$(ECHO) "*** Installing FIPS module configuration"
639 @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
640 @cp $(INSTALL_FIPSMODULECONF) $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf
643 @$(ECHO) "*** Uninstalling FIPS module configuration"
644 $(RM) $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf
645 @$(ECHO) "*** Uninstalling FIPS module"
646 $(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)
647 {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
649 @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
652 @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
653 {- output_on() if !$disabled{fips}; "" -}
657 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
658 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
659 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
660 @set -e; for x in dummy $(MISC_SCRIPTS); do \
661 if [ "$$x" = "dummy" ]; then continue; fi; \
662 x1=`echo "$$x" | cut -f1 -d:`; \
663 x2=`echo "$$x" | cut -f2 -d:`; \
664 fn=`basename $$x1`; \
665 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
666 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
667 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
668 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
669 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
670 if [ "$$x1" != "$$x2" ]; then \
671 ln=`basename "$$x2"`; \
672 : {- output_off() unless windowsdll(); "" -}; \
673 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
674 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
675 : {- output_on() unless windowsdll();
676 output_off() if windowsdll(); "" -}; \
677 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
678 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
679 : {- output_on() if windowsdll(); "" -}; \
682 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
683 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
684 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
685 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
686 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
687 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
688 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
689 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
691 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
692 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
693 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
694 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
695 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
696 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
697 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
698 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
701 install_dev: install_runtime_libs
702 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
703 @$(ECHO) "*** Installing development files"
704 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
705 @ : {- output_off() if $disabled{uplink}; "" -}
706 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
707 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
708 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
709 @ : {- output_on() if $disabled{uplink}; "" -}
710 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
711 $(BLDDIR)/include/openssl/*.h; do \
713 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
714 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
715 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
717 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
718 @set -e; for l in $(INSTALL_LIBS); do \
720 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
721 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
722 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
723 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
724 mv -f $(DESTDIR)$(libdir)/$$fn.new \
725 $(DESTDIR)$(libdir)/$$fn; \
727 @ : {- output_off() if $disabled{shared}; "" -}
728 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
729 s1=`echo "$$s" | cut -f1 -d";"`; \
730 s2=`echo "$$s" | cut -f2 -d";"`; \
731 s3=`echo "$$s" | cut -f3 -d";"`; \
732 fn1=`basename "$$s1"`; \
733 fn2=`basename "$$s2"`; \
734 fn3=`basename "$$s3"`; \
735 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
736 if [ "$$fn2" != "" ]; then \
737 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
738 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
740 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
741 if [ "$$fn3" != "" ]; then \
742 $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
743 cp $$s3 $(DESTDIR)$(libdir)/$$fn3.new; \
744 chmod 755 $(DESTDIR)$(libdir)/$$fn3.new; \
745 mv -f $(DESTDIR)$(libdir)/$$fn3.new \
746 $(DESTDIR)$(libdir)/$$fn3; \
748 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
749 a=$(DESTDIR)$(libdir)/$$fn2; \
750 $(ECHO) "install $$s1 -> $$a"; \
751 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
752 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
754 for so in `$(AR) t $$a`; do \
757 strip -X32_64 -e $$so; \
758 $(AR) r $$a.new $$so; \
761 $(AR) r $$a.new $$s1; \
763 : {- output_off() if sharedaix(); output_on(); "" -}; \
765 @ : {- output_on() if $disabled{shared}; "" -}
766 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
767 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
768 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
769 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
770 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
771 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
772 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
773 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
774 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
775 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
777 uninstall_dev: uninstall_runtime_libs
778 @$(ECHO) "*** Uninstalling development files"
779 @ : {- output_off() if $disabled{uplink}; "" -}
780 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
781 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
782 @ : {- output_on() if $disabled{uplink}; "" -}
783 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
784 $(BLDDIR)/include/openssl/*.h; do \
786 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
787 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
789 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
790 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
791 @set -e; for l in $(INSTALL_LIBS); do \
793 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
794 $(RM) $(DESTDIR)$(libdir)/$$fn; \
796 @ : {- output_off() if $disabled{shared}; "" -}
797 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
798 s1=`echo "$$s" | cut -f1 -d";"`; \
799 s2=`echo "$$s" | cut -f2 -d";"`; \
800 s3=`echo "$$s" | cut -f3 -d";"`; \
801 fn1=`basename "$$s1"`; \
802 fn2=`basename "$$s2"`; \
803 fn3=`basename "$$s3"`; \
804 : {- output_off() if windowsdll(); "" -}; \
805 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
806 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
807 if [ -n "$$fn2" ]; then \
808 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
809 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
811 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
812 if [ -n "$$fn3" ]; then \
813 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
814 $(RM) $(DESTDIR)$(libdir)/$$fn3; \
816 : {- output_on() unless windowsdll(); "" -}; \
818 @ : {- output_on() if $disabled{shared}; "" -}
819 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
820 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
821 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
822 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
823 -$(RMDIR) $(DESTDIR)$(libdir)
825 _install_modules_deps: install_runtime_libs build_modules
827 install_engines: _install_modules_deps
828 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
829 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
830 @$(ECHO) "*** Installing engines"
831 @set -e; for e in dummy $(INSTALL_ENGINES); do \
832 if [ "$$e" = "dummy" ]; then continue; fi; \
834 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
835 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
836 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
837 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
838 $(DESTDIR)$(ENGINESDIR)/$$fn; \
842 @$(ECHO) "*** Uninstalling engines"
843 @set -e; for e in dummy $(INSTALL_ENGINES); do \
844 if [ "$$e" = "dummy" ]; then continue; fi; \
846 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
847 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
849 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
851 install_modules: _install_modules_deps
852 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
853 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
854 @$(ECHO) "*** Installing modules"
855 @set -e; for e in dummy $(INSTALL_MODULES); do \
856 if [ "$$e" = "dummy" ]; then continue; fi; \
858 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
859 cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \
860 chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \
861 mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \
862 $(DESTDIR)$(MODULESDIR)/$$fn; \
866 @$(ECHO) "*** Uninstalling modules"
867 @set -e; for e in dummy $(INSTALL_MODULES); do \
868 if [ "$$e" = "dummy" ]; then continue; fi; \
870 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
871 $(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \
873 -$(RMDIR) $(DESTDIR)$(MODULESDIR)
875 install_runtime: install_programs
877 install_runtime_libs: build_libs
878 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
879 @ : {- output_off() if windowsdll(); "" -}
880 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
881 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
882 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(bindir)/
883 @ : {- output_on() unless windowsdll(); "" -}
884 @$(ECHO) "*** Installing runtime libraries"
885 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
886 if [ "$$s" = "dummy" ]; then continue; fi; \
888 : {- output_off() unless windowsdll(); "" -}; \
889 $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \
890 cp $$s $(DESTDIR)$(bindir)/$$fn.new; \
891 chmod 755 $(DESTDIR)$(bindir)/$$fn.new; \
892 mv -f $(DESTDIR)$(bindir)/$$fn.new \
893 $(DESTDIR)$(bindir)/$$fn; \
894 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
895 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
896 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
897 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
898 mv -f $(DESTDIR)$(libdir)/$$fn.new \
899 $(DESTDIR)$(libdir)/$$fn; \
900 : {- output_on() if windowsdll(); "" -}; \
903 install_programs: install_runtime_libs build_programs
904 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
905 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(bindir)
906 @$(ECHO) "*** Installing runtime programs"
907 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
908 if [ "$$x" = "dummy" ]; then continue; fi; \
910 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
911 cp $$x $(DESTDIR)$(bindir)/$$fn.new; \
912 chmod 755 $(DESTDIR)$(bindir)/$$fn.new; \
913 mv -f $(DESTDIR)$(bindir)/$$fn.new \
914 $(DESTDIR)$(bindir)/$$fn; \
916 @set -e; for x in dummy $(BIN_SCRIPTS); do \
917 if [ "$$x" = "dummy" ]; then continue; fi; \
919 $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
920 cp $$x $(DESTDIR)$(bindir)/$$fn.new; \
921 chmod 755 $(DESTDIR)$(bindir)/$$fn.new; \
922 mv -f $(DESTDIR)$(bindir)/$$fn.new \
923 $(DESTDIR)$(bindir)/$$fn; \
926 uninstall_runtime: uninstall_programs uninstall_runtime_libs
929 @$(ECHO) "*** Uninstalling runtime programs"
930 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
932 if [ "$$x" = "dummy" ]; then continue; fi; \
934 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
935 $(RM) $(DESTDIR)$(bindir)/$$fn; \
937 @set -e; for x in dummy $(BIN_SCRIPTS); \
939 if [ "$$x" = "dummy" ]; then continue; fi; \
941 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
942 $(RM) $(DESTDIR)$(bindir)/$$fn; \
944 -$(RMDIR) $(DESTDIR)$(bindir)
946 uninstall_runtime_libs:
947 @$(ECHO) "*** Uninstalling runtime libraries"
948 @ : {- output_off() unless windowsdll(); "" -}
949 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
950 if [ "$$s" = "dummy" ]; then continue; fi; \
952 $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
953 $(RM) $(DESTDIR)$(bindir)/$$fn; \
955 @ : {- output_on() unless windowsdll(); "" -}
958 install_man_docs: build_man_docs
959 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
960 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
961 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
962 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
963 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
964 @$(ECHO) "*** Installing manpages"
965 @set -e; for x in dummy $(MANDOCS1); do \
966 if [ "$$x" = "dummy" ]; then continue; fi; \
968 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
969 cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
970 chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
971 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man1; \
973 @set -e; for x in dummy $(MANDOCS3); do \
974 if [ "$$x" = "dummy" ]; then continue; fi; \
976 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
977 cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
978 chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
979 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man3; \
981 @set -e; for x in dummy $(MANDOCS5); do \
982 if [ "$$x" = "dummy" ]; then continue; fi; \
984 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
985 cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
986 chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
987 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man5; \
989 @set -e; for x in dummy $(MANDOCS7); do \
990 if [ "$$x" = "dummy" ]; then continue; fi; \
992 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
993 cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
994 chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
995 $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man7; \
998 uninstall_man_docs: build_man_docs
999 @$(ECHO) "*** Uninstalling manpages"
1000 @set -e; for x in dummy $(MANDOCS1); do \
1001 if [ "$$x" = "dummy" ]; then continue; fi; \
1002 fn=`basename $$x`; \
1003 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
1004 $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
1005 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man1; \
1007 @set -e; for x in dummy $(MANDOCS3); do \
1008 if [ "$$x" = "dummy" ]; then continue; fi; \
1009 fn=`basename $$x`; \
1010 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
1011 $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
1012 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man3; \
1014 @set -e; for x in dummy $(MANDOCS5); do \
1015 if [ "$$x" = "dummy" ]; then continue; fi; \
1016 fn=`basename $$x`; \
1017 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
1018 $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
1019 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man5; \
1021 @set -e; for x in dummy $(MANDOCS7); do \
1022 if [ "$$x" = "dummy" ]; then continue; fi; \
1023 fn=`basename $$x`; \
1024 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
1025 $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
1026 $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man7; \
1029 install_html_docs: install_image_docs build_html_docs
1030 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
1031 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
1032 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
1033 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
1034 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
1035 @$(ECHO) "*** Installing HTML manpages"
1036 @set -e; for x in dummy $(HTMLDOCS1); do \
1037 if [ "$$x" = "dummy" ]; then continue; fi; \
1038 fn=`basename $$x`; \
1039 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1040 cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
1041 chmod 644 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
1043 @set -e; for x in dummy $(HTMLDOCS3); do \
1044 if [ "$$x" = "dummy" ]; then continue; fi; \
1045 fn=`basename $$x`; \
1046 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1047 cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
1048 chmod 644 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
1050 @set -e; for x in dummy $(HTMLDOCS5); do \
1051 if [ "$$x" = "dummy" ]; then continue; fi; \
1052 fn=`basename $$x`; \
1053 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1054 cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
1055 chmod 644 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
1057 @set -e; for x in dummy $(HTMLDOCS7); do \
1058 if [ "$$x" = "dummy" ]; then continue; fi; \
1059 fn=`basename $$x`; \
1060 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1061 cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1062 chmod 644 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1065 uninstall_html_docs: uninstall_image_docs
1066 @$(ECHO) "*** Uninstalling HTML manpages"
1067 @set -e; for x in dummy $(HTMLDOCS1); do \
1068 if [ "$$x" = "dummy" ]; then continue; fi; \
1069 fn=`basename $$x`; \
1070 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1071 $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
1073 @set -e; for x in dummy $(HTMLDOCS3); do \
1074 if [ "$$x" = "dummy" ]; then continue; fi; \
1075 fn=`basename $$x`; \
1076 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1077 $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
1079 @set -e; for x in dummy $(HTMLDOCS5); do \
1080 if [ "$$x" = "dummy" ]; then continue; fi; \
1081 fn=`basename $$x`; \
1082 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1083 $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
1085 @set -e; for x in dummy $(HTMLDOCS7); do \
1086 if [ "$$x" = "dummy" ]; then continue; fi; \
1087 fn=`basename $$x`; \
1088 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1089 $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1093 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7/img
1094 @set -e; for x in dummy $(IMAGEDOCS7); do \
1095 if [ "$$x" = "dummy" ]; then continue; fi; \
1096 fn=`basename $$x`; \
1097 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1098 cp $(SRCDIR)/$$x $(DESTDIR)$(HTMLDIR)/man7/img/$$fn; \
1099 chmod 644 $(DESTDIR)$(HTMLDIR)/man7/img/$$fn; \
1102 uninstall_image_docs:
1103 @set -e; for x in dummy $(IMAGEDOCS7); do \
1104 if [ "$$x" = "dummy" ]; then continue; fi; \
1105 fn=`basename $$x`; \
1106 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
1107 $(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn; \
1110 # Developer targets (note: these are only available on Unix) #########
1112 # It's important that generate_buildinfo comes after ordinals, as ordinals
1113 # is sensitive to build.info changes.
1114 update: generate errors ordinals generate_buildinfo
1116 .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \
1117 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1118 generate: generate_apps generate_crypto_bn generate_crypto_objects \
1119 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1121 .PHONY: generate_buildinfo generate_doc_buildinfo
1122 generate_buildinfo: generate_doc_buildinfo
1124 .PHONY: doc-nits md-nits
1125 doc-nits: build_generated_pods
1126 $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e
1128 # This uses "mdl", the markdownlint application, which is written in ruby.
1129 # The source is at https://github.com/markdownlint/markdownlint
1130 # If you have ruby installed, "gem install mdl" should work.
1131 # Another option is at https://snapcraft.io/install/mdl/debian
1132 # Finally, there's a Node.js version, which we haven't tried, that
1133 # can be found at https://github.com/DavidAnson/markdownlint
1135 mdl -s util/markdownlint.rb .
1137 # Test coverage is a good idea for the future
1138 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1144 echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \
1145 -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) )
1147 .PHONY: check-format
1149 ( cd $(SRCDIR); $(PERL) util/check-format.pl \
1150 $(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) )
1153 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1154 < apps/openssl.cnf > apps/openssl-vms.cnf )
1157 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1159 generate_crypto_objects:
1160 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1161 crypto/objects/objects.txt \
1162 crypto/objects/obj_mac.num \
1163 > crypto/objects/obj_mac.new && \
1164 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1165 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1166 crypto/objects/objects.txt \
1167 crypto/objects/obj_mac.num \
1168 > include/openssl/obj_mac.h )
1169 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1170 include/openssl/obj_mac.h \
1171 > crypto/objects/obj_dat.h )
1172 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1173 crypto/objects/obj_mac.num \
1174 crypto/objects/obj_xref.txt \
1175 > crypto/objects/obj_xref.h )
1176 ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1178 generate_crypto_conf:
1179 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1180 > crypto/conf/conf_def.h )
1182 generate_crypto_asn1:
1183 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1184 > crypto/asn1/charmap.h )
1187 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1188 crypto/objects/obj_dat.h \
1191 generate_doc_buildinfo:
1192 ( $(PERL) -I$(BLDDIR) -Mconfigdata \
1193 $(SRCDIR)/util/dofile.pl -o Makefile \
1194 $(SRCDIR)/doc/build.info.in \
1195 > $(SRCDIR)/doc/build.info.new; \
1196 if ( test -e $(SRCDIR)/doc/build.info \
1197 && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
1200 rm $(SRCDIR)/doc/build.info.new; \
1202 mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
1205 generate_fips_sources: providers/fips.module.sources.new
1206 providers/fips.module.sources.new: configdata.pm
1210 srcdir=`cd $(SRCDIR); pwd`; \
1212 && $$srcdir/Configure --banner=Configured enable-fips -O0 \
1213 && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \
1214 && $(MAKE) -sj 4 build_generated providers/fips.so \
1215 && find . -name '*.d' | xargs cat > dep1 \
1216 && $(MAKE) distclean \
1217 && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \
1218 && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \
1219 && $(MAKE) -sj 4 build_generated providers/fips.so \
1220 && find . -name '*.d' | xargs cat > dep2 \
1221 && cat sources1 sources2 \
1222 | grep -v ' : \\$$' | grep -v util/providers.num \
1223 | sed -e 's/^ *//' -e 's/ *\\$$//' \
1224 | sort | uniq > sources \
1226 | $(PERL) -p -e 's/\\\n//' \
1227 | sed -e 's/^.*: *//' -e 's/ */ /g' \
1228 | fgrep -f sources \
1230 | sort | uniq > deps.raw \
1232 | xargs ./configdata.pm --query 'get_sources(@ARGV)' \
1233 | $(PERL) -p -e 's/\\\n//' \
1234 | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \
1236 && cat deps.raw | sed -f deps.sed > deps \
1239 cat sources-tmp/sources sources-tmp/deps \
1240 | $(PERL) -p -e 's:^ *\Q../\E:: ;' \
1241 -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \
1242 -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \
1244 for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \
1245 crypto/aes/asm/*.pl crypto/aes/asm/*.S \
1246 crypto/ec/asm/*.pl \
1247 crypto/modes/asm/*.pl \
1248 crypto/sha/asm/*.pl \
1249 crypto/x86_64cpuid.pl; do \
1252 ) | sort | uniq > providers/fips.module.sources.new
1255 # Set to -force to force a rebuild
1258 ( b=`pwd`; set -e; cd $(SRCDIR); \
1259 $(PERL) util/ck_errf.pl -strict -internal; \
1260 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1261 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1262 for E in *.ec ; do \
1263 $(PERL) ../util/ck_errf.pl -strict \
1264 -conf $$E `basename $$E .ec`.c; \
1265 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1266 -conf $$E `basename $$E .ec`.c ; \
1269 {- use File::Basename;
1271 my @sslheaders_tmpl =
1272 qw( include/openssl/ssl.h
1273 include/openssl/ssl2.h
1274 include/openssl/ssl3.h
1275 include/openssl/sslerr.h
1276 include/openssl/tls1.h
1277 include/openssl/dtls1.h
1278 include/openssl/srtp.h
1279 include/openssl/quic.h
1280 include/openssl/sslerr_legacy.h );
1281 my @cryptoheaders_tmpl =
1282 qw( include/internal/dso.h
1283 include/internal/o_dir.h
1284 include/internal/err.h
1285 include/internal/evp.h
1286 include/internal/pem.h
1287 include/internal/asn1.h
1288 include/internal/sslconf.h );
1289 my @cryptoskipheaders = ( @sslheaders_tmpl,
1290 qw( include/openssl/asn1_mac.h
1291 include/openssl/conf_api.h
1292 include/openssl/ebcdic.h
1293 include/openssl/opensslconf.h
1294 include/openssl/symhacks.h ) );
1295 our %cryptoheaders = ();
1296 our %sslheaders = ();
1297 foreach my $d ( qw( include/openssl include/internal ) ) {
1298 my @header_patterns =
1299 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1300 foreach my $f ( map { glob($_) } @header_patterns ) {
1301 my $base = basename($f);
1302 my $base_in = basename($f, '.in');
1303 my $dir = catfile($config{sourcedir}, $d);
1304 if ($base ne $base_in) {
1305 # We have a .h.in file, which means the header file is in the
1308 $dir = catfile($config{builddir}, $d);
1310 my $new_f = catfile($dir, $base);
1311 my $fn = "$d/$base";
1312 # The logic to add files to @cryptoheaders is a bit complex. The
1313 # file to be added must be either in the public header directory
1314 # or one of the pre-declared internal headers, and must under no
1315 # circumstances be one of those that must be skipped.
1316 $cryptoheaders{$new_f} = 1
1317 if (($d eq 'include/openssl'
1318 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1319 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1320 # The logic to add files to @sslheaders is much simpler...
1321 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1327 sub uniq { my %seen; grep !$seen{$_}++, @_; }
1328 sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; }
1329 join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5,
1330 uniq(grep /\.(c|cc|cpp)$/,
1331 flat (map { $unified_info{sources}->{$_} }
1332 (sort keys %{$unified_info{sources}})))))
1334 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1335 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1336 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1337 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1339 renumber: build_generated
1340 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1341 --ordinals $(SRCDIR)/util/libcrypto.num \
1342 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1345 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1346 --ordinals $(SRCDIR)/util/libssl.num \
1347 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1351 $(SRCDIR)/util/libcrypto.num: $(CRYPTOHEADERS) $(SRCDIR)/include/openssl/symhacks.h
1352 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1353 --ordinals $(SRCDIR)/util/libcrypto.num \
1354 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1356 $(SRCDIR)/util/libssl.num: $(SSLHEADERS) $(SRCDIR)/include/openssl/symhacks.h
1357 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
1358 --ordinals $(SRCDIR)/util/libssl.num \
1359 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1362 ordinals: build_generated $(SRCDIR)/util/libcrypto.num $(SRCDIR)/util/libssl.num
1365 $(MAKE) run_tests TESTS=test_ordinals
1370 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1372 providers/fips.checksum.new: providers/fips.module.sources.new
1373 @which unifdef > /dev/null || \
1374 ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \
1376 ( sources=`pwd`/providers/fips.module.sources.new; \
1379 | xargs ./util/fips-checksums.sh ) \
1380 > providers/fips-sources.checksums.new \
1381 && sha256sum providers/fips-sources.checksums.new \
1382 | sed -e 's|\.new||' > providers/fips.checksum.new
1384 fips-checksums: providers/fips.checksum.new
1386 $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new
1387 cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources
1388 cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums
1389 cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum
1391 update-fips-checksums: $(SRCDIR)/providers/fips.checksum
1393 diff-fips-checksums: fips-checksums
1394 diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new
1395 diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new
1396 diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new
1398 # Release targets (note: only available on Unix) #####################
1401 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1403 # Helper targets #####################################################
1405 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf
1407 $(BLDDIR)/util/opensslwrap.sh: Makefile
1408 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1409 mkdir -p "$(BLDDIR)/util"; \
1410 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1413 $(BLDDIR)/apps/openssl.cnf: Makefile
1414 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1415 mkdir -p "$(BLDDIR)/apps"; \
1416 ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
1421 # Building targets ###################################################
1423 libcrypto.pc libssl.pc openssl.pc: Makefile $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
1426 @ ( echo 'prefix=$(INSTALLTOP)'; \
1427 echo 'exec_prefix=$${prefix}'; \
1428 if [ -n "$(LIBDIR)" ]; then \
1429 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1431 echo 'libdir=$(libdir)'; \
1433 echo 'includedir=$${prefix}/include'; \
1434 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
1435 echo 'modulesdir=$${libdir}/ossl-modules'; \
1437 echo 'Name: OpenSSL-libcrypto'; \
1438 echo 'Description: OpenSSL cryptography library'; \
1439 echo 'Version: '$(VERSION); \
1440 echo 'Libs: -L$${libdir} -lcrypto'; \
1441 echo 'Libs.private: $(LIB_EX_LIBS)'; \
1442 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
1445 @ ( echo 'prefix=$(INSTALLTOP)'; \
1446 echo 'exec_prefix=$${prefix}'; \
1447 if [ -n "$(LIBDIR)" ]; then \
1448 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1450 echo 'libdir=$(libdir)'; \
1452 echo 'includedir=$${prefix}/include'; \
1454 echo 'Name: OpenSSL-libssl'; \
1455 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
1456 echo 'Version: '$(VERSION); \
1457 echo 'Requires.private: libcrypto'; \
1458 echo 'Libs: -L$${libdir} -lssl'; \
1459 echo 'Cflags: -I$${includedir}' ) > libssl.pc
1462 @ ( echo 'prefix=$(INSTALLTOP)'; \
1463 echo 'exec_prefix=$${prefix}'; \
1464 if [ -n "$(LIBDIR)" ]; then \
1465 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1467 echo 'libdir=$(libdir)'; \
1469 echo 'includedir=$${prefix}/include'; \
1471 echo 'Name: OpenSSL'; \
1472 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
1473 echo 'Version: '$(VERSION); \
1474 echo 'Requires: libssl libcrypto' ) > openssl.pc
1476 Makefile: configdata.pm \
1477 {- join(" \\\n" . ' ' x 10,
1478 fill_lines(" ", $COLUMNS - 10,
1479 @{$config{build_file_templates}})) -}
1480 @echo "Detected changed: $?"
1481 $(PERL) configdata.pm
1482 @echo "**************************************************"
1484 @echo "*** Please run the same make command again ***"
1486 @echo "**************************************************"
1489 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1490 {- join(" \\\n" . ' ' x 15,
1491 fill_lines(" ", $COLUMNS - 15,
1492 @{$config{build_infos}},
1493 @{$config{conf_files}})) -}
1494 @echo "Detected changed: $?"
1495 $(PERL) configdata.pm -r
1496 @echo "**************************************************"
1498 @echo "*** Please run the same make command again ***"
1500 @echo "**************************************************"
1504 $(PERL) configdata.pm -r
1508 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1510 # Helper function to convert dependencies in platform agnostic form to
1511 # dependencies in platform form.
1512 sub compute_platform_depends {
1515 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
1516 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
1517 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
1518 or platform->convertext($x); } @_;
1521 # Helper function to figure out dependencies on libraries
1522 # It takes a list of library names and outputs a list of dependencies
1523 sub compute_lib_depends {
1524 # Depending on shared libraries:
1525 # On Windows POSIX layers, we depend on {libname}.dll.a
1526 # On Unix platforms, we depend on {shlibname}.so
1527 return map { platform->sharedlib_simple($_)
1528 // platform->sharedlib_import($_)
1529 // platform->sharedlib($_)
1530 // platform->staticlib($_)
1534 sub generatetarget {
1536 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
1538 $args{target}: $deps
1544 my $gen0 = $args{generator}->[0];
1545 my $gen_args = join('', map { " $_" }
1546 @{$args{generator}}[1..$#{$args{generator}}]);
1547 my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1548 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1549 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1550 my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}},
1553 if ($args{src} =~ /\.html$/) {
1557 my $title = basename($args{src}, ".html");
1561 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1563 } elsif ($args{src} =~ /\.(\d)$/) {
1565 # Man-page generator
1568 my $name = uc basename($args{src}, ".$section");
1572 pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
1573 --release=\$(VERSION) $pod >\$\@
1575 } elsif (platform->isdef($args{src})) {
1577 # Linker script-ish generator
1579 my $target = platform->def($args{src});
1580 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1581 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
1582 my $ord_name = $args{generator}->[1] || $args{product};
1584 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
1585 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
1587 } elsif (platform->isasm($args{src})
1588 || platform->iscppasm($args{src})) {
1590 # Assembler generator
1593 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1594 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1595 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1596 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1597 } -> {$args{intent}};
1600 if ($gen0 =~ /\.pl$/) {
1601 $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
1602 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1603 } elsif ($gen0 =~ /\.m4$/) {
1604 $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
1605 } elsif ($gen0 =~ /\.S$/) {
1608 die "Generator type for $args{src} unknown: $gen0\n";
1611 if (defined($generator)) {
1613 $args{src}: $gen0 $deps
1618 $args{src}: $gen0 $deps
1619 \$(CC) $incs $cppflags $defs -E $gen0 | \\
1620 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1622 } elsif ($gen0 =~ m|^.*\.in$|) {
1624 # "dofile" generator (file.in -> file)
1626 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1627 "util", "dofile.pl")),
1628 rel2abs($config{builddir}));
1629 my @perlmodules = ( 'configdata.pm',
1630 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1631 my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
1632 $deps = join(' ', $deps, compute_platform_depends(@perlmodules));
1633 @perlmodules = map { "-M".basename($_, '.pm') } @perlmodules;
1634 my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
1636 $args{src}: $gen0 $deps
1637 \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
1639 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1641 # Generic generator using OpenSSL programs
1644 # Redo $gen0, to ensure that we have the proper extension where
1646 $gen0 = platform->bin($gen0);
1647 # Use $(PERL) to execute wrap.pl directly to avoid calling env
1649 $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
1650 \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
1654 # Generic generator using Perl
1657 $args{src}: $gen0 $deps
1658 \$(PERL)$gen_incs $gen0$gen_args > \$@
1663 # Should one wonder about the end of the Perl snippet, it's because this
1664 # second regexp eats up line endings as well, if the removed path is the
1665 # last in the line. We may therefore need to put back a line ending.
1668 my $obj = platform->convertext($args{obj});
1669 my $dep = platform->dep($args{obj});
1670 my @srcs = @{$args{srcs}};
1671 my $srcs = join(" ", @srcs);
1672 my $deps = join(" ", @srcs, @{$args{deps}});
1673 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1674 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1678 if (grep /\.rc$/, @srcs) {
1680 $cmdflags = '$(RCFLAGS)';
1682 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1684 $cmdcompile = ' -c';
1686 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1687 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1688 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1689 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1690 } -> {$args{intent}};
1693 $cmdcompile = ' -c';
1695 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1696 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1697 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1698 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1699 } -> {$args{intent}};
1702 # extension-specific rules
1703 if (grep /\.s$/, @srcs) {
1706 $cmd $cmdflags -c -o \$\@ $srcs
1708 } elsif (grep /\.S$/, @srcs) {
1709 # Originally there was multi-step rule with $(CC) -E file.S
1710 # followed by $(CC) -c file.s. It compensated for one of
1711 # legacy platform compiler's inability to handle .S files.
1712 # The platform is long discontinued by vendor so there is
1713 # hardly a point to drag it along...
1716 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1718 } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
1721 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1723 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1726 mv $dep.tmp $dep; \\
1732 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1734 if ($makedep_scheme eq 'makedepend') {
1736 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1743 # We *know* this routine is only called when we've configure 'shared'.
1748 foreach (@{$args{deps}}) {
1749 if (platform->isstaticlib($_)) {
1750 push @linklibs, platform->convertext($_);
1752 my $d = "-L" . dirname($_);
1753 my $l = basename($_);
1757 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1760 my $linkflags = join("", map { $_." " } @linkdirs);
1761 my $linklibs = join("", map { $_." " } @linklibs);
1762 my @objs = map { platform->convertext($_) }
1763 grep { !platform->isdef($_) }
1765 my @defs = map { platform->def($_) }
1766 grep { platform->isdef($_) }
1768 my @deps = compute_lib_depends(@{$args{deps}});
1769 die "More than one exported symbol map" if scalar @defs > 1;
1771 my $full = platform->sharedlib($args{lib});
1772 # $import is for Windows and subsystems thereof, where static import
1773 # libraries for DLLs are a thing. On platforms that have this mechanism,
1774 # $import has the name of this import library. On platforms that don't
1775 # have this mechanism, $import will be |undef|.
1776 my $import = platform->sharedlib_import($args{lib});
1777 # $simple is for platforms where full shared library names include the
1778 # shared library version, and there's a simpler name that doesn't include
1779 # that version. On such platforms, $simple has the simpler name. On
1780 # other platforms, it will be |undef|.
1781 my $simple = platform->sharedlib_simple($args{lib});
1783 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1784 my $shared_soname = "";
1785 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1786 if defined $target{shared_sonameflag};
1787 my $shared_imp = "";
1788 $shared_imp .= ' '.$target{shared_impflag}.basename($import)
1789 if defined $target{shared_impflag} && defined $import;
1790 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1792 # There is at least one platform where the compiler-as-linker needs to
1793 # have one object file directly on the command line. That won't hurt
1794 # any other platform, so we do that for everyone when there's an argfile
1795 # to be had. This depends heavily on splice, which removes elements from
1796 # the given array, and returns them so they can be captured.
1797 my @argfileobjs = $argfile
1800 my $argfilecmds = $argfile
1801 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1803 my $argfiledeps = $argfile
1804 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1805 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1807 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1810 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1813 join(" \\\n" . ' ' x (length($full) + 2),
1814 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1816 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1820 if (defined $simple && $simple ne $full) {
1825 \$(AR) r $simple $full
1835 if (defined $import) {
1842 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1843 -o $full$shared_def \\
1845 $linklibs \$(LIB_EX_LIBS)
1854 if (!$disabled{tests}) {
1861 $recipe .= <<"EOF" if defined $argfile;
1862 $argfile: $argfiledeps
1870 my $dso = platform->dso($args{module});
1873 foreach (@{$args{deps}}) {
1874 next unless defined $_;
1875 if (platform->isstaticlib($_)) {
1876 push @linklibs, platform->convertext($_);
1878 my $d = "-L" . dirname($_);
1879 my $l = basename($_);
1883 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1886 my $linkflags = join("", map { $_." " } @linkdirs);
1887 my $linklibs = join("", map { $_." " } @linklibs);
1888 my @objs = map { platform->convertext($_) }
1889 grep { !platform->isdef($_) }
1891 my @defs = map { platform->def($_) }
1892 grep { platform->isdef($_) }
1894 my @deps = compute_lib_depends(@{$args{deps}});
1895 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1896 # Next line needs to become "less magic" (see PR #11950)
1897 $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/);
1898 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1899 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1900 fill_lines(' ', $COLUMNS - length($dso) - 2,
1901 @objs, @defs, @deps));
1905 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1906 -o $dso$shared_def \\
1908 $linklibs\$(DSO_EX_LIBS)
1913 my $lib = platform->staticlib($args{lib});
1914 my @objs = map { platform->obj($_) } @{$args{objs}};
1915 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1916 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1917 my $max_per_call = 500;
1919 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1921 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1926 \$(RANLIB) \$\@ || echo Never mind.
1931 my $bin = platform->bin($args{bin});
1932 my @objs = map { platform->obj($_) } @{$args{objs}};
1933 my @deps = compute_lib_depends(@{$args{deps}});
1934 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1935 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1938 foreach (@{$args{deps}}) {
1939 next unless defined $_;
1940 if (platform->isstaticlib($_)) {
1941 push @linklibs, platform->convertext($_);
1943 my $d = "-L" . dirname($_);
1944 my $l = basename($_);
1948 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1951 my $linkflags = join("", map { $_." " } @linkdirs);
1952 my $linklibs = join("", map { $_." " } @linklibs);
1954 my $cmdflags = '$(BIN_CFLAGS)';
1955 if (grep /_cc\.o$/, @{$args{objs}}) {
1957 $cmdflags = '$(BIN_CXXFLAGS)';
1960 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1961 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1962 fill_lines(' ', $COLUMNS - length($bin) - 2,
1968 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1971 $linklibs\$(BIN_EX_LIBS)
1976 my $script = $args{script};
1977 my $sources = join(" ", @{$args{sources}});
1978 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1979 "util", "dofile.pl")),
1980 rel2abs($config{builddir}));
1982 $script: $sources configdata.pm
1984 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1985 "-o$target{build_file}" $sources > "$script"
1991 my $dir = $args{dir};
1992 my @deps = compute_platform_depends(@{$args{deps}});
1995 # We already have a 'test' target, and the top directory is just plain
1997 return if $dir eq "test" || $dir eq ".";
1999 foreach my $type (("dso", "lib", "bin", "script")) {
2000 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
2001 # For lib object files, we could update the library. However, it
2002 # was decided that it's enough to build the directory local object
2003 # files, so we don't need to add any actions, and the dependencies
2004 # are already taken care of.
2005 if ($type ne "lib") {
2006 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
2007 if (dirname($prod) eq $dir) {
2008 push @deps, compute_platform_depends($prod);
2010 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
2016 my $target = "$dir $dir/";
2017 my $deps = join(" \\\n\t",
2018 fill_lines(' ', $COLUMNS - 8, @deps));
2019 my $comments = join("\n", "", @comments);
2025 "" # Important! This becomes part of the template result.