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 @$(PERL) $(BLDDIR)/util/wrap.pl $(BLDDIR)/apps/openssl fipsinstall \
592 -module $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME) \
593 -out $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf \
594 -macopt 'hexkey:$(FIPSKEY)'
596 uninstall_fips: uninstall_sw
597 @$(ECHO) "*** Uninstalling FIPS module configuration"
598 @$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
599 @$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf
602 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
603 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
604 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
605 @set -e; for x in dummy $(MISC_SCRIPTS); do \
606 if [ "$$x" = "dummy" ]; then continue; fi; \
607 x1=`echo "$$x" | cut -f1 -d:`; \
608 x2=`echo "$$x" | cut -f2 -d:`; \
609 fn=`basename $$x1`; \
610 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
611 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
612 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
613 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
614 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
615 if [ "$$x1" != "$$x2" ]; then \
616 ln=`basename "$$x2"`; \
617 : {- output_off() unless windowsdll(); "" -}; \
618 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
619 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
620 : {- output_on() unless windowsdll();
621 output_off() if windowsdll(); "" -}; \
622 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
623 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
624 : {- output_on() if windowsdll(); "" -}; \
627 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
628 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
629 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
630 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
631 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
632 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
633 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
634 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
636 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
637 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
638 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
639 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
640 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
641 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
642 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
643 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
646 install_dev: install_runtime_libs
647 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
648 @$(ECHO) "*** Installing development files"
649 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
650 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
651 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
652 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
653 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
654 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
655 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
656 $(BLDDIR)/include/openssl/*.h; do \
658 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
659 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
660 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
662 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
663 @set -e; for l in $(INSTALL_LIBS); do \
665 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
666 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
667 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
668 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
669 mv -f $(DESTDIR)$(libdir)/$$fn.new \
670 $(DESTDIR)$(libdir)/$$fn; \
672 @ : {- output_off() if $disabled{shared}; "" -}
673 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
674 s1=`echo "$$s" | cut -f1 -d";"`; \
675 s2=`echo "$$s" | cut -f2 -d";"`; \
676 s3=`echo "$$s" | cut -f3 -d";"`; \
677 fn1=`basename "$$s1"`; \
678 fn2=`basename "$$s2"`; \
679 fn3=`basename "$$s3"`; \
680 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
681 if [ "$$fn2" != "" ]; then \
682 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
683 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
685 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
686 if [ "$$fn3" != "" ]; then \
687 $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
688 cp $$s3 $(DESTDIR)$(libdir)/$$fn3.new; \
689 chmod 755 $(DESTDIR)$(libdir)/$$fn3.new; \
690 mv -f $(DESTDIR)$(libdir)/$$fn3.new \
691 $(DESTDIR)$(libdir)/$$fn3; \
693 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
694 a=$(DESTDIR)$(libdir)/$$fn2; \
695 $(ECHO) "install $$s1 -> $$a"; \
696 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
697 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
699 for so in `$(AR) t $$a`; do \
702 strip -X32_64 -e $$so; \
703 $(AR) r $$a.new $$so; \
706 $(AR) r $$a.new $$s1; \
708 : {- output_off() if sharedaix(); output_on(); "" -}; \
710 @ : {- output_on() if $disabled{shared}; "" -}
711 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
712 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
713 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
714 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
715 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
716 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
717 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
718 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
719 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
720 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
722 uninstall_dev: uninstall_runtime_libs
723 @$(ECHO) "*** Uninstalling development files"
724 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
725 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
726 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
727 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
728 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
729 $(BLDDIR)/include/openssl/*.h; do \
731 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
732 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
734 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
735 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
736 @set -e; for l in $(INSTALL_LIBS); do \
738 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
739 $(RM) $(DESTDIR)$(libdir)/$$fn; \
741 @ : {- output_off() if $disabled{shared}; "" -}
742 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
743 s1=`echo "$$s" | cut -f1 -d";"`; \
744 s2=`echo "$$s" | cut -f2 -d";"`; \
745 s3=`echo "$$s" | cut -f3 -d";"`; \
746 fn1=`basename "$$s1"`; \
747 fn2=`basename "$$s2"`; \
748 fn3=`basename "$$s3"`; \
749 : {- output_off() if windowsdll(); "" -}; \
750 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
751 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
752 if [ -n "$$fn2" ]; then \
753 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
754 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
756 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
757 if [ -n "$$fn3" ]; then \
758 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
759 $(RM) $(DESTDIR)$(libdir)/$$fn3; \
761 : {- output_on() unless windowsdll(); "" -}; \
763 @ : {- output_on() if $disabled{shared}; "" -}
764 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
765 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
766 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
767 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
768 -$(RMDIR) $(DESTDIR)$(libdir)
770 _install_modules_deps: install_runtime_libs build_modules
772 install_engines: _install_modules_deps
773 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
774 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
775 @$(ECHO) "*** Installing engines"
776 @set -e; for e in dummy $(INSTALL_ENGINES); do \
777 if [ "$$e" = "dummy" ]; then continue; fi; \
779 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
780 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
781 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
782 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
783 $(DESTDIR)$(ENGINESDIR)/$$fn; \
787 @$(ECHO) "*** Uninstalling engines"
788 @set -e; for e in dummy $(INSTALL_ENGINES); do \
789 if [ "$$e" = "dummy" ]; then continue; fi; \
791 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
792 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
794 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
796 install_modules: _install_modules_deps
797 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
798 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
799 @$(ECHO) "*** Installing modules"
800 @set -e; for e in dummy $(INSTALL_MODULES); do \
801 if [ "$$e" = "dummy" ]; then continue; fi; \
803 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
804 cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \
805 chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \
806 mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \
807 $(DESTDIR)$(MODULESDIR)/$$fn; \
811 @$(ECHO) "*** Uninstalling modules"
812 @set -e; for e in dummy $(INSTALL_MODULES); do \
813 if [ "$$e" = "dummy" ]; then continue; fi; \
815 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
816 $(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \
818 -$(RMDIR) $(DESTDIR)$(MODULESDIR)
820 install_runtime: install_programs
822 install_runtime_libs: build_libs
823 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
824 @ : {- output_off() if windowsdll(); "" -}
825 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
826 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
827 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
828 @ : {- output_on() unless windowsdll(); "" -}
829 @$(ECHO) "*** Installing runtime libraries"
830 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
831 if [ "$$s" = "dummy" ]; then continue; fi; \
833 : {- output_off() unless windowsdll(); "" -}; \
834 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
835 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
836 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
837 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
838 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
839 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
840 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
841 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
842 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
843 mv -f $(DESTDIR)$(libdir)/$$fn.new \
844 $(DESTDIR)$(libdir)/$$fn; \
845 : {- output_on() if windowsdll(); "" -}; \
848 install_programs: install_runtime_libs build_programs
849 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
850 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
851 @$(ECHO) "*** Installing runtime programs"
852 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
853 if [ "$$x" = "dummy" ]; then continue; fi; \
855 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
856 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
857 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
858 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
859 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
861 @set -e; for x in dummy $(BIN_SCRIPTS); do \
862 if [ "$$x" = "dummy" ]; then continue; fi; \
864 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
865 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
866 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
867 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
868 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
871 uninstall_runtime: uninstall_programs uninstall_runtime_libs
874 @$(ECHO) "*** Uninstalling runtime programs"
875 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
877 if [ "$$x" = "dummy" ]; then continue; fi; \
879 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
880 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
882 @set -e; for x in dummy $(BIN_SCRIPTS); \
884 if [ "$$x" = "dummy" ]; then continue; fi; \
886 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
887 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
889 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
891 uninstall_runtime_libs:
892 @$(ECHO) "*** Uninstalling runtime libraries"
893 @ : {- output_off() unless windowsdll(); "" -}
894 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
895 if [ "$$s" = "dummy" ]; then continue; fi; \
897 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
898 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
900 @ : {- output_on() unless windowsdll(); "" -}
903 install_man_docs: build_man_docs
904 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
905 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
906 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
907 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
908 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
909 @$(ECHO) "*** Installing manpages"
910 @set -e; for x in dummy $(MANDOCS1); do \
911 if [ "$$x" = "dummy" ]; then continue; fi; \
913 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
914 cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
915 chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
917 @set -e; for x in dummy $(MANDOCS3); do \
918 if [ "$$x" = "dummy" ]; then continue; fi; \
920 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
921 cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
922 chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
924 @set -e; for x in dummy $(MANDOCS5); do \
925 if [ "$$x" = "dummy" ]; then continue; fi; \
927 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
928 cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
929 chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
931 @set -e; for x in dummy $(MANDOCS7); do \
932 if [ "$$x" = "dummy" ]; then continue; fi; \
934 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
935 cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
936 chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
940 @$(ECHO) "*** Uninstalling manpages"
941 @set -e; for x in dummy $(MANDOCS1); do \
942 if [ "$$x" = "dummy" ]; then continue; fi; \
944 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
945 $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
947 @set -e; for x in dummy $(MANDOCS3); do \
948 if [ "$$x" = "dummy" ]; then continue; fi; \
950 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
951 $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
953 @set -e; for x in dummy $(MANDOCS5); do \
954 if [ "$$x" = "dummy" ]; then continue; fi; \
956 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
957 $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
959 @set -e; for x in dummy $(MANDOCS7); do \
960 if [ "$$x" = "dummy" ]; then continue; fi; \
962 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
963 $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
966 install_html_docs: build_html_docs
967 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
968 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
969 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
970 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
971 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
972 @$(ECHO) "*** Installing HTML manpages"
973 @set -e; for x in dummy $(HTMLDOCS1); do \
974 if [ "$$x" = "dummy" ]; then continue; fi; \
976 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
977 cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
978 chmod 644 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
980 @set -e; for x in dummy $(HTMLDOCS3); do \
981 if [ "$$x" = "dummy" ]; then continue; fi; \
983 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
984 cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
985 chmod 644 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
987 @set -e; for x in dummy $(HTMLDOCS5); do \
988 if [ "$$x" = "dummy" ]; then continue; fi; \
990 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
991 cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
992 chmod 644 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
994 @set -e; for x in dummy $(HTMLDOCS7); do \
995 if [ "$$x" = "dummy" ]; then continue; fi; \
997 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
998 cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
999 chmod 644 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1002 uninstall_html_docs:
1003 @$(ECHO) "*** Uninstalling HTML manpages"
1004 @set -e; for x in dummy $(HTMLDOCS1); do \
1005 if [ "$$x" = "dummy" ]; then continue; fi; \
1006 fn=`basename $$x`; \
1007 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
1008 $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
1010 @set -e; for x in dummy $(HTMLDOCS3); do \
1011 if [ "$$x" = "dummy" ]; then continue; fi; \
1012 fn=`basename $$x`; \
1013 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
1014 $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
1016 @set -e; for x in dummy $(HTMLDOCS5); do \
1017 if [ "$$x" = "dummy" ]; then continue; fi; \
1018 fn=`basename $$x`; \
1019 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
1020 $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
1022 @set -e; for x in dummy $(HTMLDOCS7); do \
1023 if [ "$$x" = "dummy" ]; then continue; fi; \
1024 fn=`basename $$x`; \
1025 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
1026 $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
1029 # Developer targets (note: these are only available on Unix) #########
1031 # It's important that generate_buildinfo comes after ordinals, as ordinals
1032 # is sensitive to build.info changes.
1033 update: generate errors ordinals generate_buildinfo
1035 generate: generate_apps generate_crypto_bn generate_crypto_objects \
1036 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1038 generate_buildinfo: generate_doc_buildinfo
1040 .PHONY: doc-nits cmd-nits md-nits
1041 doc-nits: build_generated_pods
1042 $(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e
1044 cmd-nits: build_generated apps/openssl build_generated_pods
1045 $(PERL) $(SRCDIR)/util/find-doc-nits -c
1047 # This uses "mdl", the markdownlint application, which is written in ruby.
1048 # The source is at https://github.com/markdownlint/markdownlint
1049 # If you have ruby installed, "gem install mdl" should work.
1050 # Another option is at https://snapcraft.io/install/mdl/debian
1051 # Finally, there's a Node.js version, which we haven't tried, that
1052 # can be found at https://github.com/DavidAnson/markdownlint
1054 mdl -s util/markdownlint.rb .
1056 # Test coverage is a good idea for the future
1057 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1061 lint -DLINT $(INCLUDES) $(SRCS)
1064 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1065 < apps/openssl.cnf > apps/openssl-vms.cnf )
1068 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1070 generate_crypto_objects:
1071 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1072 crypto/objects/objects.txt \
1073 crypto/objects/obj_mac.num \
1074 > crypto/objects/obj_mac.new && \
1075 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1076 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1077 crypto/objects/objects.txt \
1078 crypto/objects/obj_mac.num \
1079 > include/openssl/obj_mac.h )
1080 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1081 include/openssl/obj_mac.h \
1082 > crypto/objects/obj_dat.h )
1083 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1084 crypto/objects/obj_mac.num \
1085 crypto/objects/obj_xref.txt \
1086 > crypto/objects/obj_xref.h )
1087 ( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1089 generate_crypto_conf:
1090 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1091 > crypto/conf/conf_def.h )
1093 generate_crypto_asn1:
1094 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1095 > crypto/asn1/charmap.h )
1098 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1099 crypto/objects/obj_dat.h \
1102 generate_doc_buildinfo:
1103 ( $(PERL) -I$(BLDDIR) -Mconfigdata \
1104 $(SRCDIR)/util/dofile.pl -o Makefile \
1105 $(SRCDIR)/doc/build.info.in \
1106 > $(SRCDIR)/doc/build.info.new; \
1107 if ( test -e $(SRCDIR)/doc/build.info \
1108 && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
1111 rm $(SRCDIR)/doc/build.info.new; \
1113 mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
1116 # Set to -force to force a rebuild
1119 ( b=`pwd`; set -e; cd $(SRCDIR); \
1120 $(PERL) util/ck_errf.pl -strict -internal; \
1121 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1122 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1123 for E in *.ec ; do \
1124 $(PERL) ../util/ck_errf.pl -strict \
1125 -conf $$E `basename $$E .ec`.c; \
1126 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1127 -conf $$E `basename $$E .ec`.c ; \
1130 {- use File::Basename;
1132 my @sslheaders_tmpl =
1133 qw( include/openssl/ssl.h
1134 include/openssl/ssl2.h
1135 include/openssl/ssl3.h
1136 include/openssl/sslerr.h
1137 include/openssl/tls1.h
1138 include/openssl/dtls1.h
1139 include/openssl/srtp.h
1140 include/openssl/sslerr_legacy.h );
1141 my @cryptoheaders_tmpl =
1142 qw( include/internal/dso.h
1143 include/internal/o_dir.h
1144 include/internal/err.h
1145 include/internal/evp.h
1146 include/internal/pem.h
1147 include/internal/asn1.h
1148 include/internal/sslconf.h );
1149 my @cryptoskipheaders = ( @sslheaders_tmpl,
1150 qw( include/openssl/conf_api.h
1151 include/openssl/ebcdic.h
1152 include/openssl/opensslconf.h
1153 include/openssl/symhacks.h ) );
1154 our %cryptoheaders = ();
1155 our %sslheaders = ();
1156 foreach my $d ( qw( include/openssl include/internal ) ) {
1157 my @header_patterns =
1158 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1159 foreach my $f ( map { glob($_) } @header_patterns ) {
1160 my $base = basename($f);
1161 my $base_in = basename($f, '.in');
1162 my $dir = catfile($config{sourcedir}, $d);
1163 if ($base ne $base_in) {
1164 # We have a .h.in file, which means the header file is in the
1167 $dir = catfile($config{builddir}, $d);
1169 my $new_f = catfile($dir, $base);
1170 my $fn = "$d/$base";
1171 # The logic to add files to @cryptoheaders is a bit complex. The
1172 # file to be added must be either in the public header directory
1173 # or one of the pre-declared internal headers, and must under no
1174 # circumstances be one of those that must be skipped.
1175 $cryptoheaders{$new_f} = 1
1176 if (($d eq 'include/openssl'
1177 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1178 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1179 # The logic to add files to @sslheaders is much simpler...
1180 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1185 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1186 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1187 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1188 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1189 ordinals: build_generated
1190 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
1191 --ordinals $(SRCDIR)/util/libcrypto.num \
1192 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1194 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
1195 --ordinals $(SRCDIR)/util/libssl.num \
1196 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1201 SRCTOP=../$(SRCDIR) \
1202 BLDTOP=../$(BLDDIR) \
1203 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
1208 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1210 # Release targets (note: only available on Unix) #####################
1213 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1215 # Helper targets #####################################################
1217 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl \
1218 $(BLDDIR)/apps/openssl.cnf
1220 $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm
1221 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1222 mkdir -p "$(BLDDIR)/util"; \
1223 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1226 $(BLDDIR)/apps/openssl.cnf: configdata.pm
1227 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1228 mkdir -p "$(BLDDIR)/apps"; \
1229 ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
1234 # Building targets ###################################################
1236 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
1238 @ ( echo 'prefix=$(INSTALLTOP)'; \
1239 echo 'exec_prefix=$${prefix}'; \
1240 if [ -n "$(LIBDIR)" ]; then \
1241 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1243 echo 'libdir=$(libdir)'; \
1245 echo 'includedir=$${prefix}/include'; \
1246 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
1248 echo 'Name: OpenSSL-libcrypto'; \
1249 echo 'Description: OpenSSL cryptography library'; \
1250 echo 'Version: '$(VERSION); \
1251 echo 'Libs: -L$${libdir} -lcrypto'; \
1252 echo 'Libs.private: $(LIB_EX_LIBS)'; \
1253 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
1256 @ ( echo 'prefix=$(INSTALLTOP)'; \
1257 echo 'exec_prefix=$${prefix}'; \
1258 if [ -n "$(LIBDIR)" ]; then \
1259 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1261 echo 'libdir=$(libdir)'; \
1263 echo 'includedir=$${prefix}/include'; \
1265 echo 'Name: OpenSSL-libssl'; \
1266 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
1267 echo 'Version: '$(VERSION); \
1268 echo 'Requires.private: libcrypto'; \
1269 echo 'Libs: -L$${libdir} -lssl'; \
1270 echo 'Cflags: -I$${includedir}' ) > libssl.pc
1273 @ ( echo 'prefix=$(INSTALLTOP)'; \
1274 echo 'exec_prefix=$${prefix}'; \
1275 if [ -n "$(LIBDIR)" ]; then \
1276 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1278 echo 'libdir=$(libdir)'; \
1280 echo 'includedir=$${prefix}/include'; \
1282 echo 'Name: OpenSSL'; \
1283 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
1284 echo 'Version: '$(VERSION); \
1285 echo 'Requires: libssl libcrypto' ) > openssl.pc
1287 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1288 {- join(" \\\n" . ' ' x 15,
1289 fill_lines(" ", $COLUMNS - 15,
1290 @{$config{build_file_templates}},
1291 @{$config{build_infos}},
1292 @{$config{conf_files}})) -}
1293 @echo "Detected changed: $?"
1294 $(PERL) configdata.pm -r
1295 @echo "**************************************************"
1297 @echo "*** Please run the same make command again ***"
1299 @echo "**************************************************"
1303 $(PERL) configdata.pm -r
1307 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1309 # Helper function to figure out dependencies on libraries
1310 # It takes a list of library names and outputs a list of dependencies
1311 sub compute_lib_depends {
1312 # Depending on shared libraries:
1313 # On Windows POSIX layers, we depend on {libname}.dll.a
1314 # On Unix platforms, we depend on {shlibname}.so
1315 return map { platform->sharedlib_simple($_)
1316 // platform->sharedlib_import($_)
1317 // platform->staticlib($_)
1321 sub generatetarget {
1323 my $deps = join(" ", @{$args{deps}});
1325 $args{target}: $deps
1331 my $gen0 = $args{generator}->[0];
1332 my $gen_args = join('', map { " $_" }
1333 @{$args{generator}}[1..$#{$args{generator}}]);
1334 my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1335 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1336 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1337 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
1339 if ($args{src} =~ /\.html$/) {
1343 my $title = basename($args{src}, ".html");
1347 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1349 } elsif ($args{src} =~ /\.(\d)$/) {
1351 # Man-page generator
1354 my $name = uc basename($args{src}, ".$section");
1358 pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
1359 --release=\$(VERSION) $pod >\$\@
1361 } elsif (platform->isdef($args{src})) {
1363 # Linker script-ish generator
1365 my $target = platform->def($args{src});
1366 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1367 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
1368 my $ord_name = $args{generator}->[1] || $args{product};
1370 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
1371 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
1373 } elsif (platform->isasm($args{src})) {
1375 # Assembler generator
1378 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1379 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1380 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1381 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1382 } -> {$args{intent}};
1385 if ($gen0 =~ /\.pl$/) {
1386 $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
1387 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1388 } elsif ($gen0 =~ /\.m4$/) {
1389 $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
1390 } elsif ($gen0 =~ /\.S$/) {
1393 die "Generator type for $args{src} unknown: $gen0\n";
1396 if (defined($generator)) {
1398 $args{src}: $gen0 $deps
1403 $args{src}: $gen0 $deps
1404 \$(CC) $incs $cppflags $defs -E $gen0 | \\
1405 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1407 } elsif ($gen0 =~ m|^.*\.in$|) {
1409 # "dofile" generator (file.in -> file)
1411 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1412 "util", "dofile.pl")),
1413 rel2abs($config{builddir}));
1414 my @modules = ( 'configdata.pm',
1415 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1416 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
1417 $deps = join(' ', $deps, @modules);
1418 @modules = map { "-M".basename($_, '.pm') } @modules;
1419 my $modules = join(' ', '', sort keys %moduleincs, @modules);
1421 $args{src}: $gen0 $deps
1422 \$(PERL)$modules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
1424 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1426 # Generic generator using OpenSSL programs
1429 # Redo $deps, because programs aren't expected to have deps of their
1430 # own. This is a little more tricky, though, because running programs
1431 # may have dependencies on all sorts of files, so we search through
1432 # our database of programs and modules to see if our dependencies
1434 $deps = join(' ', map { my $x = $_;
1435 if (grep { $x eq $_ }
1436 @{$unified_info{programs}}) {
1438 } elsif (grep { $x eq $_ }
1439 @{$unified_info{modules}}) {
1445 # Also redo $gen0, to ensure that we have the proper extension where
1447 $gen0 = platform->bin($gen0);
1448 # Use $(PERL) to execute wrap.pl directly to avoid calling env
1450 $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
1451 \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
1455 # Generic generator using Perl
1458 $args{src}: $gen0 $deps
1459 \$(PERL)$gen_incs $gen0$gen_args > \$@
1464 # Should one wonder about the end of the Perl snippet, it's because this
1465 # second regexp eats up line endings as well, if the removed path is the
1466 # last in the line. We may therefore need to put back a line ending.
1469 my $obj = platform->convertext($args{obj});
1470 my $dep = platform->dep($args{obj});
1471 my @srcs = @{$args{srcs}};
1472 my $srcs = join(" ", @srcs);
1473 my $deps = join(" ", @srcs, @{$args{deps}});
1474 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1475 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1479 if (grep /\.rc$/, @srcs) {
1481 $cmdflags = '$(RCFLAGS)';
1483 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1485 $cmdcompile = ' -c';
1487 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1488 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1489 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1490 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1491 } -> {$args{intent}};
1494 $cmdcompile = ' -c';
1496 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1497 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1498 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1499 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1500 } -> {$args{intent}};
1503 # extension-specific rules
1504 if (grep /\.s$/, @srcs) {
1507 $cmd $cmdflags -c -o \$\@ $srcs
1509 } elsif (grep /\.S$/, @srcs) {
1510 # Originally there was multi-step rule with $(CC) -E file.S
1511 # followed by $(CC) -c file.s. It compensated for one of
1512 # legacy platform compiler's inability to handle .S files.
1513 # The platform is long discontinued by vendor so there is
1514 # hardly a point to drag it along...
1517 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1519 } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
1522 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1524 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1527 mv $dep.tmp $dep; \\
1533 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1535 if ($makedep_scheme eq 'makedepend') {
1537 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1544 # We *know* this routine is only called when we've configure 'shared'.
1549 foreach (@{$args{deps}}) {
1550 if (platform->isstaticlib($_)) {
1551 push @linklibs, platform->convertext($_);
1553 my $d = "-L" . dirname($_);
1554 my $l = basename($_);
1558 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1561 my $linkflags = join("", map { $_." " } @linkdirs);
1562 my $linklibs = join("", map { $_." " } @linklibs);
1563 my @objs = map { platform->convertext($_) }
1564 grep { !platform->isdef($_) }
1566 my @defs = map { platform->def($_) }
1567 grep { platform->isdef($_) }
1569 my @deps = compute_lib_depends(@{$args{deps}});
1570 die "More than one exported symbol map" if scalar @defs > 1;
1572 my $full = platform->sharedlib($args{lib});
1573 # $import is for Windows and subsystems thereof, where static import
1574 # libraries for DLLs are a thing. On platforms that have this mechanism,
1575 # $import has the name of this import library. On platforms that don't
1576 # have this mechanism, $import will be |undef|.
1577 my $import = platform->sharedlib_import($args{lib});
1578 # $simple is for platforms where full shared library names include the
1579 # shared library version, and there's a simpler name that doesn't include
1580 # that version. On such platforms, $simple has the simpler name. On
1581 # other platforms, it will be |undef|.
1582 my $simple = platform->sharedlib_simple($args{lib});
1584 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1585 my $shared_soname = "";
1586 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1587 if defined $target{shared_sonameflag};
1588 my $shared_imp = "";
1589 $shared_imp .= ' '.$target{shared_impflag}.basename($import)
1590 if defined $target{shared_impflag} && defined $import;
1591 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1593 # There is at least one platform where the compiler-as-linker needs to
1594 # have one object file directly on the command line. That won't hurt
1595 # any other platform, so we do that for everyone when there's an argfile
1596 # to be had. This depends heavily on splice, which removes elements from
1597 # the given array, and returns them so they can be captured.
1598 my @argfileobjs = $argfile
1601 my $argfilecmds = $argfile
1602 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1604 my $argfiledeps = $argfile
1605 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1606 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1608 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1611 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1614 join(" \\\n" . ' ' x (length($full) + 2),
1615 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1617 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1621 if (defined $simple && $simple ne $full) {
1626 \$(AR) r $simple $full
1636 if (defined $import) {
1643 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1644 -o $full$shared_def \\
1646 $linklibs \$(LIB_EX_LIBS)
1655 if (!$disabled{tests}) {
1662 $recipe .= <<"EOF" if defined $argfile;
1663 $argfile: $argfiledeps
1671 my $dso = platform->dso($args{module});
1674 foreach (@{$args{deps}}) {
1675 next unless defined $_;
1676 if (platform->isstaticlib($_)) {
1677 push @linklibs, platform->convertext($_);
1679 my $d = "-L" . dirname($_);
1680 my $l = basename($_);
1684 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1687 my $linkflags = join("", map { $_." " } @linkdirs);
1688 my $linklibs = join("", map { $_." " } @linklibs);
1689 my @objs = map { platform->convertext($_) }
1690 grep { !platform->isdef($_) }
1692 my @defs = map { platform->def($_) }
1693 grep { platform->isdef($_) }
1695 my @deps = compute_lib_depends(@{$args{deps}});
1696 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1697 # Next line needs to become "less magic" (see PR #11950)
1698 $shared_def .= ' '.$target{shared_fipsflag} if (m/providers\/fips/ && defined $target{shared_fipsflag});
1699 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1700 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1701 fill_lines(' ', $COLUMNS - length($dso) - 2,
1702 @objs, @defs, @deps));
1706 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1707 -o $dso$shared_def \\
1709 $linklibs\$(DSO_EX_LIBS)
1714 my $lib = platform->staticlib($args{lib});
1715 my @objs = map { platform->obj($_) } @{$args{objs}};
1716 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1717 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1718 my $max_per_call = 500;
1720 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1722 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1727 \$(RANLIB) \$\@ || echo Never mind.
1732 my $bin = platform->bin($args{bin});
1733 my @objs = map { platform->obj($_) } @{$args{objs}};
1734 my @deps = compute_lib_depends(@{$args{deps}});
1735 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1736 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1739 foreach (@{$args{deps}}) {
1740 next unless defined $_;
1741 if (platform->isstaticlib($_)) {
1742 push @linklibs, platform->convertext($_);
1744 my $d = "-L" . dirname($_);
1745 my $l = basename($_);
1749 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1752 my $linkflags = join("", map { $_." " } @linkdirs);
1753 my $linklibs = join("", map { $_." " } @linklibs);
1755 my $cmdflags = '$(BIN_CFLAGS)';
1756 if (grep /_cc\.o$/, @{$args{objs}}) {
1758 $cmdflags = '$(BIN_CXXFLAGS)';
1761 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1762 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1763 fill_lines(' ', $COLUMNS - length($bin) - 2,
1769 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1772 $linklibs\$(BIN_EX_LIBS)
1777 my $script = $args{script};
1778 my $sources = join(" ", @{$args{sources}});
1779 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1780 "util", "dofile.pl")),
1781 rel2abs($config{builddir}));
1784 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1785 "-o$target{build_file}" $sources > "$script"
1791 my $dir = $args{dir};
1792 my @deps = map { platform->convertext($_) } @{$args{deps}};
1794 my %extinfo = ( dso => platform->dsoext(),
1795 lib => platform->libext(),
1796 bin => platform->binext() );
1798 # We already have a 'test' target, and the top directory is just plain
1800 return if $dir eq "test" || $dir eq ".";
1802 foreach my $type (("dso", "lib", "bin", "script")) {
1803 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1804 # For lib object files, we could update the library. However, it
1805 # was decided that it's enough to build the directory local object
1806 # files, so we don't need to add any actions, and the dependencies
1807 # are already taken care of.
1808 if ($type ne "lib") {
1809 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1810 if (dirname($prod) eq $dir) {
1811 push @deps, $prod.$extinfo{$type};
1813 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1819 my $target = "$dir $dir/";
1820 my $deps = join(" \\\n\t",
1821 fill_lines(' ', $COLUMNS - 8, @deps));
1822 my $comments = join("\n", "", @comments);
1828 "" # Important! This becomes part of the template result.