2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 our $makedep_scheme = $config{makedep_scheme};
7 our $makedepcmd = platform->makedepcmd();
9 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
11 # Shared AIX support is special. We put libcrypto[64].so.ver into
12 # libcrypto.a and use libcrypto_a.a as static one.
13 sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
15 our $sover_dirname = platform->shlib_version_as_filename();
17 # This makes sure things get built in the order they need
22 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
25 our $COLUMNS = $ENV{COLUMNS};
26 if ($COLUMNS =~ /^\d+$/) {
27 $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
33 my $item_sep = shift; # string
34 my $line_length = shift; # number of chars
40 my $fill_line = $result[$resultpos] // '';
42 ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
44 if (length($newline) > $line_length) {
45 # If this is a single item and the intended result line
46 # is empty, we put it there anyway
47 if ($fill_line eq '') {
48 $result[$resultpos++] = $newline;
50 $result[++$resultpos] = $_;
53 $result[$resultpos] = $newline;
60 PLATFORM={- $config{target} -}
61 OPTIONS={- $config{options} -}
62 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
63 SRCDIR={- $config{sourcedir} -}
64 BLDDIR={- $config{builddir} -}
65 FIPSKEY={- $config{FIPSKEY} -}
67 VERSION={- "$config{full_version}" -}
68 MAJOR={- $config{major} -}
69 MINOR={- $config{minor} -}
70 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
71 SHLIB_TARGET={- $target{shared_target} -}
73 LIBS={- join(" \\\n" . ' ' x 5,
74 fill_lines(" ", $COLUMNS - 5,
75 map { platform->staticlib($_) // () }
76 @{$unified_info{libraries}})) -}
77 SHLIBS={- join(" \\\n" . ' ' x 7,
78 fill_lines(" ", $COLUMNS - 7,
79 map { platform->sharedlib($_) // () }
80 @{$unified_info{libraries}})) -}
81 SHLIB_INFO={- join(" \\\n" . ' ' x 11,
82 fill_lines(" ", $COLUMNS - 11,
83 map { my $x = platform->sharedlib($_);
84 my $y = platform->sharedlib_simple($_) // '';
85 my $z = platform->sharedlib_import($_) // '';
86 $x ? "\"$x;$y;$z\"" : () }
87 @{$unified_info{libraries}})) -}
88 MODULES={- join(" \\\n" . ' ' x 8,
89 fill_lines(" ", $COLUMNS - 8,
90 map { platform->dso($_) }
91 @{$unified_info{modules}})) -}
92 FIPSMODULENAME={- # We do some extra checking here, as there should be only one
95 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
96 && $unified_info{attributes}->{modules}->{$_}->{fips} }
97 @{$unified_info{modules}};
98 die "More that one FIPS module" if scalar @fipsmodules > 1;
99 join(" ", map { basename(platform->dso($_)) } @fipsmodules) -}
101 PROGRAMS={- join(" \\\n" . ' ' x 9,
102 fill_lines(" ", $COLUMNS - 9,
103 map { platform->bin($_) }
104 @{$unified_info{programs}})) -}
105 SCRIPTS={- join(" \\\n" . ' ' x 8,
106 fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
107 {- output_off() if $disabled{makedepend}; "" -}
108 DEPS={- join(" \\\n" . ' ' x 5,
109 fill_lines(" ", $COLUMNS - 5,
110 map { platform->isobj($_) ? platform->dep($_) : () }
111 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
112 keys %{$unified_info{sources}})); -}
113 {- output_on() if $disabled{makedepend}; "" -}
114 GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
115 fill_lines(" ", $COLUMNS - 20,
116 @{$unified_info{depends}->{""}})) -}
117 GENERATED_PODS={- # common0.tmpl provides @generated
118 join(" \\\n" . ' ' x 15,
119 fill_lines(" ", $COLUMNS - 15,
123 $unified_info{attributes}->{depends}
124 ->{$x}->{$_}->{pod} // 0
126 keys %{$unified_info{attributes}->{depends}->{$x}}
130 GENERATED={- # common0.tmpl provides @generated
131 join(" \\\n" . ' ' x 5,
132 fill_lines(" ", $COLUMNS - 5,
133 map { platform->convertext($_) } @generated )) -}
136 join(" \\\n" . ' ' x 13,
137 fill_lines(" ", $COLUMNS - 13,
138 map { platform->staticlib($_) // () }
139 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
140 @{$unified_info{libraries}}))
143 join(" \\\n" . ' ' x 15,
144 fill_lines(" ", $COLUMNS - 15,
145 map { platform->sharedlib($_) // () }
146 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
147 @{$unified_info{libraries}}))
149 INSTALL_SHLIB_INFO={-
150 join(" \\\n" . ' ' x 19,
151 fill_lines(" ", $COLUMNS - 19,
152 map { my $x = platform->sharedlib($_);
153 my $y = platform->sharedlib_simple($_) // '';
154 my $z = platform->sharedlib_import($_) // '';
155 $x ? "\"$x;$y;$z\"" : () }
156 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
157 @{$unified_info{libraries}}))
160 join(" \\\n" . ' ' x 16,
161 fill_lines(" ", $COLUMNS - 16,
162 map { platform->dso($_) }
163 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
164 && $unified_info{attributes}->{modules}->{$_}->{engine} }
165 @{$unified_info{modules}}))
168 join(" \\\n" . ' ' x 16,
169 fill_lines(" ", $COLUMNS - 16,
170 map { platform->dso($_) }
171 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
172 && !$unified_info{attributes}->{modules}->{$_}->{engine} }
173 @{$unified_info{modules}}))
176 join(" \\\n" . ' ' x 16,
177 fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
178 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
179 @{$unified_info{programs}}))
182 join(" \\\n" . ' ' x 12,
183 fill_lines(" ", $COLUMNS - 12,
184 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
186 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
187 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
188 @{$unified_info{scripts}}))
191 join(" \\\n" . ' ' x 13,
192 fill_lines(" ", $COLUMNS - 13,
193 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
195 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
196 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
197 @{$unified_info{scripts}}))
200 join(" \\\n" . ' ' x 10,
201 fill_lines(" ", $COLUMNS - 10,
202 @{$unified_info{htmldocs}->{man1}})) -}
204 join(" \\\n" . ' ' x 10,
205 fill_lines(" ", $COLUMNS - 10,
206 @{$unified_info{htmldocs}->{man3}})) -}
208 join(" \\\n" . ' ' x 10,
209 fill_lines(" ", $COLUMNS - 10,
210 @{$unified_info{htmldocs}->{man5}})) -}
212 join(" \\\n" . ' ' x 10,
213 fill_lines(" ", $COLUMNS - 10,
214 @{$unified_info{htmldocs}->{man7}})) -}
216 join(" \\\n" . ' ' x 9,
217 fill_lines(" ", $COLUMNS - 9,
218 @{$unified_info{mandocs}->{man1}})) -}
220 join(" \\\n" . ' ' x 9,
221 fill_lines(" ", $COLUMNS - 9,
222 @{$unified_info{mandocs}->{man3}})) -}
224 join(" \\\n" . ' ' x 9,
225 fill_lines(" ", $COLUMNS - 9,
226 @{$unified_info{mandocs}->{man5}})) -}
228 join(" \\\n" . ' ' x 9,
229 fill_lines(" ", $COLUMNS - 9,
230 @{$unified_info{mandocs}->{man7}})) -}
232 APPS_OPENSSL="{- use File::Spec::Functions;
233 catfile("apps","openssl") -}"
235 # DESTDIR is for package builders so that they can configure for, say,
236 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
237 # Normally it is left empty.
240 # Do not edit these manually. Use Configure with --prefix or --openssldir
241 # to change this! Short explanation in the top comment in Configure
242 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
244 our $prefix = $config{prefix} || "/usr/local";
247 # The logic here is that if no --openssldir was given,
248 # OPENSSLDIR will get the value from $prefix plus "/ssl".
249 # If --openssldir was given and the value is an absolute
250 # path, OPENSSLDIR will get its value without change.
251 # If the value from --openssldir is a relative path,
252 # OPENSSLDIR will get $prefix with the --openssldir
253 # value appended as a subdirectory.
255 use File::Spec::Functions;
257 $config{openssldir} ?
258 (file_name_is_absolute($config{openssldir}) ?
260 : catdir($prefix, $config{openssldir}))
261 : catdir($prefix, "ssl");
263 LIBDIR={- our $libdir = $config{libdir};
266 # if $prefix/lib$target{multilib} is not an existing
267 # directory, then assume that it's not searched by linker
268 # automatically, in which case adding $target{multilib} suffix
269 # causes more grief than we're ready to tolerate, so don't...
271 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
272 $libdir = "lib$multilib";
274 file_name_is_absolute($libdir) ? "" : $libdir -}
275 # $(libdir) is chosen to be compatible with the GNU coding standards
276 libdir={- file_name_is_absolute($libdir)
277 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
278 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
279 MODULESDIR=$(libdir)/ossl-modules
281 # Convenience variable for those who want to set the rpath in shared
282 # libraries and applications
285 MANDIR=$(INSTALLTOP)/share/man
286 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
287 HTMLDIR=$(DOCDIR)/html
289 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
290 # appended after the manpage file section number. "ssl" is popular,
291 # resulting in files such as config.5ssl rather than config.5.
295 # For "optional" echo messages, to get "real" silence
298 ##### User defined commands and flags ################################
300 # We let the C compiler driver to take care of .s files. This is done in
301 # order to be excused from maintaining a separate set of architecture
302 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
303 # gcc, then the driver will automatically translate it to -xarch=v8plus
304 # and pass it down to assembler. In any case, we do not define AS or
305 # ASFLAGS for this reason.
307 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
308 CC=$(CROSS_COMPILE){- $config{CC} -}
309 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
310 CPPFLAGS={- our $cppflags1 = join(" ",
311 (map { "-D".$_} @{$config{CPPDEFINES}}),
312 (map { "-I".$_} @{$config{CPPINCLUDES}}),
313 @{$config{CPPFLAGS}}) -}
314 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
315 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
316 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
317 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
319 MAKEDEPEND={- $config{makedepcmd} -}
321 PERL={- $config{PERL} -}
323 AR=$(CROSS_COMPILE){- $config{AR} -}
324 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
325 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
326 RC= $(CROSS_COMPILE){- $config{RC} -}
327 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
331 TAR= {- $target{TAR} || "tar" -}
332 TARFLAGS= {- $target{TARFLAGS} -}
335 NAME= $(BASENAME)-$(VERSION)
336 # Relative to $(SRCDIR)
337 TARFILE= ../$(NAME).tar
339 ##### Project flags ##################################################
341 # Variables starting with CNF_ are common variables for all product types
343 CNF_CPPFLAGS={- our $cppflags2 =
344 join(' ', $target{cppflags} || (),
345 (map { "-D".$_} @{$target{defines}},
346 @{$config{defines}}),
347 (map { "-I".$_} @{$target{includes}},
348 @{$config{includes}}),
349 @{$config{cppflags}}) -}
350 CNF_CFLAGS={- join(' ', $target{cflags} || (),
351 @{$config{cflags}}) -}
352 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
353 @{$config{cxxflags}}) -}
354 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
355 @{$config{lflags}}) -}
356 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
357 @{$config{ex_libs}}) -}
359 # Variables starting with LIB_ are used to build library object files
360 # and shared libraries.
361 # Variables starting with DSO_ are used to build DSOs and their object files.
362 # Variables starting with BIN_ are used to build programs and their object
365 LIB_CPPFLAGS={- our $lib_cppflags =
366 join(' ', $target{lib_cppflags} || (),
367 $target{shared_cppflag} || (),
369 @{$target{lib_defines} || ()},
370 @{$target{shared_defines} || ()},
371 @{$config{lib_defines} || ()},
372 @{$config{shared_defines} || ()}),
373 (map { '-I'.quotify1($_) }
374 @{$target{lib_includes}},
375 @{$target{shared_includes}},
376 @{$config{lib_includes}},
377 @{$config{shared_includes}}),
378 @{$config{lib_cppflags}},
379 @{$config{shared_cppflag}});
380 join(' ', $lib_cppflags,
382 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
383 'ENGINESDIR="\"$(ENGINESDIR)\""',
384 'MODULESDIR="\"$(MODULESDIR)\""'),
385 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
386 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
387 $target{shared_cflag} || (),
388 @{$config{lib_cflags}},
389 @{$config{shared_cflag}},
390 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
391 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
392 $target{shared_cxxflag} || (),
393 @{$config{lib_cxxflags}},
394 @{$config{shared_cxxflag}},
395 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
396 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
397 $config{shared_ldflag} || (),
398 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
399 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
400 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
401 $target{module_cppflags} || (),
403 @{$target{dso_defines}},
404 @{$target{module_defines}},
405 @{$config{dso_defines} || ()},
406 @{$config{module_defines} || ()}),
407 (map { '-I'.quotify1($_) }
408 @{$target{dso_includes}},
409 @{$target{module_includes}},
410 @{$config{dso_includes}},
411 @{$config{module_includes}}),
412 @{$config{dso_cppflags}},
413 @{$config{module_cppflags}},
414 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
415 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
416 $target{module_cflags} || (),
417 @{$config{dso_cflags}},
418 @{$config{module_cflags}},
419 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
420 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
421 $target{module_cxxflags} || (),
422 @{$config{dso_cxxflags}},
423 @{$config{module_cxxflag}},
424 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
425 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
426 $target{module_ldflags} || (),
427 @{$config{dso_ldflags}},
428 @{$config{module_ldflags}},
429 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
430 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
431 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
432 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
433 @{$config{bin_cppflags}},
434 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
435 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
436 @{$config{bin_cflags}},
437 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
438 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
439 @{$config{bin_cxxflags}},
440 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
441 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
442 @{$config{bin_lflags}},
443 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
444 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
446 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
447 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
448 $cppflags2 =~ s|([\\"])|\\$1|g;
449 $lib_cppflags =~ s|([\\"])|\\$1|g;
450 join(' ', $lib_cppflags || (), $cppflags2 || (),
453 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
455 # For x86 assembler: Set PROCESSOR to 386 if you want to support
457 PROCESSOR= {- $config{processor} -}
459 # We want error [and other] messages in English. Trouble is that make(1)
460 # doesn't pass macros down as environment variables unless there already
461 # was corresponding variable originally set. In other words we can only
462 # reassign environment variables, but not set new ones, not in portable
463 # manner that is. That's why we reassign several, just to be sure...
468 # The main targets ###################################################
470 {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
471 {- dependmagic('build_libs'); -}: build_libs_nodep
472 {- dependmagic('build_modules'); -}: build_modules_nodep
473 {- dependmagic('build_programs'); -}: build_programs_nodep
475 build_generated_pods: $(GENERATED_PODS)
476 build_docs: build_man_docs build_html_docs
477 build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
478 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
480 build_generated: $(GENERATED_MANDATORY)
481 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
482 build_modules_nodep: $(MODULES)
483 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
485 # Kept around for backward compatibility
486 build_apps build_tests: build_programs
488 # Convenience target to prebuild all generated files, not just the mandatory
490 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
491 @ : {- output_off() if $disabled{makedepend}; "" -}
492 @echo "Warning: consider configuring with no-makedepend, because if"
493 @echo " target system doesn't have $(PERL),"
494 @echo " then make will fail..."
495 @ : {- output_on() if $disabled{makedepend}; "" -}
497 all: build_sw build_docs
500 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
501 @ : {- output_off() if $disabled{tests}; "" -}
505 FIPSKEY="$(FIPSKEY)" \
506 EXE_EXT={- platform->binext() -} \
507 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
508 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
509 @echo "Tests are not supported with your chosen Configure options"
510 @ : {- output_on() if !$disabled{tests}; "" -}
513 @ : {- output_off() if $disabled{tests}; "" -}
514 @SRCTOP="$(SRCDIR)" \
515 $(PERL) $(SRCDIR)/test/run_tests.pl list
516 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
517 @echo "Tests are not supported with your chosen Configure options"
518 @ : {- output_on() if !$disabled{tests}; "" -}
520 install: install_sw install_ssldirs install_docs
522 uninstall: uninstall_docs uninstall_sw
525 @set -e; for s in $(SHLIB_INFO); do \
526 if [ "$$s" = ";" ]; then continue; fi; \
527 s1=`echo "$$s" | cut -f1 -d";"`; \
528 s2=`echo "$$s" | cut -f2 -d";"`; \
529 s3=`echo "$$s" | cut -f3 -d";"`; \
530 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
533 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
535 if [ "$$s2" != "" ]; then \
536 $(ECHO) $(RM) $$s2; \
539 if [ "$$s3" != "" ]; then \
540 $(ECHO) $(RM) $$s3; \
545 $(RM) *{- platform->defext() -}
556 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
557 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
558 -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
559 -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
561 $(RM) tags TAGS doc-nits cmd-nits md-nits
562 $(RM) -r test/test-runs
563 $(RM) openssl.pc libcrypto.pc libssl.pc
564 -find . -type l \! -name '.*' -exec $(RM) {} \;
570 # We check if any depfile is newer than Makefile and decide to
571 # concatenate only if that is true.
573 @: {- output_off() if $disabled{makedepend}; "" -}
574 @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}"
575 @: {- output_on() if $disabled{makedepend}; "" -}
577 # Install helper targets #############################################
579 install_sw: install_dev install_engines install_modules install_runtime
581 uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
583 install_docs: install_man_docs install_html_docs
585 uninstall_docs: uninstall_man_docs uninstall_html_docs
586 $(RM) -r $(DESTDIR)$(DOCDIR)
588 install_fips: install_sw
589 @$(ECHO) "*** Installing FIPS module configuration"
590 @$(ECHO) "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
591 @openssl fipsinstall -module $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME) \
592 -out $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf \
593 -macopt 'hexkey:$(FIPSKEY)'
595 uninstall_fips: uninstall_sw
596 @$(ECHO) "*** Uninstalling FIPS module configuration"
597 @$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
598 @$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf
601 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
602 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
603 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
604 @set -e; for x in dummy $(MISC_SCRIPTS); do \
605 if [ "$$x" = "dummy" ]; then continue; fi; \
606 x1=`echo "$$x" | cut -f1 -d:`; \
607 x2=`echo "$$x" | cut -f2 -d:`; \
608 fn=`basename $$x1`; \
609 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
610 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
611 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
612 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
613 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
614 if [ "$$x1" != "$$x2" ]; then \
615 ln=`basename "$$x2"`; \
616 : {- output_off() unless windowsdll(); "" -}; \
617 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
618 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
619 : {- output_on() unless windowsdll();
620 output_off() if windowsdll(); "" -}; \
621 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
622 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
623 : {- output_on() if windowsdll(); "" -}; \
626 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
627 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
628 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
629 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
630 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
631 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
632 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
633 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
635 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
636 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
637 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
638 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
639 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
640 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
641 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
642 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
645 install_dev: install_runtime_libs
646 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
647 @$(ECHO) "*** Installing development files"
648 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
649 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
650 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
651 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
652 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
653 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
654 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
655 $(BLDDIR)/include/openssl/*.h; do \
657 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
658 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
659 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
661 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
662 @set -e; for l in $(INSTALL_LIBS); do \
664 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
665 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
666 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
667 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
668 mv -f $(DESTDIR)$(libdir)/$$fn.new \
669 $(DESTDIR)$(libdir)/$$fn; \
671 @ : {- output_off() if $disabled{shared}; "" -}
672 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
673 s1=`echo "$$s" | cut -f1 -d";"`; \
674 s2=`echo "$$s" | cut -f2 -d";"`; \
675 s3=`echo "$$s" | cut -f3 -d";"`; \
676 fn1=`basename "$$s1"`; \
677 fn2=`basename "$$s2"`; \
678 fn3=`basename "$$s3"`; \
679 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
680 if [ "$$fn2" != "" ]; then \
681 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
682 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
684 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
685 if [ "$$fn3" != "" ]; then \
686 $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
687 cp $$s3 $(DESTDIR)$(libdir)/$$fn3.new; \
688 chmod 755 $(DESTDIR)$(libdir)/$$fn3.new; \
689 mv -f $(DESTDIR)$(libdir)/$$fn3.new \
690 $(DESTDIR)$(libdir)/$$fn3; \
692 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
693 a=$(DESTDIR)$(libdir)/$$fn2; \
694 $(ECHO) "install $$s1 -> $$a"; \
695 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
696 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
698 for so in `$(AR) t $$a`; do \
701 strip -X32_64 -e $$so; \
702 $(AR) r $$a.new $$so; \
705 $(AR) r $$a.new $$s1; \
707 : {- output_off() if sharedaix(); output_on(); "" -}; \
709 @ : {- output_on() if $disabled{shared}; "" -}
710 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
711 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
712 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
713 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
714 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
715 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
716 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
717 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
718 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
719 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
721 uninstall_dev: uninstall_runtime_libs
722 @$(ECHO) "*** Uninstalling development files"
723 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
724 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
725 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
726 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
727 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
728 $(BLDDIR)/include/openssl/*.h; do \
730 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
731 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
733 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
734 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
735 @set -e; for l in $(INSTALL_LIBS); do \
737 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
738 $(RM) $(DESTDIR)$(libdir)/$$fn; \
740 @ : {- output_off() if $disabled{shared}; "" -}
741 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
742 s1=`echo "$$s" | cut -f1 -d";"`; \
743 s2=`echo "$$s" | cut -f2 -d";"`; \
744 s3=`echo "$$s" | cut -f3 -d";"`; \
745 fn1=`basename "$$s1"`; \
746 fn2=`basename "$$s2"`; \
747 fn3=`basename "$$s3"`; \
748 : {- output_off() if windowsdll(); "" -}; \
749 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
750 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
751 if [ -n "$$fn2" ]; then \
752 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
753 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
755 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
756 if [ -n "$$fn3" ]; then \
757 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
758 $(RM) $(DESTDIR)$(libdir)/$$fn3; \
760 : {- output_on() unless windowsdll(); "" -}; \
762 @ : {- output_on() if $disabled{shared}; "" -}
763 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
764 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
765 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
766 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
767 -$(RMDIR) $(DESTDIR)$(libdir)
769 _install_modules_deps: install_runtime_libs build_modules
771 install_engines: _install_modules_deps
772 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
773 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
774 @$(ECHO) "*** Installing engines"
775 @set -e; for e in dummy $(INSTALL_ENGINES); do \
776 if [ "$$e" = "dummy" ]; then continue; fi; \
778 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
779 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
780 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
781 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
782 $(DESTDIR)$(ENGINESDIR)/$$fn; \
786 @$(ECHO) "*** Uninstalling engines"
787 @set -e; for e in dummy $(INSTALL_ENGINES); do \
788 if [ "$$e" = "dummy" ]; then continue; fi; \
790 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
791 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
793 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
795 install_modules: _install_modules_deps
796 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
797 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
798 @$(ECHO) "*** Installing modules"
799 @set -e; for e in dummy $(INSTALL_MODULES); do \
800 if [ "$$e" = "dummy" ]; then continue; fi; \
802 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
803 cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \
804 chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \
805 mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \
806 $(DESTDIR)$(MODULESDIR)/$$fn; \
810 @$(ECHO) "*** Uninstalling modules"
811 @set -e; for e in dummy $(INSTALL_MODULES); do \
812 if [ "$$e" = "dummy" ]; then continue; fi; \
814 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
815 $(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \
817 -$(RMDIR) $(DESTDIR)$(MODULESDIR)
819 install_runtime: install_programs
821 install_runtime_libs: build_libs
822 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
823 @ : {- output_off() if windowsdll(); "" -}
824 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
825 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
826 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
827 @ : {- output_on() unless windowsdll(); "" -}
828 @$(ECHO) "*** Installing runtime libraries"
829 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
830 if [ "$$s" = "dummy" ]; then continue; fi; \
832 : {- output_off() unless windowsdll(); "" -}; \
833 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
834 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
835 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
836 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
837 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
838 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
839 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
840 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
841 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
842 mv -f $(DESTDIR)$(libdir)/$$fn.new \
843 $(DESTDIR)$(libdir)/$$fn; \
844 : {- output_on() if windowsdll(); "" -}; \
847 install_programs: install_runtime_libs build_programs
848 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
849 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
850 @$(ECHO) "*** Installing runtime programs"
851 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
852 if [ "$$x" = "dummy" ]; then continue; fi; \
854 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
855 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
856 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
857 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
858 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
860 @set -e; for x in dummy $(BIN_SCRIPTS); do \
861 if [ "$$x" = "dummy" ]; then continue; fi; \
863 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
864 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
865 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
866 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
867 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
870 uninstall_runtime: uninstall_programs uninstall_runtime_libs
873 @$(ECHO) "*** Uninstalling runtime programs"
874 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
876 if [ "$$x" = "dummy" ]; then continue; fi; \
878 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
879 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
881 @set -e; for x in dummy $(BIN_SCRIPTS); \
883 if [ "$$x" = "dummy" ]; then continue; fi; \
885 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
886 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
888 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
890 uninstall_runtime_libs:
891 @$(ECHO) "*** Uninstalling runtime libraries"
892 @ : {- output_off() unless windowsdll(); "" -}
893 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
894 if [ "$$s" = "dummy" ]; then continue; fi; \
896 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
897 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
899 @ : {- output_on() unless windowsdll(); "" -}
902 install_man_docs: build_man_docs
903 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
904 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
905 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
906 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
907 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
908 @$(ECHO) "*** Installing manpages"
909 @set -e; for x in dummy $(MANDOCS1); do \
910 if [ "$$x" = "dummy" ]; then continue; fi; \
912 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
913 cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
914 chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
916 @set -e; for x in dummy $(MANDOCS3); do \
917 if [ "$$x" = "dummy" ]; then continue; fi; \
919 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
920 cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
921 chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
923 @set -e; for x in dummy $(MANDOCS5); do \
924 if [ "$$x" = "dummy" ]; then continue; fi; \
926 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
927 cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
928 chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
930 @set -e; for x in dummy $(MANDOCS7); do \
931 if [ "$$x" = "dummy" ]; then continue; fi; \
933 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
934 cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
935 chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
939 @$(ECHO) "*** Uninstalling manpages"
940 @set -e; for x in dummy $(MANDOCS1); do \
941 if [ "$$x" = "dummy" ]; then continue; fi; \
943 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
944 $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
946 @set -e; for x in dummy $(MANDOCS3); do \
947 if [ "$$x" = "dummy" ]; then continue; fi; \
949 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
950 $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
952 @set -e; for x in dummy $(MANDOCS5); do \
953 if [ "$$x" = "dummy" ]; then continue; fi; \
955 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
956 $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
958 @set -e; for x in dummy $(MANDOCS7); do \
959 if [ "$$x" = "dummy" ]; then continue; fi; \
961 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
962 $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
965 install_html_docs: build_html_docs
966 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
967 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
968 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
969 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
970 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
971 @$(ECHO) "*** Installing HTML manpages"
972 @set -e; for x in dummy $(HTMLDOCS1); do \
973 if [ "$$x" = "dummy" ]; then continue; fi; \
975 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
976 cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
977 chmod 644 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
979 @set -e; for x in dummy $(HTMLDOCS3); do \
980 if [ "$$x" = "dummy" ]; then continue; fi; \
982 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
983 cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
984 chmod 644 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
986 @set -e; for x in dummy $(HTMLDOCS5); do \
987 if [ "$$x" = "dummy" ]; then continue; fi; \
989 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
990 cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
991 chmod 644 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
993 @set -e; for x in dummy $(HTMLDOCS7); do \
994 if [ "$$x" = "dummy" ]; then continue; fi; \
996 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
997 cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
998 chmod 644 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1001 uninstall_html_docs:
1002 @$(ECHO) "*** Uninstalling HTML manpages"
1003 @set -e; for x in dummy $(HTMLDOCS1); do \
1004 if [ "$$x" = "dummy" ]; then continue; fi; \
1005 fn=`basename $$x`; \
1006 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1007 $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
1009 @set -e; for x in dummy $(HTMLDOCS3); do \
1010 if [ "$$x" = "dummy" ]; then continue; fi; \
1011 fn=`basename $$x`; \
1012 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1013 $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
1015 @set -e; for x in dummy $(HTMLDOCS5); do \
1016 if [ "$$x" = "dummy" ]; then continue; fi; \
1017 fn=`basename $$x`; \
1018 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1019 $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
1021 @set -e; for x in dummy $(HTMLDOCS7); do \
1022 if [ "$$x" = "dummy" ]; then continue; fi; \
1023 fn=`basename $$x`; \
1024 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1025 $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1028 # Developer targets (note: these are only available on Unix) #########
1030 # It's important that generate_buildinfo comes after ordinals, as ordinals
1031 # is sensitive to build.info changes.
1032 update: generate errors ordinals generate_buildinfo
1034 generate: generate_apps generate_crypto_bn generate_crypto_objects \
1035 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1037 generate_buildinfo: generate_doc_buildinfo
1039 .PHONY: doc-nits cmd-nits md-nits
1040 doc-nits: build_generated_pods
1041 $(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e
1043 cmd-nits: build_generated apps/openssl build_generated_pods
1044 $(PERL) $(SRCDIR)/util/find-doc-nits -c
1046 # This uses "mdl", the markdownlint application, which is written in ruby.
1047 # The source is at https://github.com/markdownlint/markdownlint
1048 # If you have ruby installed, "gem install mdl" should work.
1049 # Another option is at https://snapcraft.io/install/mdl/debian
1050 # Finally, there's a Node.js version, which we haven't tried, that
1051 # can be found at https://github.com/DavidAnson/markdownlint
1053 mdl -s util/markdownlint.rb .
1055 # Test coverage is a good idea for the future
1056 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1060 lint -DLINT $(INCLUDES) $(SRCS)
1063 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1064 < apps/openssl.cnf > apps/openssl-vms.cnf )
1067 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1069 generate_crypto_objects:
1070 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1071 crypto/objects/objects.txt \
1072 crypto/objects/obj_mac.num \
1073 > crypto/objects/obj_mac.new && \
1074 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1075 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1076 crypto/objects/objects.txt \
1077 crypto/objects/obj_mac.num \
1078 > include/openssl/obj_mac.h )
1079 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1080 include/openssl/obj_mac.h \
1081 > crypto/objects/obj_dat.h )
1082 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1083 crypto/objects/obj_mac.num \
1084 crypto/objects/obj_xref.txt \
1085 > crypto/objects/obj_xref.h )
1086 ( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1088 generate_crypto_conf:
1089 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1090 > crypto/conf/conf_def.h )
1092 generate_crypto_asn1:
1093 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1094 > crypto/asn1/charmap.h )
1097 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1098 crypto/objects/obj_dat.h \
1101 generate_doc_buildinfo:
1102 ( $(PERL) -I$(BLDDIR) -Mconfigdata \
1103 $(SRCDIR)/util/dofile.pl -o Makefile \
1104 $(SRCDIR)/doc/build.info.in \
1105 > $(SRCDIR)/doc/build.info.new; \
1106 if ( test -e $(SRCDIR)/doc/build.info \
1107 && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
1110 rm $(SRCDIR)/doc/build.info.new; \
1112 mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
1115 # Set to -force to force a rebuild
1118 ( b=`pwd`; set -e; cd $(SRCDIR); \
1119 $(PERL) util/ck_errf.pl -strict -internal; \
1120 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1121 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1122 for E in *.ec ; do \
1123 $(PERL) ../util/ck_errf.pl -strict \
1124 -conf $$E `basename $$E .ec`.c; \
1125 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1126 -conf $$E `basename $$E .ec`.c ; \
1129 {- use File::Basename;
1131 my @sslheaders_tmpl =
1132 qw( include/openssl/ssl.h
1133 include/openssl/ssl2.h
1134 include/openssl/ssl3.h
1135 include/openssl/sslerr.h
1136 include/openssl/tls1.h
1137 include/openssl/dtls1.h
1138 include/openssl/srtp.h
1139 include/openssl/sslerr_legacy.h );
1140 my @cryptoheaders_tmpl =
1141 qw( include/internal/dso.h
1142 include/internal/o_dir.h
1143 include/internal/err.h
1144 include/internal/evp.h
1145 include/internal/pem.h
1146 include/internal/asn1.h
1147 include/internal/sslconf.h );
1148 my @cryptoskipheaders = ( @sslheaders_tmpl,
1149 qw( include/openssl/conf_api.h
1150 include/openssl/ebcdic.h
1151 include/openssl/opensslconf.h
1152 include/openssl/symhacks.h ) );
1153 our %cryptoheaders = ();
1154 our %sslheaders = ();
1155 foreach my $d ( qw( include/openssl include/internal ) ) {
1156 my @header_patterns =
1157 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1158 foreach my $f ( map { glob($_) } @header_patterns ) {
1159 my $base = basename($f);
1160 my $base_in = basename($f, '.in');
1161 my $dir = catfile($config{sourcedir}, $d);
1162 if ($base ne $base_in) {
1163 # We have a .h.in file, which means the header file is in the
1166 $dir = catfile($config{builddir}, $d);
1168 my $new_f = catfile($dir, $base);
1169 my $fn = "$d/$base";
1170 # The logic to add files to @cryptoheaders is a bit complex. The
1171 # file to be added must be either in the public header directory
1172 # or one of the pre-declared internal headers, and must under no
1173 # circumstances be one of those that must be skipped.
1174 $cryptoheaders{$new_f} = 1
1175 if (($d eq 'include/openssl'
1176 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1177 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1178 # The logic to add files to @sslheaders is much simpler...
1179 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1184 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1185 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1186 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1187 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1188 ordinals: build_generated
1189 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
1190 --ordinals $(SRCDIR)/util/libcrypto.num \
1191 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1193 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
1194 --ordinals $(SRCDIR)/util/libssl.num \
1195 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1200 SRCTOP=../$(SRCDIR) \
1201 BLDTOP=../$(BLDDIR) \
1202 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
1207 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1209 # Release targets (note: only available on Unix) #####################
1212 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1214 # Helper targets #####################################################
1216 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl \
1217 $(BLDDIR)/apps/openssl.cnf
1219 $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm
1220 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1221 mkdir -p "$(BLDDIR)/util"; \
1222 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1225 $(BLDDIR)/apps/openssl.cnf: configdata.pm
1226 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1227 mkdir -p "$(BLDDIR)/apps"; \
1228 ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
1233 # Building targets ###################################################
1235 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
1237 @ ( echo 'prefix=$(INSTALLTOP)'; \
1238 echo 'exec_prefix=$${prefix}'; \
1239 if [ -n "$(LIBDIR)" ]; then \
1240 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1242 echo 'libdir=$(libdir)'; \
1244 echo 'includedir=$${prefix}/include'; \
1245 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
1247 echo 'Name: OpenSSL-libcrypto'; \
1248 echo 'Description: OpenSSL cryptography library'; \
1249 echo 'Version: '$(VERSION); \
1250 echo 'Libs: -L$${libdir} -lcrypto'; \
1251 echo 'Libs.private: $(LIB_EX_LIBS)'; \
1252 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
1255 @ ( echo 'prefix=$(INSTALLTOP)'; \
1256 echo 'exec_prefix=$${prefix}'; \
1257 if [ -n "$(LIBDIR)" ]; then \
1258 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1260 echo 'libdir=$(libdir)'; \
1262 echo 'includedir=$${prefix}/include'; \
1264 echo 'Name: OpenSSL-libssl'; \
1265 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
1266 echo 'Version: '$(VERSION); \
1267 echo 'Requires.private: libcrypto'; \
1268 echo 'Libs: -L$${libdir} -lssl'; \
1269 echo 'Cflags: -I$${includedir}' ) > libssl.pc
1272 @ ( echo 'prefix=$(INSTALLTOP)'; \
1273 echo 'exec_prefix=$${prefix}'; \
1274 if [ -n "$(LIBDIR)" ]; then \
1275 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1277 echo 'libdir=$(libdir)'; \
1279 echo 'includedir=$${prefix}/include'; \
1281 echo 'Name: OpenSSL'; \
1282 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
1283 echo 'Version: '$(VERSION); \
1284 echo 'Requires: libssl libcrypto' ) > openssl.pc
1286 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1287 {- join(" \\\n" . ' ' x 15,
1288 fill_lines(" ", $COLUMNS - 15,
1289 @{$config{build_file_templates}},
1290 @{$config{build_infos}},
1291 @{$config{conf_files}})) -}
1292 @echo "Detected changed: $?"
1293 $(PERL) configdata.pm -r
1294 @echo "**************************************************"
1296 @echo "*** Please run the same make command again ***"
1298 @echo "**************************************************"
1302 $(PERL) configdata.pm -r
1306 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1308 # Helper function to figure out dependencies on libraries
1309 # It takes a list of library names and outputs a list of dependencies
1310 sub compute_lib_depends {
1311 # Depending on shared libraries:
1312 # On Windows POSIX layers, we depend on {libname}.dll.a
1313 # On Unix platforms, we depend on {shlibname}.so
1314 return map { platform->sharedlib_simple($_)
1315 // platform->sharedlib_import($_)
1316 // platform->staticlib($_)
1320 sub generatetarget {
1322 my $deps = join(" ", @{$args{deps}});
1324 $args{target}: $deps
1330 my $gen0 = $args{generator}->[0];
1331 my $gen_args = join('', map { " $_" }
1332 @{$args{generator}}[1..$#{$args{generator}}]);
1333 my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1334 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1335 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1336 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
1338 if ($args{src} =~ /\.html$/) {
1342 my $title = basename($args{src}, ".html");
1346 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1348 } elsif ($args{src} =~ /\.(\d)$/) {
1350 # Man-page generator
1353 my $name = uc basename($args{src}, ".$section");
1357 pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
1358 --release=\$(VERSION) $pod >\$\@
1360 } elsif (platform->isdef($args{src})) {
1362 # Linker script-ish generator
1364 my $target = platform->def($args{src});
1365 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1366 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
1367 my $ord_name = $args{generator}->[1] || $args{product};
1369 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
1370 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
1372 } elsif (platform->isasm($args{src})) {
1374 # Assembler generator
1377 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1378 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1379 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1380 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1381 } -> {$args{intent}};
1384 if ($gen0 =~ /\.pl$/) {
1385 $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
1386 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1387 } elsif ($gen0 =~ /\.m4$/) {
1388 $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
1389 } elsif ($gen0 =~ /\.S$/) {
1392 die "Generator type for $args{src} unknown: $gen0\n";
1395 if (defined($generator)) {
1397 $args{src}: $gen0 $deps
1402 $args{src}: $gen0 $deps
1403 \$(CC) $incs $cppflags $defs -E $gen0 | \\
1404 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1406 } elsif ($gen0 =~ m|^.*\.in$|) {
1408 # "dofile" generator (file.in -> file)
1410 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1411 "util", "dofile.pl")),
1412 rel2abs($config{builddir}));
1413 my @modules = ( 'configdata.pm',
1414 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1415 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
1416 $deps = join(' ', $deps, @modules);
1417 @modules = map { "-M".basename($_, '.pm') } @modules;
1418 my $modules = join(' ', '', sort keys %moduleincs, @modules);
1420 $args{src}: $gen0 $deps
1421 \$(PERL)$modules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
1423 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1425 # Generic generator using OpenSSL programs
1428 # Redo $deps, because programs aren't expected to have deps of their
1429 # own. This is a little more tricky, though, because running programs
1430 # may have dependencies on all sorts of files, so we search through
1431 # our database of programs and modules to see if our dependencies
1433 $deps = join(' ', map { my $x = $_;
1434 if (grep { $x eq $_ }
1435 @{$unified_info{programs}}) {
1437 } elsif (grep { $x eq $_ }
1438 @{$unified_info{modules}}) {
1444 # Also redo $gen0, to ensure that we have the proper extension where
1446 $gen0 = platform->bin($gen0);
1447 # Use $(PERL) to execute wrap.pl directly to avoid calling env
1449 $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
1450 \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
1454 # Generic generator using Perl
1457 $args{src}: $gen0 $deps
1458 \$(PERL)$gen_incs $gen0$gen_args > \$@
1463 # Should one wonder about the end of the Perl snippet, it's because this
1464 # second regexp eats up line endings as well, if the removed path is the
1465 # last in the line. We may therefore need to put back a line ending.
1468 my $obj = platform->convertext($args{obj});
1469 my $dep = platform->dep($args{obj});
1470 my @srcs = @{$args{srcs}};
1471 my $srcs = join(" ", @srcs);
1472 my $deps = join(" ", @srcs, @{$args{deps}});
1473 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1474 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1478 if (grep /\.rc$/, @srcs) {
1480 $cmdflags = '$(RCFLAGS)';
1482 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1484 $cmdcompile = ' -c';
1486 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1487 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1488 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1489 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1490 } -> {$args{intent}};
1493 $cmdcompile = ' -c';
1495 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1496 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1497 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1498 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1499 } -> {$args{intent}};
1502 # extension-specific rules
1503 if (grep /\.s$/, @srcs) {
1506 $cmd $cmdflags -c -o \$\@ $srcs
1508 } elsif (grep /\.S$/, @srcs) {
1509 # Originally there was multi-step rule with $(CC) -E file.S
1510 # followed by $(CC) -c file.s. It compensated for one of
1511 # legacy platform compiler's inability to handle .S files.
1512 # The platform is long discontinued by vendor so there is
1513 # hardly a point to drag it along...
1516 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1518 } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
1521 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1523 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1526 mv $dep.tmp $dep; \\
1532 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1534 if ($makedep_scheme eq 'makedepend') {
1536 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1543 # We *know* this routine is only called when we've configure 'shared'.
1548 foreach (@{$args{deps}}) {
1549 if (platform->isstaticlib($_)) {
1550 push @linklibs, platform->convertext($_);
1552 my $d = "-L" . dirname($_);
1553 my $l = basename($_);
1557 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1560 my $linkflags = join("", map { $_." " } @linkdirs);
1561 my $linklibs = join("", map { $_." " } @linklibs);
1562 my @objs = map { platform->convertext($_) }
1563 grep { !platform->isdef($_) }
1565 my @defs = map { platform->def($_) }
1566 grep { platform->isdef($_) }
1568 my @deps = compute_lib_depends(@{$args{deps}});
1569 die "More than one exported symbol map" if scalar @defs > 1;
1571 my $full = platform->sharedlib($args{lib});
1572 # $import is for Windows and subsystems thereof, where static import
1573 # libraries for DLLs are a thing. On platforms that have this mechanism,
1574 # $import has the name of this import library. On platforms that don't
1575 # have this mechanism, $import will be |undef|.
1576 my $import = platform->sharedlib_import($args{lib});
1577 # $simple is for platforms where full shared library names include the
1578 # shared library version, and there's a simpler name that doesn't include
1579 # that version. On such platforms, $simple has the simpler name. On
1580 # other platforms, it will be |undef|.
1581 my $simple = platform->sharedlib_simple($args{lib});
1583 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1584 my $shared_soname = "";
1585 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1586 if defined $target{shared_sonameflag};
1587 my $shared_imp = "";
1588 $shared_imp .= ' '.$target{shared_impflag}.basename($import)
1589 if defined $target{shared_impflag} && defined $import;
1590 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1592 # There is at least one platform where the compiler-as-linker needs to
1593 # have one object file directly on the command line. That won't hurt
1594 # any other platform, so we do that for everyone when there's an argfile
1595 # to be had. This depends heavily on splice, which removes elements from
1596 # the given array, and returns them so they can be captured.
1597 my @argfileobjs = $argfile
1600 my $argfilecmds = $argfile
1601 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1603 my $argfiledeps = $argfile
1604 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1605 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1607 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1610 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1613 join(" \\\n" . ' ' x (length($full) + 2),
1614 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1616 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1620 if (defined $simple && $simple ne $full) {
1625 \$(AR) r $simple $full
1635 if (defined $import) {
1642 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1643 -o $full$shared_def \\
1645 $linklibs \$(LIB_EX_LIBS)
1654 if (!$disabled{tests}) {
1661 $recipe .= <<"EOF" if defined $argfile;
1662 $argfile: $argfiledeps
1670 my $dso = platform->dso($args{module});
1673 foreach (@{$args{deps}}) {
1674 next unless defined $_;
1675 if (platform->isstaticlib($_)) {
1676 push @linklibs, platform->convertext($_);
1678 my $d = "-L" . dirname($_);
1679 my $l = basename($_);
1683 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1686 my $linkflags = join("", map { $_." " } @linkdirs);
1687 my $linklibs = join("", map { $_." " } @linklibs);
1688 my @objs = map { platform->convertext($_) }
1689 grep { !platform->isdef($_) }
1691 my @defs = map { platform->def($_) }
1692 grep { platform->isdef($_) }
1694 my @deps = compute_lib_depends(@{$args{deps}});
1695 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1696 # Next line needs to become "less magic" (see PR #11950)
1697 $shared_def .= ' '.$target{shared_fipsflag} if (m/providers\/fips/ && defined $target{shared_fipsflag});
1698 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1699 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1700 fill_lines(' ', $COLUMNS - length($dso) - 2,
1701 @objs, @defs, @deps));
1705 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1706 -o $dso$shared_def \\
1708 $linklibs\$(DSO_EX_LIBS)
1713 my $lib = platform->staticlib($args{lib});
1714 my @objs = map { platform->obj($_) } @{$args{objs}};
1715 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1716 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1717 my $max_per_call = 500;
1719 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1721 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1726 \$(RANLIB) \$\@ || echo Never mind.
1731 my $bin = platform->bin($args{bin});
1732 my @objs = map { platform->obj($_) } @{$args{objs}};
1733 my @deps = compute_lib_depends(@{$args{deps}});
1734 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1735 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1738 foreach (@{$args{deps}}) {
1739 next unless defined $_;
1740 if (platform->isstaticlib($_)) {
1741 push @linklibs, platform->convertext($_);
1743 my $d = "-L" . dirname($_);
1744 my $l = basename($_);
1748 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1751 my $linkflags = join("", map { $_." " } @linkdirs);
1752 my $linklibs = join("", map { $_." " } @linklibs);
1754 my $cmdflags = '$(BIN_CFLAGS)';
1755 if (grep /_cc\.o$/, @{$args{objs}}) {
1757 $cmdflags = '$(BIN_CXXFLAGS)';
1760 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1761 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1762 fill_lines(' ', $COLUMNS - length($bin) - 2,
1768 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1771 $linklibs\$(BIN_EX_LIBS)
1776 my $script = $args{script};
1777 my $sources = join(" ", @{$args{sources}});
1778 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1779 "util", "dofile.pl")),
1780 rel2abs($config{builddir}));
1783 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1784 "-o$target{build_file}" $sources > "$script"
1790 my $dir = $args{dir};
1791 my @deps = map { platform->convertext($_) } @{$args{deps}};
1793 my %extinfo = ( dso => platform->dsoext(),
1794 lib => platform->libext(),
1795 bin => platform->binext() );
1797 # We already have a 'test' target, and the top directory is just plain
1799 return if $dir eq "test" || $dir eq ".";
1801 foreach my $type (("dso", "lib", "bin", "script")) {
1802 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1803 # For lib object files, we could update the library. However, it
1804 # was decided that it's enough to build the directory local object
1805 # files, so we don't need to add any actions, and the dependencies
1806 # are already taken care of.
1807 if ($type ne "lib") {
1808 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1809 if (dirname($prod) eq $dir) {
1810 push @deps, $prod.$extinfo{$type};
1812 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1818 my $target = "$dir $dir/";
1819 my $deps = join(" \\\n\t",
1820 fill_lines(' ', $COLUMNS - 8, @deps));
1821 my $comments = join("\n", "", @comments);
1827 "" # Important! This becomes part of the template result.