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} -}
65 VERSION={- "$config{full_version}" -}
66 MAJOR={- $config{major} -}
67 MINOR={- $config{minor} -}
68 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
69 SHLIB_TARGET={- $target{shared_target} -}
71 LIBS={- join(" \\\n" . ' ' x 5,
72 fill_lines(" ", $COLUMNS - 5,
73 map { platform->staticlib($_) // () }
74 @{$unified_info{libraries}})) -}
75 SHLIBS={- join(" \\\n" . ' ' x 7,
76 fill_lines(" ", $COLUMNS - 7,
77 map { platform->sharedlib($_) // () }
78 @{$unified_info{libraries}})) -}
79 SHLIB_INFO={- join(" \\\n" . ' ' x 11,
80 fill_lines(" ", $COLUMNS - 11,
81 map { my $x = platform->sharedlib($_);
82 my $y = platform->sharedlib_simple($_);
83 $x ? "\"$x;$y\"" : () }
84 @{$unified_info{libraries}})) -}
85 MODULES={- join(" \\\n" . ' ' x 8,
86 fill_lines(" ", $COLUMNS - 8,
87 map { platform->dso($_) }
88 @{$unified_info{modules}})) -}
89 PROGRAMS={- join(" \\\n" . ' ' x 9,
90 fill_lines(" ", $COLUMNS - 9,
91 map { platform->bin($_) }
92 @{$unified_info{programs}})) -}
93 SCRIPTS={- join(" \\\n" . ' ' x 8,
94 fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
95 {- output_off() if $disabled{makedepend}; "" -}
96 DEPS={- join(" \\\n" . ' ' x 5,
97 fill_lines(" ", $COLUMNS - 5,
98 map { platform->isobj($_) ? platform->dep($_) : () }
99 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
100 keys %{$unified_info{sources}})); -}
101 {- output_on() if $disabled{makedepend}; "" -}
102 GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
103 fill_lines(" ", $COLUMNS - 20,
104 @{$unified_info{depends}->{""}})) -}
105 GENERATED={- # common0.tmpl provides @generated
106 join(" \\\n" . ' ' x 5,
107 fill_lines(" ", $COLUMNS - 5,
108 map { platform->convertext($_) } @generated )) -}
111 join(" \\\n" . ' ' x 13,
112 fill_lines(" ", $COLUMNS - 13,
113 map { platform->staticlib($_) // () }
114 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
115 @{$unified_info{libraries}}))
118 join(" \\\n" . ' ' x 15,
119 fill_lines(" ", $COLUMNS - 15,
120 map { platform->sharedlib($_) // () }
121 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
122 @{$unified_info{libraries}}))
124 INSTALL_SHLIB_INFO={-
125 join(" \\\n" . ' ' x 19,
126 fill_lines(" ", $COLUMNS - 19,
127 map { my $x = platform->sharedlib($_);
128 my $y = platform->sharedlib_simple($_);
129 $x ? "\"$x;$y\"" : () }
130 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
131 @{$unified_info{libraries}}))
134 join(" \\\n" . ' ' x 16,
135 fill_lines(" ", $COLUMNS - 16,
136 map { platform->dso($_) }
137 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
138 && $unified_info{attributes}->{modules}->{$_}->{engine} }
139 @{$unified_info{modules}}))
142 join(" \\\n" . ' ' x 16,
143 fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
144 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
145 @{$unified_info{programs}}))
148 join(" \\\n" . ' ' x 12,
149 fill_lines(" ", $COLUMNS - 12,
150 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
152 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
153 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
154 @{$unified_info{scripts}}))
157 join(" \\\n" . ' ' x 13,
158 fill_lines(" ", $COLUMNS - 13,
159 map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
161 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
162 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
163 @{$unified_info{scripts}}))
166 join(" \\\n" . ' ' x 10,
167 fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
168 @{$unified_info{htmldocs}->{man1}})) -}
170 join(" \\\n" . ' ' x 10,
171 fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
172 @{$unified_info{htmldocs}->{man3}})) -}
174 join(" \\\n" . ' ' x 10,
175 fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
176 @{$unified_info{htmldocs}->{man5}})) -}
178 join(" \\\n" . ' ' x 10,
179 fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
180 @{$unified_info{htmldocs}->{man7}})) -}
182 join(" \\\n" . ' ' x 9,
183 fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
184 @{$unified_info{mandocs}->{man1}})) -}
186 join(" \\\n" . ' ' x 9,
187 fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
188 @{$unified_info{mandocs}->{man3}})) -}
190 join(" \\\n" . ' ' x 9,
191 fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
192 @{$unified_info{mandocs}->{man5}})) -}
194 join(" \\\n" . ' ' x 9,
195 fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
196 @{$unified_info{mandocs}->{man7}})) -}
198 APPS_OPENSSL="{- use File::Spec::Functions;
199 catfile("apps","openssl") -}"
201 # DESTDIR is for package builders so that they can configure for, say,
202 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
203 # Normally it is left empty.
206 # Do not edit these manually. Use Configure with --prefix or --openssldir
207 # to change this! Short explanation in the top comment in Configure
208 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
210 our $prefix = $config{prefix} || "/usr/local";
213 # The logic here is that if no --openssldir was given,
214 # OPENSSLDIR will get the value from $prefix plus "/ssl".
215 # If --openssldir was given and the value is an absolute
216 # path, OPENSSLDIR will get its value without change.
217 # If the value from --openssldir is a relative path,
218 # OPENSSLDIR will get $prefix with the --openssldir
219 # value appended as a subdirectory.
221 use File::Spec::Functions;
223 $config{openssldir} ?
224 (file_name_is_absolute($config{openssldir}) ?
226 : catdir($prefix, $config{openssldir}))
227 : catdir($prefix, "ssl");
229 LIBDIR={- our $libdir = $config{libdir};
232 # if $prefix/lib$target{multilib} is not an existing
233 # directory, then assume that it's not searched by linker
234 # automatically, in which case adding $target{multilib} suffix
235 # causes more grief than we're ready to tolerate, so don't...
237 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
238 $libdir = "lib$multilib";
240 file_name_is_absolute($libdir) ? "" : $libdir -}
241 # $(libdir) is chosen to be compatible with the GNU coding standards
242 libdir={- file_name_is_absolute($libdir)
243 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
244 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
245 MODULESDIR=$(libdir)/ossl-modules
247 # Convenience variable for those who want to set the rpath in shared
248 # libraries and applications
251 MANDIR=$(INSTALLTOP)/share/man
252 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
253 HTMLDIR=$(DOCDIR)/html
255 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
256 # appended after the manpage file section number. "ssl" is popular,
257 # resulting in files such as config.5ssl rather than config.5.
261 # For "optional" echo messages, to get "real" silence
264 ##### User defined commands and flags ################################
266 # We let the C compiler driver to take care of .s files. This is done in
267 # order to be excused from maintaining a separate set of architecture
268 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
269 # gcc, then the driver will automatically translate it to -xarch=v8plus
270 # and pass it down to assembler. In any case, we do not define AS or
271 # ASFLAGS for this reason.
273 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
274 CC=$(CROSS_COMPILE){- $config{CC} -}
275 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
276 CPPFLAGS={- our $cppflags1 = join(" ",
277 (map { "-D".$_} @{$config{CPPDEFINES}}),
278 (map { "-I".$_} @{$config{CPPINCLUDES}}),
279 @{$config{CPPFLAGS}}) -}
280 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
281 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
282 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
283 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
285 MAKEDEPEND={- $config{makedepprog} -}
287 PERL={- $config{PERL} -}
289 AR=$(CROSS_COMPILE){- $config{AR} -}
290 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
291 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
292 RC= $(CROSS_COMPILE){- $config{RC} -}
293 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
297 TAR= {- $target{TAR} || "tar" -}
298 TARFLAGS= {- $target{TARFLAGS} -}
301 NAME= $(BASENAME)-$(VERSION)
302 # Relative to $(SRCDIR)
303 TARFILE= ../$(NAME).tar
305 ##### Project flags ##################################################
307 # Variables starting with CNF_ are common variables for all product types
309 CNF_CPPFLAGS={- our $cppflags2 =
310 join(' ', $target{cppflags} || (),
311 (map { "-D".$_} @{$target{defines}},
312 @{$config{defines}}),
313 (map { "-I".$_} @{$target{includes}},
314 @{$config{includes}}),
315 @{$config{cppflags}}) -}
316 CNF_CFLAGS={- join(' ', $target{cflags} || (),
317 @{$config{cflags}}) -}
318 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
319 @{$config{cxxflags}}) -}
320 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
321 @{$config{lflags}}) -}
322 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
323 @{$config{ex_libs}}) -}
325 # Variables starting with LIB_ are used to build library object files
326 # and shared libraries.
327 # Variables starting with DSO_ are used to build DSOs and their object files.
328 # Variables starting with BIN_ are used to build programs and their object
331 LIB_CPPFLAGS={- our $lib_cppflags =
332 join(' ', $target{lib_cppflags} || (),
333 $target{shared_cppflag} || (),
335 @{$target{lib_defines} || ()},
336 @{$target{shared_defines} || ()},
337 @{$config{lib_defines} || ()},
338 @{$config{shared_defines} || ()}),
339 (map { '-I'.quotify1($_) }
340 @{$target{lib_includes}},
341 @{$target{shared_includes}},
342 @{$config{lib_includes}},
343 @{$config{shared_includes}}),
344 @{$config{lib_cppflags}},
345 @{$config{shared_cppflag}});
346 join(' ', $lib_cppflags,
348 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
349 'ENGINESDIR="\"$(ENGINESDIR)\""',
350 'MODULESDIR="\"$(MODULESDIR)\""'),
351 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
352 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
353 $target{shared_cflag} || (),
354 @{$config{lib_cflags}},
355 @{$config{shared_cflag}},
356 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
357 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
358 $target{shared_cxxflag} || (),
359 @{$config{lib_cxxflags}},
360 @{$config{shared_cxxflag}},
361 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
362 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
363 $config{shared_ldflag} || (),
364 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
365 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
366 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
367 $target{module_cppflags} || (),
369 @{$target{dso_defines}},
370 @{$target{module_defines}},
371 @{$config{dso_defines} || ()},
372 @{$config{module_defines} || ()}),
373 (map { '-I'.quotify1($_) }
374 @{$target{dso_includes}},
375 @{$target{module_includes}},
376 @{$config{dso_includes}},
377 @{$config{module_includes}}),
378 @{$config{dso_cppflags}},
379 @{$config{module_cppflags}},
380 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
381 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
382 $target{module_cflags} || (),
383 @{$config{dso_cflags}},
384 @{$config{module_cflags}},
385 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
386 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
387 $target{module_cxxflags} || (),
388 @{$config{dso_cxxflags}},
389 @{$config{module_cxxflag}},
390 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
391 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
392 $target{module_ldflags} || (),
393 @{$config{dso_ldflags}},
394 @{$config{module_ldflags}},
395 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
396 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
397 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
398 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
399 @{$config{bin_cppflags}},
400 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
401 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
402 @{$config{bin_cflags}},
403 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
404 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
405 @{$config{bin_cxxflags}},
406 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
407 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
408 @{$config{bin_lflags}},
409 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
410 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
412 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
413 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
414 $cppflags2 =~ s|([\\"])|\\$1|g;
415 $lib_cppflags =~ s|([\\"])|\\$1|g;
416 join(' ', $lib_cppflags || (), $cppflags2 || (),
419 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
421 # For x86 assembler: Set PROCESSOR to 386 if you want to support
423 PROCESSOR= {- $config{processor} -}
425 # We want error [and other] messages in English. Trouble is that make(1)
426 # doesn't pass macros down as environment variables unless there already
427 # was corresponding variable originally set. In other words we can only
428 # reassign environment variables, but not set new ones, not in portable
429 # manner that is. That's why we reassign several, just to be sure...
434 # The main targets ###################################################
436 {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
437 {- dependmagic('build_libs'); -}: build_libs_nodep
438 {- dependmagic('build_modules'); -}: build_modules_nodep
439 {- dependmagic('build_programs'); -}: build_programs_nodep
441 build_docs: build_man_docs build_html_docs
442 build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
443 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
445 build_generated: $(GENERATED_MANDATORY)
446 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
447 build_modules_nodep: $(MODULES)
448 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
450 # Kept around for backward compatibility
451 build_apps build_tests: build_programs
453 # Convenience target to prebuild all generated files, not just the mandatory
455 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
456 @ : {- output_off() if $disabled{makedepend}; "" -}
457 @echo "Warning: consider configuring with no-makedepend, because if"
458 @echo " target system doesn't have $(PERL),"
459 @echo " then make will fail..."
460 @ : {- output_on() if $disabled{makedepend}; "" -}
462 all: build_sw build_docs
465 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
466 @ : {- output_off() if $disabled{tests}; "" -}
470 EXE_EXT={- platform->binext() -} \
471 $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
472 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
473 @echo "Tests are not supported with your chosen Configure options"
474 @ : {- output_on() if !$disabled{tests}; "" -}
477 @ : {- output_off() if $disabled{tests}; "" -}
478 @SRCTOP="$(SRCDIR)" \
479 $(PERL) $(SRCDIR)/test/run_tests.pl list
480 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
481 @echo "Tests are not supported with your chosen Configure options"
482 @ : {- output_on() if !$disabled{tests}; "" -}
484 install: install_sw install_ssldirs install_docs
486 uninstall: uninstall_docs uninstall_sw
489 @set -e; for s in $(SHLIB_INFO); do \
490 if [ "$$s" = ";" ]; then continue; fi; \
491 s1=`echo "$$s" | cut -f1 -d";"`; \
492 s2=`echo "$$s" | cut -f2 -d";"`; \
493 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
496 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
498 if [ "$$s1" != "$$s2" ]; then \
499 $(ECHO) $(RM) $$s2; \
504 $(RM) *{- platform->defext() -}
507 $(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
508 $(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
509 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
510 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
511 -$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
512 -$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -print`
514 $(RM) tags TAGS doc-nits cmd-nits
515 $(RM) -r test/test-runs
516 $(RM) openssl.pc libcrypto.pc libssl.pc
517 -$(RM) `find . -type l \! -name '.*' -print`
524 # We check if any depfile is newer than Makefile and decide to
525 # concatenate only if that is true.
527 @: {- output_off() if $disabled{makedepend}; "" -}
528 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
529 defined $makedepprog && $makedepprog =~ /\/makedepend/
530 ? 'makedepend' : 'gcc' -}
531 @: {- output_on() if $disabled{makedepend}; "" -}
533 # Install helper targets #############################################
535 install_sw: install_dev install_engines install_runtime
537 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
539 install_docs: install_man_docs install_html_docs
541 uninstall_docs: uninstall_man_docs uninstall_html_docs
542 $(RM) -r $(DESTDIR)$(DOCDIR)
545 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
546 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
547 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
548 @set -e; for x in dummy $(MISC_SCRIPTS); do \
549 if [ "$$x" = "dummy" ]; then continue; fi; \
550 x1=`echo "$$x" | cut -f1 -d:`; \
551 x2=`echo "$$x" | cut -f2 -d:`; \
552 fn=`basename $$x1`; \
553 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
554 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
555 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
556 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
557 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
558 if [ "$$x1" != "$$x2" ]; then \
559 ln=`basename "$$x2"`; \
560 : {- output_off() unless windowsdll(); "" -}; \
561 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
562 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
563 : {- output_on() unless windowsdll();
564 output_off() if windowsdll(); "" -}; \
565 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
566 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
567 : {- output_on() if windowsdll(); "" -}; \
570 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
571 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
572 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
573 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
574 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
575 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
576 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
577 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
579 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
580 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
581 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
582 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
583 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
584 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
585 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
586 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
589 install_dev: install_runtime_libs
590 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
591 @$(ECHO) "*** Installing development files"
592 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
593 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
594 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
595 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
596 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
597 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
598 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
599 $(BLDDIR)/include/openssl/*.h; do \
601 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
602 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
603 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
605 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
606 @set -e; for l in $(INSTALL_LIBS); do \
608 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
609 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
610 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
611 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
612 mv -f $(DESTDIR)$(libdir)/$$fn.new \
613 $(DESTDIR)$(libdir)/$$fn; \
615 @ : {- output_off() if $disabled{shared}; "" -}
616 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
617 s1=`echo "$$s" | cut -f1 -d";"`; \
618 s2=`echo "$$s" | cut -f2 -d";"`; \
619 fn1=`basename $$s1`; \
620 fn2=`basename $$s2`; \
621 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
622 if [ "$$fn1" != "$$fn2" ]; then \
623 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
624 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
626 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
627 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
628 cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
629 chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
630 mv -f $(DESTDIR)$(libdir)/$$fn2.new \
631 $(DESTDIR)$(libdir)/$$fn2; \
632 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
633 a=$(DESTDIR)$(libdir)/$$fn2; \
634 $(ECHO) "install $$s1 -> $$a"; \
635 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
636 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
638 for so in `$(AR) t $$a`; do \
641 strip -X32_64 -e $$so; \
642 $(AR) r $$a.new $$so; \
645 $(AR) r $$a.new $$s1; \
647 : {- output_off() if sharedaix(); output_on(); "" -}; \
649 @ : {- output_on() if $disabled{shared}; "" -}
650 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
651 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
652 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
653 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
654 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
655 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
656 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
657 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
658 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
659 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
661 uninstall_dev: uninstall_runtime_libs
662 @$(ECHO) "*** Uninstalling development files"
663 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
664 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
665 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
666 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
667 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
668 $(BLDDIR)/include/openssl/*.h; do \
670 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
671 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
673 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
674 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
675 @set -e; for l in $(INSTALL_LIBS); do \
677 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
678 $(RM) $(DESTDIR)$(libdir)/$$fn; \
680 @ : {- output_off() if $disabled{shared}; "" -}
681 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
682 s1=`echo "$$s" | cut -f1 -d";"`; \
683 s2=`echo "$$s" | cut -f2 -d";"`; \
684 fn1=`basename $$s1`; \
685 fn2=`basename $$s2`; \
686 : {- output_off() if windowsdll(); "" -}; \
687 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
688 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
689 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
690 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
691 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
693 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
694 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
695 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
696 : {- output_on() unless windowsdll(); "" -}; \
698 @ : {- output_on() if $disabled{shared}; "" -}
699 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
700 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
701 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
702 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
703 -$(RMDIR) $(DESTDIR)$(libdir)
705 install_engines: install_runtime_libs build_modules
706 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
707 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
708 @$(ECHO) "*** Installing ENGINE modules"
709 @set -e; for e in dummy $(INSTALL_ENGINES); do \
710 if [ "$$e" = "dummy" ]; then continue; fi; \
712 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
713 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
714 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
715 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
716 $(DESTDIR)$(ENGINESDIR)/$$fn; \
720 @$(ECHO) "*** Uninstalling ENGINE modules"
721 @set -e; for e in dummy $(INSTALL_ENGINES); do \
722 if [ "$$e" = "dummy" ]; then continue; fi; \
724 if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
727 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
728 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
730 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
732 install_runtime: install_programs
734 install_runtime_libs: build_libs
735 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
736 @ : {- output_off() if windowsdll(); "" -}
737 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
738 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
739 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
740 @ : {- output_on() unless windowsdll(); "" -}
741 @$(ECHO) "*** Installing runtime libraries"
742 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
743 if [ "$$s" = "dummy" ]; then continue; fi; \
745 : {- output_off() unless windowsdll(); "" -}; \
746 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
747 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
748 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
749 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
750 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
751 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
752 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
753 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
754 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
755 mv -f $(DESTDIR)$(libdir)/$$fn.new \
756 $(DESTDIR)$(libdir)/$$fn; \
757 : {- output_on() if windowsdll(); "" -}; \
760 install_programs: install_runtime_libs build_programs
761 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
762 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
763 @$(ECHO) "*** Installing runtime programs"
764 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
765 if [ "$$x" = "dummy" ]; then continue; fi; \
767 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
768 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
769 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
770 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
771 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
773 @set -e; for x in dummy $(BIN_SCRIPTS); do \
774 if [ "$$x" = "dummy" ]; then continue; fi; \
776 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
777 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
778 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
779 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
780 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
783 uninstall_runtime: uninstall_programs uninstall_runtime_libs
786 @$(ECHO) "*** Uninstalling runtime programs"
787 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
789 if [ "$$x" = "dummy" ]; then continue; fi; \
791 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
792 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
794 @set -e; for x in dummy $(BIN_SCRIPTS); \
796 if [ "$$x" = "dummy" ]; then continue; fi; \
798 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
799 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
801 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
803 uninstall_runtime_libs:
804 @$(ECHO) "*** Uninstalling runtime libraries"
805 @ : {- output_off() unless windowsdll(); "" -}
806 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
807 if [ "$$s" = "dummy" ]; then continue; fi; \
809 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
810 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
812 @ : {- output_on() unless windowsdll(); "" -}
815 install_man_docs: build_man_docs
816 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
817 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
818 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
819 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
820 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
821 @$(ECHO) "*** Installing manpages"
822 @set -e; for x in dummy $(MANDOCS1); do \
823 if [ "$$x" = "dummy" ]; then continue; fi; \
825 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$$fn"; \
826 cp $$x $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
827 chmod 755 $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
829 @set -e; for x in dummy $(MANDOCS3); do \
830 if [ "$$x" = "dummy" ]; then continue; fi; \
832 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$$fn"; \
833 cp $$x $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
834 chmod 755 $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
836 @set -e; for x in dummy $(MANDOCS5); do \
837 if [ "$$x" = "dummy" ]; then continue; fi; \
839 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$$fn"; \
840 cp $$x $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
841 chmod 755 $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
843 @set -e; for x in dummy $(MANDOCS7); do \
844 if [ "$$x" = "dummy" ]; then continue; fi; \
846 $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$$fn"; \
847 cp $$x $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
848 chmod 755 $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
852 @$(ECHO) "*** Uninstalling manpages"
853 @set -e; for x in dummy $(MANDOCS1); do \
854 if [ "$$x" = "dummy" ]; then continue; fi; \
856 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn"; \
857 $(RM) $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
859 @set -e; for x in dummy $(MANDOCS3); do \
860 if [ "$$x" = "dummy" ]; then continue; fi; \
862 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn"; \
863 $(RM) $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
865 @set -e; for x in dummy $(MANDOCS5); do \
866 if [ "$$x" = "dummy" ]; then continue; fi; \
868 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn"; \
869 $(RM) $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
871 @set -e; for x in dummy $(MANDOCS7); do \
872 if [ "$$x" = "dummy" ]; then continue; fi; \
874 $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn"; \
875 $(RM) $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
878 install_html_docs: build_html_docs
879 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
880 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
881 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
882 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
883 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
884 @$(ECHO) "*** Installing HTML manpages"
885 @set -e; for x in dummy $(HTMLDOCS1); do \
886 if [ "$$x" = "dummy" ]; then continue; fi; \
888 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
889 cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
890 chmod 755 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
892 @set -e; for x in dummy $(HTMLDOCS3); do \
893 if [ "$$x" = "dummy" ]; then continue; fi; \
895 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
896 cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
897 chmod 755 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
899 @set -e; for x in dummy $(HTMLDOCS5); do \
900 if [ "$$x" = "dummy" ]; then continue; fi; \
902 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
903 cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
904 chmod 755 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
906 @set -e; for x in dummy $(HTMLDOCS7); do \
907 if [ "$$x" = "dummy" ]; then continue; fi; \
909 $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
910 cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
911 chmod 755 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
915 @$(ECHO) "*** Uninstalling HTML manpages"
916 @set -e; for x in dummy $(HTMLDOCS1); do \
917 if [ "$$x" = "dummy" ]; then continue; fi; \
919 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
920 $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
922 @set -e; for x in dummy $(HTMLDOCS3); do \
923 if [ "$$x" = "dummy" ]; then continue; fi; \
925 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
926 $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
928 @set -e; for x in dummy $(HTMLDOCS5); do \
929 if [ "$$x" = "dummy" ]; then continue; fi; \
931 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
932 $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
934 @set -e; for x in dummy $(HTMLDOCS7); do \
935 if [ "$$x" = "dummy" ]; then continue; fi; \
937 $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
938 $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
941 # Developer targets (note: these are only available on Unix) #########
943 update: generate errors ordinals
945 generate: generate_apps generate_crypto_bn generate_crypto_objects \
946 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
948 .PHONY: doc-nits cmd-nits
949 doc-nits: build_generated
950 $(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e
952 cmd-nits: build_generated apps/openssl
953 $(PERL) $(SRCDIR)/util/find-doc-nits -c
955 # Test coverage is a good idea for the future
956 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
960 lint -DLINT $(INCLUDES) $(SRCS)
963 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
964 < apps/openssl.cnf > apps/openssl-vms.cnf )
967 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
969 generate_crypto_objects:
970 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
971 crypto/objects/objects.txt \
972 crypto/objects/obj_mac.num \
973 > crypto/objects/obj_mac.new && \
974 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
975 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
976 crypto/objects/objects.txt \
977 crypto/objects/obj_mac.num \
978 > include/openssl/obj_mac.h )
979 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
980 include/openssl/obj_mac.h \
981 > crypto/objects/obj_dat.h )
982 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
983 crypto/objects/obj_mac.num \
984 crypto/objects/obj_xref.txt \
985 > crypto/objects/obj_xref.h )
986 ( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
988 generate_crypto_conf:
989 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
990 > crypto/conf/conf_def.h )
992 generate_crypto_asn1:
993 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
994 > crypto/asn1/charmap.h )
997 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
998 crypto/objects/obj_dat.h \
1001 # Set to -force to force a rebuild
1004 ( b=`pwd`; set -e; cd $(SRCDIR); \
1005 $(PERL) util/ck_errf.pl -strict -internal; \
1006 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
1007 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
1008 for E in *.ec ; do \
1009 $(PERL) ../util/ck_errf.pl -strict \
1010 -conf $$E `basename $$E .ec`.c; \
1011 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
1012 -conf $$E `basename $$E .ec`.c ; \
1015 {- use File::Basename;
1018 qw( include/openssl/ssl.h
1019 include/openssl/ssl2.h
1020 include/openssl/ssl3.h
1021 include/openssl/sslerr.h
1022 include/openssl/tls1.h
1023 include/openssl/dtls1.h
1024 include/openssl/srtp.h );
1025 our @cryptoheaders =
1026 qw( include/internal/dso.h
1027 include/internal/o_dir.h
1028 include/internal/err.h
1029 include/internal/evp.h
1030 include/internal/sslconf.h );
1031 our @cryptoskipheaders = ( @sslheaders,
1032 qw( include/openssl/conf_api.h
1033 include/openssl/ebcdic.h
1034 include/openssl/opensslconf.h
1035 include/openssl/symhacks.h ) );
1036 foreach my $f ( glob(catfile($config{sourcedir},
1037 'include','openssl','*.h')) ) {
1038 my $fn = "include/openssl/" . basename($f);
1039 push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
1043 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
1044 fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
1045 SSLHEADERS={- join(" \\\n" . ' ' x 11,
1046 fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
1049 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
1050 --ordinals util/libcrypto.num \
1051 --symhacks include/openssl/symhacks.h \
1054 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
1055 --ordinals util/libssl.num \
1056 --symhacks include/openssl/symhacks.h \
1061 SRCTOP=../$(SRCDIR) \
1062 BLDTOP=../$(BLDDIR) \
1063 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
1068 -etags `find . -name '*.[ch]' -o -name '*.pm'`
1070 # Release targets (note: only available on Unix) #####################
1073 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
1075 # Helper targets #####################################################
1077 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl
1079 $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm
1080 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
1081 mkdir -p "$(BLDDIR)/util"; \
1082 ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
1087 # Building targets ###################################################
1089 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
1091 @ ( echo 'prefix=$(INSTALLTOP)'; \
1092 echo 'exec_prefix=$${prefix}'; \
1093 if [ -n "$(LIBDIR)" ]; then \
1094 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1096 echo 'libdir=$(libdir)'; \
1098 echo 'includedir=$${prefix}/include'; \
1099 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
1101 echo 'Name: OpenSSL-libcrypto'; \
1102 echo 'Description: OpenSSL cryptography library'; \
1103 echo 'Version: '$(VERSION); \
1104 echo 'Libs: -L$${libdir} -lcrypto'; \
1105 echo 'Libs.private: $(LIB_EX_LIBS)'; \
1106 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
1109 @ ( echo 'prefix=$(INSTALLTOP)'; \
1110 echo 'exec_prefix=$${prefix}'; \
1111 if [ -n "$(LIBDIR)" ]; then \
1112 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1114 echo 'libdir=$(libdir)'; \
1116 echo 'includedir=$${prefix}/include'; \
1118 echo 'Name: OpenSSL-libssl'; \
1119 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
1120 echo 'Version: '$(VERSION); \
1121 echo 'Requires.private: libcrypto'; \
1122 echo 'Libs: -L$${libdir} -lssl'; \
1123 echo 'Cflags: -I$${includedir}' ) > libssl.pc
1126 @ ( echo 'prefix=$(INSTALLTOP)'; \
1127 echo 'exec_prefix=$${prefix}'; \
1128 if [ -n "$(LIBDIR)" ]; then \
1129 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
1131 echo 'libdir=$(libdir)'; \
1133 echo 'includedir=$${prefix}/include'; \
1135 echo 'Name: OpenSSL'; \
1136 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
1137 echo 'Version: '$(VERSION); \
1138 echo 'Requires: libssl libcrypto' ) > openssl.pc
1140 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
1141 {- join(" \\\n" . ' ' x 15,
1142 fill_lines(" ", $COLUMNS - 15,
1143 @{$config{build_file_templates}},
1144 @{$config{build_infos}},
1145 @{$config{conf_files}})) -}
1146 @echo "Detected changed: $?"
1147 $(PERL) configdata.pm -r
1148 @echo "**************************************************"
1150 @echo "*** Please run the same make command again ***"
1152 @echo "**************************************************"
1156 $(PERL) configdata.pm -r
1160 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1162 # Helper function to figure out dependencies on libraries
1163 # It takes a list of library names and outputs a list of dependencies
1164 sub compute_lib_depends {
1165 # Depending on shared libraries:
1166 # On Windows POSIX layers, we depend on {libname}.dll.a
1167 # On Unix platforms, we depend on {shlibname}.so
1168 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
1173 my $generator = join(" ", @{$args{generator}});
1174 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1175 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1176 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1177 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
1179 if ($args{src} =~ /\.html$/) {
1180 my $title = basename($args{src}, ".html");
1181 my $pod = $args{generator}->[0];
1184 \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
1186 } elsif ($args{src} =~ /\.(\d)$/) {
1188 my $name = uc basename($args{src}, ".$section");
1189 my $pod = $args{generator}->[0];
1192 pod2man --name=$name --section=$section --center=OpenSSL \\
1193 --release=\$(VERSION) $pod >\$\@
1195 } elsif (platform->isdef($args{src})) {
1196 my $target = platform->def($args{src});
1197 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1198 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
1199 my $ord_name = $args{generator}->[1] || $args{product};
1201 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
1202 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
1204 } elsif (!platform->isasm($args{src})) {
1205 if ($args{generator}->[0] =~ m|^.*\.in$|) {
1206 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1207 "util", "dofile.pl")),
1208 rel2abs($config{builddir}));
1209 my @modules = ( 'configdata.pm',
1210 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1211 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
1212 @modules = map { "-M".basename($_, '.pm') } @modules;
1213 my $modules = join(' ', '', sort keys %moduleincs, @modules);
1215 $args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm
1216 \$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@
1220 $args{src}: $args{generator}->[0] $deps
1221 \$(PERL)$generator_incs $generator > \$@
1226 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1227 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1228 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1229 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1230 } -> {$args{intent}};
1232 if ($args{generator}->[0] =~ /\.pl$/) {
1233 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator
1234 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSSOR)';
1235 } elsif ($args{generator}->[0] =~ /\.m4$/) {
1236 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
1237 } elsif ($args{generator}->[0] =~ /\.S$/) {
1240 die "Generator type for $args{src} unknown: $generator\n";
1243 if (defined($generator)) {
1245 $args{src}: $args{generator}->[0] $deps
1250 $args{src}: $args{generator}->[0] $deps
1251 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
1252 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1257 # Should one wonder about the end of the Perl snippet, it's because this
1258 # second regexp eats up line endings as well, if the removed path is the
1259 # last in the line. We may therefore need to put back a line ending.
1262 my $obj = platform->convertext($args{obj});
1263 my $dep = platform->dep($args{obj});
1264 my @srcs = @{$args{srcs}};
1265 my $srcs = join(" ", @srcs);
1266 my $deps = join(" ", @srcs, @{$args{deps}});
1267 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1268 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1272 if (grep /\.rc$/, @srcs) {
1274 $cmdflags = '$(RCFLAGS)';
1276 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1278 $cmdcompile = ' -c';
1280 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1281 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1282 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1283 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1284 } -> {$args{intent}};
1287 $cmdcompile = ' -c';
1289 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1290 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1291 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1292 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1293 } -> {$args{intent}};
1296 # extension-specific rules
1297 if (grep /\.s$/, @srcs) {
1300 $cmd $cmdflags -c -o \$\@ $srcs
1302 } elsif (grep /\.S$/, @srcs) {
1303 # Originally there was mutli-step rule with $(CC) -E file.S
1304 # followed by $(CC) -c file.s. It compensated for one of
1305 # legacy platform compiler's inability to handle .S files.
1306 # The platform is long discontinued by vendor so there is
1307 # hardly a point to drag it along...
1310 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1312 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1313 && !grep /\.rc$/, @srcs) {
1316 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1318 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1321 mv $dep.tmp $dep; \\
1327 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1329 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1331 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1338 # We *know* this routine is only called when we've configure 'shared'.
1343 foreach (@{$args{deps}}) {
1344 if (platform->isstaticlib($_)) {
1345 push @linklibs, platform->convertext($_);
1347 my $d = "-L" . dirname($_);
1348 my $l = basename($_);
1352 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1355 my $linkflags = join("", map { $_." " } @linkdirs);
1356 my $linklibs = join("", map { $_." " } @linklibs);
1357 my @objs = map { platform->convertext($_) }
1358 grep { !platform->isdef($_) }
1360 my @defs = map { platform->def($_) }
1361 grep { platform->isdef($_) }
1363 my @deps = compute_lib_depends(@{$args{deps}});
1364 die "More than one exported symbol map" if scalar @defs > 1;
1366 my $simple = platform->sharedlib_simple($args{lib});
1367 my $full = platform->sharedlib($args{lib});
1368 my $shared_soname = "";
1369 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1370 if defined $target{shared_sonameflag};
1371 my $shared_imp = "";
1372 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1373 if defined $target{shared_impflag};
1374 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1376 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1377 my $deps = join(" \\\n" . ' ' x (length($full) + 2),
1378 fill_lines(' ', $COLUMNS - length($full) - 2,
1379 @objs, @defs, @deps));
1381 my $recipe = <<"EOF";
1387 \$(AR) r $simple $full
1389 } elsif ($simple ne $full) {
1397 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1398 -o $full$shared_def \\
1400 $linklibs \$(LIB_EX_LIBS)
1416 my $dso = platform->dso($args{module});
1419 foreach (@{$args{deps}}) {
1420 next unless defined $_;
1421 if (platform->isstaticlib($_)) {
1422 push @linklibs, platform->convertext($_);
1424 my $d = "-L" . dirname($_);
1425 my $l = basename($_);
1429 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1432 my $linkflags = join("", map { $_." " } @linkdirs);
1433 my $linklibs = join("", map { $_." " } @linklibs);
1434 my @objs = map { platform->convertext($_) }
1435 grep { !platform->isdef($_) }
1437 my @defs = map { platform->def($_) }
1438 grep { platform->isdef($_) }
1440 my @deps = compute_lib_depends(@{$args{deps}});
1441 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1443 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1444 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1445 fill_lines(' ', $COLUMNS - length($dso) - 2,
1446 @objs, @defs, @deps));
1450 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1451 -o $dso$shared_def \\
1453 $linklibs\$(DSO_EX_LIBS)
1458 my $lib = platform->staticlib($args{lib});
1459 my @objs = map { platform->obj($_) } @{$args{objs}};
1460 my $objs = join(" \\\n" . ' ' x (length($lib) + 2),
1461 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1464 \$(AR) \$(ARFLAGS) \$\@ \$\?
1465 \$(RANLIB) \$\@ || echo Never mind.
1470 my $bin = platform->bin($args{bin});
1471 my @objs = map { platform->obj($_) } @{$args{objs}};
1472 my @deps = compute_lib_depends(@{$args{deps}});
1473 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1474 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1477 foreach (@{$args{deps}}) {
1478 next unless defined $_;
1479 if (platform->isstaticlib($_)) {
1480 push @linklibs, platform->convertext($_);
1482 my $d = "-L" . dirname($_);
1483 my $l = basename($_);
1487 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1490 my $linkflags = join("", map { $_." " } @linkdirs);
1491 my $linklibs = join("", map { $_." " } @linklibs);
1493 my $cmdflags = '$(BIN_CFLAGS)';
1494 if (grep /_cc\.o$/, @{$args{objs}}) {
1496 $cmdflags = '$(BIN_CXXFLAGS)';
1499 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1500 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1501 fill_lines(' ', $COLUMNS - length($bin) - 2,
1507 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1510 $linklibs\$(BIN_EX_LIBS)
1515 my $script = $args{script};
1516 my $sources = join(" ", @{$args{sources}});
1517 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1518 "util", "dofile.pl")),
1519 rel2abs($config{builddir}));
1522 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1523 "-o$target{build_file}" $sources > "$script"
1529 my $dir = $args{dir};
1530 my @deps = map { platform->convertext($_) } @{$args{deps}};
1532 my %extinfo = ( dso => platform->dsoext(),
1533 lib => platform->libext(),
1534 bin => platform->binext() );
1536 # We already have a 'test' target, and the top directory is just plain
1538 return if $dir eq "test" || $dir eq ".";
1540 foreach my $type (("dso", "lib", "bin", "script")) {
1541 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1542 # For lib object files, we could update the library. However, it
1543 # was decided that it's enough to build the directory local object
1544 # files, so we don't need to add any actions, and the dependencies
1545 # are already taken care of.
1546 if ($type ne "lib") {
1547 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1548 if (dirname($prod) eq $dir) {
1549 push @deps, $prod.$extinfo{$type};
1551 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1557 my $target = "$dir $dir/";
1558 my $deps = join(" \\\n\t",
1559 fill_lines(' ', $COLUMNS - 8, @deps));
1560 my $comments = join("\n", "", @comments);
1566 "" # Important! This becomes part of the template result.