2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 our $makedepprog = platform->makedepprog();
8 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
10 # Shared AIX support is special. We put libcrypto[64].so.ver into
11 # libcrypto.a and use libcrypto_a.a as static one.
12 sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
14 our $sover_dirname = platform->shlib_version_as_filename();
16 # This makes sure things get built in the order they need
21 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
24 our $COLUMNS = $ENV{COLUMNS};
25 if ($COLUMNS =~ /^\d+$/) {
26 $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
32 my $item_sep = shift; # string
33 my $line_length = shift; # number of chars
39 my $fill_line = $result[$resultpos] // '';
41 ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
43 if (length($newline) > $line_length) {
44 # If this is a single item and the intended result line
45 # is empty, we put it there anyway
46 if ($fill_line eq '') {
47 $result[$resultpos++] = $newline;
49 $result[++$resultpos] = $_;
52 $result[$resultpos] = $newline;
59 PLATFORM={- $config{target} -}
60 OPTIONS={- $config{options} -}
61 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
62 SRCDIR={- $config{sourcedir} -}
63 BLDDIR={- $config{builddir} -}
64 FIPSKEY={- $config{FIPSKEY} -}
66 VERSION={- "$config{full_version}" -}
67 MAJOR={- $config{major} -}
68 MINOR={- $config{minor} -}
69 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
70 SHLIB_TARGET={- $target{shared_target} -}
72 LIBS={- join(" \\\n" . ' ' x 5,
73 fill_lines(" ", $COLUMNS - 5,
74 map { platform->staticlib($_) // () }
75 @{$unified_info{libraries}})) -}
76 SHLIBS={- join(" \\\n" . ' ' x 7,
77 fill_lines(" ", $COLUMNS - 7,
78 map { platform->sharedlib($_) // () }
79 @{$unified_info{libraries}})) -}
80 SHLIB_INFO={- join(" \\\n" . ' ' x 11,
81 fill_lines(" ", $COLUMNS - 11,
82 map { my $x = platform->sharedlib($_);
83 my $y = platform->sharedlib_simple($_);
84 $x ? "\"$x;$y\"" : () }
85 @{$unified_info{libraries}})) -}
86 MODULES={- join(" \\\n" . ' ' x 8,
87 fill_lines(" ", $COLUMNS - 8,
88 map { platform->dso($_) }
89 @{$unified_info{modules}})) -}
90 FIPSMODULENAME={- # We do some extra checking here, as there should be only one
92 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
93 && $unified_info{attributes}->{modules}->{$_}->{fips} }
94 @{$unified_info{modules}};
95 die "More that one FIPS module" if scalar @fipsmodules > 1;
96 join(" ", map { basename platform->dso($_) } @fipsmodules) -}
98 PROGRAMS={- join(" \\\n" . ' ' x 9,
99 fill_lines(" ", $COLUMNS - 9,
100 map { platform->bin($_) }
101 @{$unified_info{programs}})) -}
102 SCRIPTS={- join(" \\\n" . ' ' x 8,
103 fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
104 {- output_off() if $disabled{makedepend}; "" -}
105 DEPS={- join(" \\\n" . ' ' x 5,
106 fill_lines(" ", $COLUMNS - 5,
107 map { platform->isobj($_) ? platform->dep($_) : () }
108 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
109 keys %{$unified_info{sources}})); -}
110 {- output_on() if $disabled{makedepend}; "" -}
111 GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
112 fill_lines(" ", $COLUMNS - 20,
113 @{$unified_info{depends}->{""}})) -}
114 GENERATED={- # common0.tmpl provides @generated
115 join(" \\\n" . ' ' x 5,
116 fill_lines(" ", $COLUMNS - 5,
117 map { platform->convertext($_) } @generated )) -}
120 join(" \\\n" . ' ' x 13,
121 fill_lines(" ", $COLUMNS - 13,
122 map { platform->staticlib($_) // () }
123 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
124 @{$unified_info{libraries}}))
127 join(" \\\n" . ' ' x 15,
128 fill_lines(" ", $COLUMNS - 15,
129 map { platform->sharedlib($_) // () }
130 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
131 @{$unified_info{libraries}}))
133 INSTALL_SHLIB_INFO={-
134 join(" \\\n" . ' ' x 19,
135 fill_lines(" ", $COLUMNS - 19,
136 map { my $x = platform->sharedlib($_);
137 my $y = platform->sharedlib_simple($_);
138 $x ? "\"$x;$y\"" : () }
139 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
140 @{$unified_info{libraries}}))
143 join(" \\\n" . ' ' x 16,
144 fill_lines(" ", $COLUMNS - 16,
145 map { platform->dso($_) }
146 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
147 && $unified_info{attributes}->{modules}->{$_}->{engine} }
148 @{$unified_info{modules}}))
151 join(" \\\n" . ' ' x 16,
152 fill_lines(" ", $COLUMNS - 16,
153 map { platform->dso($_) }
154 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
155 && !$unified_info{attributes}->{modules}->{$_}->{engine} }
156 @{$unified_info{modules}}))
159 join(" \\\n" . ' ' x 16,
160 fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
161 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
162 @{$unified_info{programs}}))
165 join(" \\\n" . ' ' x 12,
166 fill_lines(" ", $COLUMNS - 12,
167 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
169 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
170 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
171 @{$unified_info{scripts}}))
174 join(" \\\n" . ' ' x 13,
175 fill_lines(" ", $COLUMNS - 13,
176 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
178 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
179 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
180 @{$unified_info{scripts}}))
183 join(" \\\n" . ' ' x 10,
184 fill_lines(" ", $COLUMNS - 10,
185 @{$unified_info{htmldocs}->{man1}})) -}
187 join(" \\\n" . ' ' x 10,
188 fill_lines(" ", $COLUMNS - 10,
189 @{$unified_info{htmldocs}->{man3}})) -}
191 join(" \\\n" . ' ' x 10,
192 fill_lines(" ", $COLUMNS - 10,
193 @{$unified_info{htmldocs}->{man5}})) -}
195 join(" \\\n" . ' ' x 10,
196 fill_lines(" ", $COLUMNS - 10,
197 @{$unified_info{htmldocs}->{man7}})) -}
199 join(" \\\n" . ' ' x 9,
200 fill_lines(" ", $COLUMNS - 9,
201 @{$unified_info{mandocs}->{man1}})) -}
203 join(" \\\n" . ' ' x 9,
204 fill_lines(" ", $COLUMNS - 9,
205 @{$unified_info{mandocs}->{man3}})) -}
207 join(" \\\n" . ' ' x 9,
208 fill_lines(" ", $COLUMNS - 9,
209 @{$unified_info{mandocs}->{man5}})) -}
211 join(" \\\n" . ' ' x 9,
212 fill_lines(" ", $COLUMNS - 9,
213 @{$unified_info{mandocs}->{man7}})) -}
215 APPS_OPENSSL="{- use File::Spec::Functions;
216 catfile("apps","openssl") -}"
218 # DESTDIR is for package builders so that they can configure for, say,
219 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
220 # Normally it is left empty.
223 # Do not edit these manually. Use Configure with --prefix or --openssldir
224 # to change this! Short explanation in the top comment in Configure
225 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
227 our $prefix = $config{prefix} || "/usr/local";
230 # The logic here is that if no --openssldir was given,
231 # OPENSSLDIR will get the value from $prefix plus "/ssl".
232 # If --openssldir was given and the value is an absolute
233 # path, OPENSSLDIR will get its value without change.
234 # If the value from --openssldir is a relative path,
235 # OPENSSLDIR will get $prefix with the --openssldir
236 # value appended as a subdirectory.
238 use File::Spec::Functions;
240 $config{openssldir} ?
241 (file_name_is_absolute($config{openssldir}) ?
243 : catdir($prefix, $config{openssldir}))
244 : catdir($prefix, "ssl");
246 LIBDIR={- our $libdir = $config{libdir};
249 # if $prefix/lib$target{multilib} is not an existing
250 # directory, then assume that it's not searched by linker
251 # automatically, in which case adding $target{multilib} suffix
252 # causes more grief than we're ready to tolerate, so don't...
254 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
255 $libdir = "lib$multilib";
257 file_name_is_absolute($libdir) ? "" : $libdir -}
258 # $(libdir) is chosen to be compatible with the GNU coding standards
259 libdir={- file_name_is_absolute($libdir)
260 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
261 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
262 MODULESDIR=$(libdir)/ossl-modules
264 # Convenience variable for those who want to set the rpath in shared
265 # libraries and applications
268 MANDIR=$(INSTALLTOP)/share/man
269 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
270 HTMLDIR=$(DOCDIR)/html
272 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
273 # appended after the manpage file section number. "ssl" is popular,
274 # resulting in files such as config.5ssl rather than config.5.
278 # For "optional" echo messages, to get "real" silence
281 ##### User defined commands and flags ################################
283 # We let the C compiler driver to take care of .s files. This is done in
284 # order to be excused from maintaining a separate set of architecture
285 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
286 # gcc, then the driver will automatically translate it to -xarch=v8plus
287 # and pass it down to assembler. In any case, we do not define AS or
288 # ASFLAGS for this reason.
290 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
291 CC=$(CROSS_COMPILE){- $config{CC} -}
292 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
293 CPPFLAGS={- our $cppflags1 = join(" ",
294 (map { "-D".$_} @{$config{CPPDEFINES}}),
295 (map { "-I".$_} @{$config{CPPINCLUDES}}),
296 @{$config{CPPFLAGS}}) -}
297 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
298 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
299 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
300 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
302 MAKEDEPEND={- $config{makedepprog} -}
304 PERL={- $config{PERL} -}
306 AR=$(CROSS_COMPILE){- $config{AR} -}
307 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
308 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
309 RC= $(CROSS_COMPILE){- $config{RC} -}
310 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
314 TAR= {- $target{TAR} || "tar" -}
315 TARFLAGS= {- $target{TARFLAGS} -}
318 NAME= $(BASENAME)-$(VERSION)
319 # Relative to $(SRCDIR)
320 TARFILE= ../$(NAME).tar
322 ##### Project flags ##################################################
324 # Variables starting with CNF_ are common variables for all product types
326 CNF_CPPFLAGS={- our $cppflags2 =
327 join(' ', $target{cppflags} || (),
328 (map { "-D".$_} @{$target{defines}},
329 @{$config{defines}}),
330 (map { "-I".$_} @{$target{includes}},
331 @{$config{includes}}),
332 @{$config{cppflags}}) -}
333 CNF_CFLAGS={- join(' ', $target{cflags} || (),
334 @{$config{cflags}}) -}
335 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
336 @{$config{cxxflags}}) -}
337 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
338 @{$config{lflags}}) -}
339 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
340 @{$config{ex_libs}}) -}
342 # Variables starting with LIB_ are used to build library object files
343 # and shared libraries.
344 # Variables starting with DSO_ are used to build DSOs and their object files.
345 # Variables starting with BIN_ are used to build programs and their object
348 LIB_CPPFLAGS={- our $lib_cppflags =
349 join(' ', $target{lib_cppflags} || (),
350 $target{shared_cppflag} || (),
352 @{$target{lib_defines} || ()},
353 @{$target{shared_defines} || ()},
354 @{$config{lib_defines} || ()},
355 @{$config{shared_defines} || ()}),
356 (map { '-I'.quotify1($_) }
357 @{$target{lib_includes}},
358 @{$target{shared_includes}},
359 @{$config{lib_includes}},
360 @{$config{shared_includes}}),
361 @{$config{lib_cppflags}},
362 @{$config{shared_cppflag}});
363 join(' ', $lib_cppflags,
365 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
366 'ENGINESDIR="\"$(ENGINESDIR)\""',
367 'MODULESDIR="\"$(MODULESDIR)\""'),
368 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
369 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
370 $target{shared_cflag} || (),
371 @{$config{lib_cflags}},
372 @{$config{shared_cflag}},
373 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
374 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
375 $target{shared_cxxflag} || (),
376 @{$config{lib_cxxflags}},
377 @{$config{shared_cxxflag}},
378 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
379 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
380 $config{shared_ldflag} || (),
381 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
382 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
383 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
384 $target{module_cppflags} || (),
386 @{$target{dso_defines}},
387 @{$target{module_defines}},
388 @{$config{dso_defines} || ()},
389 @{$config{module_defines} || ()}),
390 (map { '-I'.quotify1($_) }
391 @{$target{dso_includes}},
392 @{$target{module_includes}},
393 @{$config{dso_includes}},
394 @{$config{module_includes}}),
395 @{$config{dso_cppflags}},
396 @{$config{module_cppflags}},
397 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
398 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
399 $target{module_cflags} || (),
400 @{$config{dso_cflags}},
401 @{$config{module_cflags}},
402 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
403 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
404 $target{module_cxxflags} || (),
405 @{$config{dso_cxxflags}},
406 @{$config{module_cxxflag}},
407 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
408 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
409 $target{module_ldflags} || (),
410 @{$config{dso_ldflags}},
411 @{$config{module_ldflags}},
412 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
413 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
414 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
415 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
416 @{$config{bin_cppflags}},
417 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
418 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
419 @{$config{bin_cflags}},
420 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
421 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
422 @{$config{bin_cxxflags}},
423 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
424 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
425 @{$config{bin_lflags}},
426 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
427 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
429 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
430 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
431 $cppflags2 =~ s|([\\"])|\\$1|g;
432 $lib_cppflags =~ s|([\\"])|\\$1|g;
433 join(' ', $lib_cppflags || (), $cppflags2 || (),
436 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
438 # For x86 assembler: Set PROCESSOR to 386 if you want to support
440 PROCESSOR= {- $config{processor} -}
442 # We want error [and other] messages in English. Trouble is that make(1)
443 # doesn't pass macros down as environment variables unless there already
444 # was corresponding variable originally set. In other words we can only
445 # reassign environment variables, but not set new ones, not in portable
446 # manner that is. That's why we reassign several, just to be sure...
451 # The main targets ###################################################
453 {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
454 {- dependmagic('build_libs'); -}: build_libs_nodep
455 {- dependmagic('build_modules'); -}: build_modules_nodep
456 {- dependmagic('build_programs'); -}: build_programs_nodep
458 build_docs: build_man_docs build_html_docs
459 build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
460 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
462 build_generated: $(GENERATED_MANDATORY)
463 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
464 build_modules_nodep: $(MODULES)
465 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
467 # Kept around for backward compatibility
468 build_apps build_tests: build_programs
470 # Convenience target to prebuild all generated files, not just the mandatory
472 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
473 @ : {- output_off() if $disabled{makedepend}; "" -}
474 @echo "Warning: consider configuring with no-makedepend, because if"
475 @echo " target system doesn't have $(PERL),"
476 @echo " then make will fail..."
477 @ : {- output_on() if $disabled{makedepend}; "" -}
479 all: build_sw build_docs
482 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
483 @ : {- output_off() if $disabled{tests}; "" -}
487 FIPSKEY="$(FIPSKEY)" \
488 EXE_EXT={- platform->binext() -} \
489 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
490 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
491 @echo "Tests are not supported with your chosen Configure options"
492 @ : {- output_on() if !$disabled{tests}; "" -}
495 @ : {- output_off() if $disabled{tests}; "" -}
496 @SRCTOP="$(SRCDIR)" \
497 $(PERL) $(SRCDIR)/test/run_tests.pl list
498 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
499 @echo "Tests are not supported with your chosen Configure options"
500 @ : {- output_on() if !$disabled{tests}; "" -}
502 install: install_sw install_ssldirs install_docs
504 uninstall: uninstall_docs uninstall_sw
507 @set -e; for s in $(SHLIB_INFO); do \
508 if [ "$$s" = ";" ]; then continue; fi; \
509 s1=`echo "$$s" | cut -f1 -d";"`; \
510 s2=`echo "$$s" | cut -f2 -d";"`; \
511 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
514 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
516 if [ "$$s1" != "$$s2" ]; then \
517 $(ECHO) $(RM) $$s2; \
522 $(RM) *{- platform->defext() -}
525 $(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
526 $(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
527 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
528 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
529 -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
530 -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
532 $(RM) tags TAGS doc-nits cmd-nits md-nits
533 $(RM) -r test/test-runs
534 $(RM) openssl.pc libcrypto.pc libssl.pc
535 -find . -type l \! -name '.*' -exec $(RM) {} \;
542 # We check if any depfile is newer than Makefile and decide to
543 # concatenate only if that is true.
545 @: {- output_off() if $disabled{makedepend}; "" -}
546 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
547 defined $makedepprog && $makedepprog =~ /\/makedepend/
548 ? 'makedepend' : 'gcc' -}
549 @: {- output_on() if $disabled{makedepend}; "" -}
551 # Install helper targets #############################################
553 install_sw: install_dev install_engines install_modules install_runtime
555 uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev
557 install_docs: install_man_docs install_html_docs
559 uninstall_docs: uninstall_man_docs uninstall_html_docs
560 $(RM) -r $(DESTDIR)$(DOCDIR)
562 install_fips: install_sw
563 @$(ECHO) "*** Installing FIPS module configuration"
564 @$(ECHO) "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
565 @openssl fipsinstall -module $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME) \
566 -out $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf \
567 -macopt 'key:$(FIPSKEY)'
569 uninstall_fips: uninstall_sw
570 @$(ECHO) "*** Uninstalling FIPS module configuration"
571 @$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
572 @$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf
575 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
576 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
577 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
578 @set -e; for x in dummy $(MISC_SCRIPTS); do \
579 if [ "$$x" = "dummy" ]; then continue; fi; \
580 x1=`echo "$$x" | cut -f1 -d:`; \
581 x2=`echo "$$x" | cut -f2 -d:`; \
582 fn=`basename $$x1`; \
583 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
584 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
585 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
586 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
587 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
588 if [ "$$x1" != "$$x2" ]; then \
589 ln=`basename "$$x2"`; \
590 : {- output_off() unless windowsdll(); "" -}; \
591 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
592 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
593 : {- output_on() unless windowsdll();
594 output_off() if windowsdll(); "" -}; \
595 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
596 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
597 : {- output_on() if windowsdll(); "" -}; \
600 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
601 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
602 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
603 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
604 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
605 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
606 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
607 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
609 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
610 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
611 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
612 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
613 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
614 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
615 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
616 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
619 install_dev: install_runtime_libs
620 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
621 @$(ECHO) "*** Installing development files"
622 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
623 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
624 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
625 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
626 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
627 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
628 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
629 $(BLDDIR)/include/openssl/*.h; do \
631 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
632 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
633 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
635 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
636 @set -e; for l in $(INSTALL_LIBS); do \
638 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
639 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
640 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
641 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
642 mv -f $(DESTDIR)$(libdir)/$$fn.new \
643 $(DESTDIR)$(libdir)/$$fn; \
645 @ : {- output_off() if $disabled{shared}; "" -}
646 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
647 s1=`echo "$$s" | cut -f1 -d";"`; \
648 s2=`echo "$$s" | cut -f2 -d";"`; \
649 fn1=`basename $$s1`; \
650 fn2=`basename $$s2`; \
651 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
652 if [ "$$fn1" != "$$fn2" ]; then \
653 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
654 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
656 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
657 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
658 cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
659 chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
660 mv -f $(DESTDIR)$(libdir)/$$fn2.new \
661 $(DESTDIR)$(libdir)/$$fn2; \
662 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
663 a=$(DESTDIR)$(libdir)/$$fn2; \
664 $(ECHO) "install $$s1 -> $$a"; \
665 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
666 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
668 for so in `$(AR) t $$a`; do \
671 strip -X32_64 -e $$so; \
672 $(AR) r $$a.new $$so; \
675 $(AR) r $$a.new $$s1; \
677 : {- output_off() if sharedaix(); output_on(); "" -}; \
679 @ : {- output_on() if $disabled{shared}; "" -}
680 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
681 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
682 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
683 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
684 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
685 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
686 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
687 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
688 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
689 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
691 uninstall_dev: uninstall_runtime_libs
692 @$(ECHO) "*** Uninstalling development files"
693 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
694 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
695 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
696 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
697 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
698 $(BLDDIR)/include/openssl/*.h; do \
700 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
701 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
703 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
704 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
705 @set -e; for l in $(INSTALL_LIBS); do \
707 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
708 $(RM) $(DESTDIR)$(libdir)/$$fn; \
710 @ : {- output_off() if $disabled{shared}; "" -}
711 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
712 s1=`echo "$$s" | cut -f1 -d";"`; \
713 s2=`echo "$$s" | cut -f2 -d";"`; \
714 fn1=`basename $$s1`; \
715 fn2=`basename $$s2`; \
716 : {- output_off() if windowsdll(); "" -}; \
717 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
718 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
719 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
720 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
721 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
723 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
724 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
725 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
726 : {- output_on() unless windowsdll(); "" -}; \
728 @ : {- output_on() if $disabled{shared}; "" -}
729 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
730 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
731 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
732 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
733 -$(RMDIR) $(DESTDIR)$(libdir)
735 _install_modules_deps: install_runtime_libs build_modules
737 install_engines: _install_modules_deps
738 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
739 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
740 @$(ECHO) "*** Installing engines"
741 @set -e; for e in dummy $(INSTALL_ENGINES); do \
742 if [ "$$e" = "dummy" ]; then continue; fi; \
744 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
745 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
746 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
747 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
748 $(DESTDIR)$(ENGINESDIR)/$$fn; \
752 @$(ECHO) "*** Uninstalling engines"
753 @set -e; for e in dummy $(INSTALL_ENGINES); do \
754 if [ "$$e" = "dummy" ]; then continue; fi; \
756 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
757 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
759 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
761 install_modules: _install_modules_deps
762 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
763 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
764 @$(ECHO) "*** Installing modules"
765 @set -e; for e in dummy $(INSTALL_MODULES); do \
766 if [ "$$e" = "dummy" ]; then continue; fi; \
768 $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
769 cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \
770 chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \
771 mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \
772 $(DESTDIR)$(MODULESDIR)/$$fn; \
776 @$(ECHO) "*** Uninstalling modules"
777 @set -e; for e in dummy $(INSTALL_MODULES); do \
778 if [ "$$e" = "dummy" ]; then continue; fi; \
780 $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
781 $(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \
783 -$(RMDIR) $(DESTDIR)$(MODULESDIR)
785 install_runtime: install_programs
787 install_runtime_libs: build_libs
788 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
789 @ : {- output_off() if windowsdll(); "" -}
790 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
791 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
792 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
793 @ : {- output_on() unless windowsdll(); "" -}
794 @$(ECHO) "*** Installing runtime libraries"
795 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
796 if [ "$$s" = "dummy" ]; then continue; fi; \
798 : {- output_off() unless windowsdll(); "" -}; \
799 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
800 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
801 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
802 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
803 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
804 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
805 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
806 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
807 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
808 mv -f $(DESTDIR)$(libdir)/$$fn.new \
809 $(DESTDIR)$(libdir)/$$fn; \
810 : {- output_on() if windowsdll(); "" -}; \
813 install_programs: install_runtime_libs build_programs
814 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
815 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
816 @$(ECHO) "*** Installing runtime programs"
817 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
818 if [ "$$x" = "dummy" ]; then continue; fi; \
820 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
821 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
822 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
823 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
824 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
826 @set -e; for x in dummy $(BIN_SCRIPTS); do \
827 if [ "$$x" = "dummy" ]; then continue; fi; \
829 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
830 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
831 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
832 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
833 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
836 uninstall_runtime: uninstall_programs uninstall_runtime_libs
839 @$(ECHO) "*** Uninstalling runtime programs"
840 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
842 if [ "$$x" = "dummy" ]; then continue; fi; \
844 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
845 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
847 @set -e; for x in dummy $(BIN_SCRIPTS); \
849 if [ "$$x" = "dummy" ]; then continue; fi; \
851 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
852 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
854 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
856 uninstall_runtime_libs:
857 @$(ECHO) "*** Uninstalling runtime libraries"
858 @ : {- output_off() unless windowsdll(); "" -}
859 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
860 if [ "$$s" = "dummy" ]; then continue; fi; \
862 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
863 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
865 @ : {- output_on() unless windowsdll(); "" -}
868 install_man_docs: build_man_docs
869 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
870 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
871 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
872 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
873 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
874 @$(ECHO) "*** Installing manpages"
875 @set -e; for x in dummy $(MANDOCS1); do \
876 if [ "$$x" = "dummy" ]; then continue; fi; \
878 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
879 cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
880 chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
882 @set -e; for x in dummy $(MANDOCS3); do \
883 if [ "$$x" = "dummy" ]; then continue; fi; \
885 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
886 cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
887 chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
889 @set -e; for x in dummy $(MANDOCS5); do \
890 if [ "$$x" = "dummy" ]; then continue; fi; \
892 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
893 cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
894 chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
896 @set -e; for x in dummy $(MANDOCS7); do \
897 if [ "$$x" = "dummy" ]; then continue; fi; \
899 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
900 cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
901 chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
905 @$(ECHO) "*** Uninstalling manpages"
906 @set -e; for x in dummy $(MANDOCS1); do \
907 if [ "$$x" = "dummy" ]; then continue; fi; \
909 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
910 $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \
912 @set -e; for x in dummy $(MANDOCS3); do \
913 if [ "$$x" = "dummy" ]; then continue; fi; \
915 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
916 $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \
918 @set -e; for x in dummy $(MANDOCS5); do \
919 if [ "$$x" = "dummy" ]; then continue; fi; \
921 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
922 $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \
924 @set -e; for x in dummy $(MANDOCS7); do \
925 if [ "$$x" = "dummy" ]; then continue; fi; \
927 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
928 $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \
931 install_html_docs: build_html_docs
932 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
933 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
934 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
935 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
936 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
937 @$(ECHO) "*** Installing HTML manpages"
938 @set -e; for x in dummy $(HTMLDOCS1); do \
939 if [ "$$x" = "dummy" ]; then continue; fi; \
941 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
942 cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
943 chmod 644 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
945 @set -e; for x in dummy $(HTMLDOCS3); do \
946 if [ "$$x" = "dummy" ]; then continue; fi; \
948 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
949 cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
950 chmod 644 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
952 @set -e; for x in dummy $(HTMLDOCS5); do \
953 if [ "$$x" = "dummy" ]; then continue; fi; \
955 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
956 cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
957 chmod 644 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
959 @set -e; for x in dummy $(HTMLDOCS7); do \
960 if [ "$$x" = "dummy" ]; then continue; fi; \
962 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
963 cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
964 chmod 644 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
968 @$(ECHO) "*** Uninstalling HTML manpages"
969 @set -e; for x in dummy $(HTMLDOCS1); do \
970 if [ "$$x" = "dummy" ]; then continue; fi; \
972 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
973 $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
975 @set -e; for x in dummy $(HTMLDOCS3); do \
976 if [ "$$x" = "dummy" ]; then continue; fi; \
978 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
979 $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
981 @set -e; for x in dummy $(HTMLDOCS5); do \
982 if [ "$$x" = "dummy" ]; then continue; fi; \
984 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
985 $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
987 @set -e; for x in dummy $(HTMLDOCS7); do \
988 if [ "$$x" = "dummy" ]; then continue; fi; \
990 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
991 $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
994 # Developer targets (note: these are only available on Unix) #########
996 update: generate errors ordinals
998 generate: generate_apps generate_crypto_bn generate_crypto_objects \
999 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
1001 .PHONY: doc-nits cmd-nits md-nits
1002 doc-nits: build_generated
1003 $(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e
1005 cmd-nits: build_generated apps/openssl
1006 $(PERL) $(SRCDIR)/util/find-doc-nits -c
1008 # This uses "mdl", the markdownlint application, which is written in ruby.
1009 # The source is at https://github.com/markdownlint/markdownlint
1010 # If you have ruby installed, "gem install mdl" should work.
1011 # Another option is at https://snapcraft.io/install/mdl/debian
1012 # Finally, there's a Node.js version, which we haven't tried, that
1013 # can be found at https://github.com/DavidAnson/markdownlint
1015 mdl -s util/markdownlint.rb . NOTES-Windows.txt
1017 # Test coverage is a good idea for the future
1018 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
1022 lint -DLINT $(INCLUDES) $(SRCS)
1025 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
1026 < apps/openssl.cnf > apps/openssl-vms.cnf )
1029 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
1031 generate_crypto_objects:
1032 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
1033 crypto/objects/objects.txt \
1034 crypto/objects/obj_mac.num \
1035 > crypto/objects/obj_mac.new && \
1036 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
1037 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
1038 crypto/objects/objects.txt \
1039 crypto/objects/obj_mac.num \
1040 > include/openssl/obj_mac.h )
1041 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
1042 include/openssl/obj_mac.h \
1043 > crypto/objects/obj_dat.h )
1044 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
1045 crypto/objects/obj_mac.num \
1046 crypto/objects/obj_xref.txt \
1047 > crypto/objects/obj_xref.h )
1048 ( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
1050 generate_crypto_conf:
1051 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
1052 > crypto/conf/conf_def.h )
1054 generate_crypto_asn1:
1055 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
1056 > crypto/asn1/charmap.h )
1059 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
1060 crypto/objects/obj_dat.h \
1063 # Set to -force to force a rebuild
1066 ( b=`pwd`; set -e; cd $(SRCDIR); \
1067 $(PERL) util/ck_errf.pl -strict -internal; \
1068 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1069 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1070 for E in *.ec ; do \
1071 $(PERL) ../util/ck_errf.pl -strict \
1072 -conf $$E `basename $$E .ec`.c; \
1073 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1074 -conf $$E `basename $$E .ec`.c ; \
1077 {- use File::Basename;
1079 my @sslheaders_tmpl =
1080 qw( include/openssl/ssl.h
1081 include/openssl/ssl2.h
1082 include/openssl/ssl3.h
1083 include/openssl/sslerr.h
1084 include/openssl/tls1.h
1085 include/openssl/dtls1.h
1086 include/openssl/srtp.h );
1087 my @cryptoheaders_tmpl =
1088 qw( include/internal/dso.h
1089 include/internal/o_dir.h
1090 include/internal/err.h
1091 include/internal/evp.h
1092 include/internal/pem.h
1093 include/internal/asn1.h
1094 include/internal/sslconf.h );
1095 my @cryptoskipheaders = ( @sslheaders_tmpl,
1096 qw( include/openssl/conf_api.h
1097 include/openssl/ebcdic.h
1098 include/openssl/opensslconf.h
1099 include/openssl/symhacks.h ) );
1100 our %cryptoheaders = ();
1101 our %sslheaders = ();
1102 foreach my $d ( qw( include/openssl include/internal ) ) {
1103 my @header_patterns =
1104 map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
1105 foreach my $f ( map { glob($_) } @header_patterns ) {
1106 my $base = basename($f);
1107 my $base_in = basename($f, '.in');
1108 my $dir = catfile($config{sourcedir}, $d);
1109 if ($base ne $base_in) {
1110 # We have a .h.in file, which means the header file is in the
1113 $dir = catfile($config{builddir}, $d);
1115 my $new_f = catfile($dir, $base);
1116 my $fn = "$d/$base";
1117 # The logic to add files to @cryptoheaders is a bit complex. The
1118 # file to be added must be either in the public header directory
1119 # or one of the pre-declared internal headers, and must under no
1120 # circumstances be one of those that must be skipped.
1121 $cryptoheaders{$new_f} = 1
1122 if (($d eq 'include/openssl'
1123 || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
1124 && !( grep { $_ eq $fn } @cryptoskipheaders ));
1125 # The logic to add files to @sslheaders is much simpler...
1126 $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
1131 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1132 fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
1133 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1134 fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
1135 ordinals: build_generated
1136 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
1137 --ordinals $(SRCDIR)/util/libcrypto.num \
1138 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1140 $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
1141 --ordinals $(SRCDIR)/util/libssl.num \
1142 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
1147 SRCTOP=../$(SRCDIR) \
1148 BLDTOP=../$(BLDDIR) \
1149 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
1154 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1156 # Release targets (note: only available on Unix) #####################
1159 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1161 # Helper targets #####################################################
1163 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl
1165 $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm
1166 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1167 mkdir -p "$(BLDDIR)/util"; \
1168 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1173 # Building targets ###################################################
1175 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
1177 @ ( echo 'prefix=$(INSTALLTOP)'; \
1178 echo 'exec_prefix=$${prefix}'; \
1179 if [ -n "$(LIBDIR)" ]; then \
1180 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1182 echo 'libdir=$(libdir)'; \
1184 echo 'includedir=$${prefix}/include'; \
1185 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
1187 echo 'Name: OpenSSL-libcrypto'; \
1188 echo 'Description: OpenSSL cryptography library'; \
1189 echo 'Version: '$(VERSION); \
1190 echo 'Libs: -L$${libdir} -lcrypto'; \
1191 echo 'Libs.private: $(LIB_EX_LIBS)'; \
1192 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
1195 @ ( echo 'prefix=$(INSTALLTOP)'; \
1196 echo 'exec_prefix=$${prefix}'; \
1197 if [ -n "$(LIBDIR)" ]; then \
1198 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1200 echo 'libdir=$(libdir)'; \
1202 echo 'includedir=$${prefix}/include'; \
1204 echo 'Name: OpenSSL-libssl'; \
1205 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
1206 echo 'Version: '$(VERSION); \
1207 echo 'Requires.private: libcrypto'; \
1208 echo 'Libs: -L$${libdir} -lssl'; \
1209 echo 'Cflags: -I$${includedir}' ) > libssl.pc
1212 @ ( echo 'prefix=$(INSTALLTOP)'; \
1213 echo 'exec_prefix=$${prefix}'; \
1214 if [ -n "$(LIBDIR)" ]; then \
1215 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1217 echo 'libdir=$(libdir)'; \
1219 echo 'includedir=$${prefix}/include'; \
1221 echo 'Name: OpenSSL'; \
1222 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
1223 echo 'Version: '$(VERSION); \
1224 echo 'Requires: libssl libcrypto' ) > openssl.pc
1226 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1227 {- join(" \\\n" . ' ' x 15,
1228 fill_lines(" ", $COLUMNS - 15,
1229 @{$config{build_file_templates}},
1230 @{$config{build_infos}},
1231 @{$config{conf_files}})) -}
1232 @echo "Detected changed: $?"
1233 $(PERL) configdata.pm -r
1234 @echo "**************************************************"
1236 @echo "*** Please run the same make command again ***"
1238 @echo "**************************************************"
1242 $(PERL) configdata.pm -r
1246 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1248 # Helper function to figure out dependencies on libraries
1249 # It takes a list of library names and outputs a list of dependencies
1250 sub compute_lib_depends {
1251 # Depending on shared libraries:
1252 # On Windows POSIX layers, we depend on {libname}.dll.a
1253 # On Unix platforms, we depend on {shlibname}.so
1254 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
1259 my $generator = join(" ", @{$args{generator}});
1260 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1261 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1262 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1263 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
1265 if ($args{src} =~ /\.html$/) {
1266 my $title = basename($args{src}, ".html");
1267 my $pod = $args{generator}->[0];
1270 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1272 } elsif ($args{src} =~ /\.(\d)$/) {
1274 my $name = uc basename($args{src}, ".$section");
1275 my $pod = $args{generator}->[0];
1278 pod2man --name=$name --section=$section --center=OpenSSL \\
1279 --release=\$(VERSION) $pod >\$\@
1281 } elsif (platform->isdef($args{src})) {
1282 my $target = platform->def($args{src});
1283 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1284 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
1285 my $ord_name = $args{generator}->[1] || $args{product};
1287 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
1288 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
1290 } elsif (!platform->isasm($args{src})) {
1291 if ($args{generator}->[0] =~ m|^.*\.in$|) {
1292 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1293 "util", "dofile.pl")),
1294 rel2abs($config{builddir}));
1295 my @modules = ( 'configdata.pm',
1296 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1297 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
1298 @modules = map { "-M".basename($_, '.pm') } @modules;
1299 my $modules = join(' ', '', sort keys %moduleincs, @modules);
1301 $args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm
1302 \$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@
1306 $args{src}: $args{generator}->[0] $deps
1307 \$(PERL)$generator_incs $generator > \$@
1312 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1313 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1314 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1315 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1316 } -> {$args{intent}};
1318 if ($args{generator}->[0] =~ /\.pl$/) {
1319 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator
1320 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
1321 } elsif ($args{generator}->[0] =~ /\.m4$/) {
1322 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
1323 } elsif ($args{generator}->[0] =~ /\.S$/) {
1326 die "Generator type for $args{src} unknown: $generator\n";
1329 if (defined($generator)) {
1331 $args{src}: $args{generator}->[0] $deps
1336 $args{src}: $args{generator}->[0] $deps
1337 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
1338 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1343 # Should one wonder about the end of the Perl snippet, it's because this
1344 # second regexp eats up line endings as well, if the removed path is the
1345 # last in the line. We may therefore need to put back a line ending.
1348 my $obj = platform->convertext($args{obj});
1349 my $dep = platform->dep($args{obj});
1350 my @srcs = @{$args{srcs}};
1351 my $srcs = join(" ", @srcs);
1352 my $deps = join(" ", @srcs, @{$args{deps}});
1353 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1354 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1358 if (grep /\.rc$/, @srcs) {
1360 $cmdflags = '$(RCFLAGS)';
1362 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1364 $cmdcompile = ' -c';
1366 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1367 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1368 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1369 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1370 } -> {$args{intent}};
1373 $cmdcompile = ' -c';
1375 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1376 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1377 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1378 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1379 } -> {$args{intent}};
1382 # extension-specific rules
1383 if (grep /\.s$/, @srcs) {
1386 $cmd $cmdflags -c -o \$\@ $srcs
1388 } elsif (grep /\.S$/, @srcs) {
1389 # Originally there was mutli-step rule with $(CC) -E file.S
1390 # followed by $(CC) -c file.s. It compensated for one of
1391 # legacy platform compiler's inability to handle .S files.
1392 # The platform is long discontinued by vendor so there is
1393 # hardly a point to drag it along...
1396 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1398 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1399 && !grep /\.rc$/, @srcs) {
1402 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1404 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1407 mv $dep.tmp $dep; \\
1413 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1415 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1417 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1424 # We *know* this routine is only called when we've configure 'shared'.
1429 foreach (@{$args{deps}}) {
1430 if (platform->isstaticlib($_)) {
1431 push @linklibs, platform->convertext($_);
1433 my $d = "-L" . dirname($_);
1434 my $l = basename($_);
1438 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1441 my $linkflags = join("", map { $_." " } @linkdirs);
1442 my $linklibs = join("", map { $_." " } @linklibs);
1443 my @objs = map { platform->convertext($_) }
1444 grep { !platform->isdef($_) }
1446 my @defs = map { platform->def($_) }
1447 grep { platform->isdef($_) }
1449 my @deps = compute_lib_depends(@{$args{deps}});
1450 die "More than one exported symbol map" if scalar @defs > 1;
1452 my $simple = platform->sharedlib_simple($args{lib});
1453 my $full = platform->sharedlib($args{lib});
1454 my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
1455 my $shared_soname = "";
1456 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1457 if defined $target{shared_sonameflag};
1458 my $shared_imp = "";
1459 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1460 if defined $target{shared_impflag};
1461 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1463 # There is at least one platform where the compiler-as-linker needs to
1464 # have one object file directly on the command line. That won't hurt
1465 # any other platform, so we do that for everyone when there's an argfile
1466 # to be had. This depends heavily on splice, which removes elements from
1467 # the given array, and returns them so they can be captured.
1468 my @argfileobjs = $argfile
1471 my $argfilecmds = $argfile
1472 ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
1474 my $argfiledeps = $argfile
1475 ? join(" \\\n" . ' ' x (length($argfile) + 2),
1476 fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
1478 my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
1481 ($argfile ? $target{shared_argfileflag}.$argfile : ())
1484 join(" \\\n" . ' ' x (length($full) + 2),
1485 fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
1487 join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
1491 if ($simple ne $full) {
1496 \$(AR) r $simple $full
1508 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1509 -o $full$shared_def \\
1511 $linklibs \$(LIB_EX_LIBS)
1523 $recipe .= <<"EOF" if defined $argfile;
1524 $argfile: $argfiledeps
1532 my $dso = platform->dso($args{module});
1535 foreach (@{$args{deps}}) {
1536 next unless defined $_;
1537 if (platform->isstaticlib($_)) {
1538 push @linklibs, platform->convertext($_);
1540 my $d = "-L" . dirname($_);
1541 my $l = basename($_);
1545 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1548 my $linkflags = join("", map { $_." " } @linkdirs);
1549 my $linklibs = join("", map { $_." " } @linklibs);
1550 my @objs = map { platform->convertext($_) }
1551 grep { !platform->isdef($_) }
1553 my @defs = map { platform->def($_) }
1554 grep { platform->isdef($_) }
1556 my @deps = compute_lib_depends(@{$args{deps}});
1557 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1558 # TODO(3.0): next line needs to become "less magic" (see PR #11950)
1559 $shared_def .= ' '.$target{shared_fipsflag} if (m/providers\/fips/ && defined $target{shared_fipsflag});
1560 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1561 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1562 fill_lines(' ', $COLUMNS - length($dso) - 2,
1563 @objs, @defs, @deps));
1567 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1568 -o $dso$shared_def \\
1570 $linklibs\$(DSO_EX_LIBS)
1575 my $lib = platform->staticlib($args{lib});
1576 my @objs = map { platform->obj($_) } @{$args{objs}};
1577 my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
1578 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1579 my $max_per_call = 500;
1581 push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
1583 join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
1588 \$(RANLIB) \$\@ || echo Never mind.
1593 my $bin = platform->bin($args{bin});
1594 my @objs = map { platform->obj($_) } @{$args{objs}};
1595 my @deps = compute_lib_depends(@{$args{deps}});
1596 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1597 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1600 foreach (@{$args{deps}}) {
1601 next unless defined $_;
1602 if (platform->isstaticlib($_)) {
1603 push @linklibs, platform->convertext($_);
1605 my $d = "-L" . dirname($_);
1606 my $l = basename($_);
1610 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1613 my $linkflags = join("", map { $_." " } @linkdirs);
1614 my $linklibs = join("", map { $_." " } @linklibs);
1616 my $cmdflags = '$(BIN_CFLAGS)';
1617 if (grep /_cc\.o$/, @{$args{objs}}) {
1619 $cmdflags = '$(BIN_CXXFLAGS)';
1622 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1623 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1624 fill_lines(' ', $COLUMNS - length($bin) - 2,
1630 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1633 $linklibs\$(BIN_EX_LIBS)
1638 my $script = $args{script};
1639 my $sources = join(" ", @{$args{sources}});
1640 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1641 "util", "dofile.pl")),
1642 rel2abs($config{builddir}));
1645 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1646 "-o$target{build_file}" $sources > "$script"
1652 my $dir = $args{dir};
1653 my @deps = map { platform->convertext($_) } @{$args{deps}};
1655 my %extinfo = ( dso => platform->dsoext(),
1656 lib => platform->libext(),
1657 bin => platform->binext() );
1659 # We already have a 'test' target, and the top directory is just plain
1661 return if $dir eq "test" || $dir eq ".";
1663 foreach my $type (("dso", "lib", "bin", "script")) {
1664 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1665 # For lib object files, we could update the library. However, it
1666 # was decided that it's enough to build the directory local object
1667 # files, so we don't need to add any actions, and the dependencies
1668 # are already taken care of.
1669 if ($type ne "lib") {
1670 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1671 if (dirname($prod) eq $dir) {
1672 push @deps, $prod.$extinfo{$type};
1674 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1680 my $target = "$dir $dir/";
1681 my $deps = join(" \\\n\t",
1682 fill_lines(' ', $COLUMNS - 8, @deps));
1683 my $comments = join("\n", "", @comments);
1689 "" # Important! This becomes part of the template result.