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 APPS_OPENSSL={- use File::Spec::Functions;
167 catfile("apps","openssl") -}
169 # DESTDIR is for package builders so that they can configure for, say,
170 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
171 # Normally it is left empty.
174 # Do not edit these manually. Use Configure with --prefix or --openssldir
175 # to change this! Short explanation in the top comment in Configure
176 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
178 our $prefix = $config{prefix} || "/usr/local";
181 # The logic here is that if no --openssldir was given,
182 # OPENSSLDIR will get the value from $prefix plus "/ssl".
183 # If --openssldir was given and the value is an absolute
184 # path, OPENSSLDIR will get its value without change.
185 # If the value from --openssldir is a relative path,
186 # OPENSSLDIR will get $prefix with the --openssldir
187 # value appended as a subdirectory.
189 use File::Spec::Functions;
191 $config{openssldir} ?
192 (file_name_is_absolute($config{openssldir}) ?
194 : catdir($prefix, $config{openssldir}))
195 : catdir($prefix, "ssl");
197 LIBDIR={- our $libdir = $config{libdir};
200 # if $prefix/lib$target{multilib} is not an existing
201 # directory, then assume that it's not searched by linker
202 # automatically, in which case adding $target{multilib} suffix
203 # causes more grief than we're ready to tolerate, so don't...
205 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
206 $libdir = "lib$multilib";
208 file_name_is_absolute($libdir) ? "" : $libdir -}
209 # $(libdir) is chosen to be compatible with the GNU coding standards
210 libdir={- file_name_is_absolute($libdir)
211 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
212 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
213 MODULESDIR=$(libdir)/ossl-modules
215 # Convenience variable for those who want to set the rpath in shared
216 # libraries and applications
219 MANDIR=$(INSTALLTOP)/share/man
220 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
221 HTMLDIR=$(DOCDIR)/html
223 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
224 # appended after the manpage file section number. "ssl" is popular,
225 # resulting in files such as config.5ssl rather than config.5.
229 # For "optional" echo messages, to get "real" silence
232 ##### User defined commands and flags ################################
234 # We let the C compiler driver to take care of .s files. This is done in
235 # order to be excused from maintaining a separate set of architecture
236 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
237 # gcc, then the driver will automatically translate it to -xarch=v8plus
238 # and pass it down to assembler. In any case, we do not define AS or
239 # ASFLAGS for this reason.
241 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
242 CC=$(CROSS_COMPILE){- $config{CC} -}
243 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
244 CPPFLAGS={- our $cppflags1 = join(" ",
245 (map { "-D".$_} @{$config{CPPDEFINES}}),
246 (map { "-I".$_} @{$config{CPPINCLUDES}}),
247 @{$config{CPPFLAGS}}) -}
248 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
249 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
250 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
251 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
253 MAKEDEPEND={- $config{makedepprog} -}
255 PERL={- $config{PERL} -}
257 AR=$(CROSS_COMPILE){- $config{AR} -}
258 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
259 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
260 RC= $(CROSS_COMPILE){- $config{RC} -}
261 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
265 TAR= {- $target{TAR} || "tar" -}
266 TARFLAGS= {- $target{TARFLAGS} -}
269 NAME= $(BASENAME)-$(VERSION)
270 # Relative to $(SRCDIR)
271 TARFILE= ../$(NAME).tar
273 ##### Project flags ##################################################
275 # Variables starting with CNF_ are common variables for all product types
277 CNF_CPPFLAGS={- our $cppflags2 =
278 join(' ', $target{cppflags} || (),
279 (map { "-D".$_} @{$target{defines}},
280 @{$config{defines}}),
281 (map { "-I".$_} @{$target{includes}},
282 @{$config{includes}}),
283 @{$config{cppflags}}) -}
284 CNF_CFLAGS={- join(' ', $target{cflags} || (),
285 @{$config{cflags}}) -}
286 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
287 @{$config{cxxflags}}) -}
288 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
289 @{$config{lflags}}) -}
290 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
291 @{$config{ex_libs}}) -}
293 # Variables starting with LIB_ are used to build library object files
294 # and shared libraries.
295 # Variables starting with DSO_ are used to build DSOs and their object files.
296 # Variables starting with BIN_ are used to build programs and their object
299 LIB_CPPFLAGS={- our $lib_cppflags =
300 join(' ', $target{lib_cppflags} || (),
301 $target{shared_cppflag} || (),
303 @{$config{lib_defines} || ()},
304 @{$config{shared_defines} || ()}),
305 @{$config{lib_cppflags}},
306 @{$config{shared_cppflag}});
307 join(' ', $lib_cppflags,
309 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
310 'ENGINESDIR="\"$(ENGINESDIR)\""',
311 'MODULESDIR="\"$(MODULESDIR)\""'),
312 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
313 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
314 $target{shared_cflag} || (),
315 @{$config{lib_cflags}},
316 @{$config{shared_cflag}},
317 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
318 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
319 $target{shared_cxxflag} || (),
320 @{$config{lib_cxxflags}},
321 @{$config{shared_cxxflag}},
322 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
323 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
324 $config{shared_ldflag} || (),
325 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
326 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
327 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
328 $target{module_cppflags} || (),
330 @{$config{dso_defines} || ()},
331 @{$config{module_defines} || ()}),
332 @{$config{dso_cppflags}},
333 @{$config{module_cppflags}},
334 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
335 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
336 $target{module_cflags} || (),
337 @{$config{dso_cflags}},
338 @{$config{module_cflags}},
339 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
340 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
341 $target{module_cxxflags} || (),
342 @{$config{dso_cxxflags}},
343 @{$config{module_cxxflag}},
344 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
345 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
346 $target{module_ldflags} || (),
347 @{$config{dso_ldflags}},
348 @{$config{module_ldflags}},
349 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
350 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
351 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
352 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
353 @{$config{bin_cppflags}},
354 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
355 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
356 @{$config{bin_cflags}},
357 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
358 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
359 @{$config{bin_cxxflags}},
360 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
361 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
362 @{$config{bin_lflags}},
363 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
364 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
366 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
367 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
368 $cppflags2 =~ s|([\\"])|\\$1|g;
369 $lib_cppflags =~ s|([\\"])|\\$1|g;
370 join(' ', $lib_cppflags || (), $cppflags2 || (),
373 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
375 # For x86 assembler: Set PROCESSOR to 386 if you want to support
377 PROCESSOR= {- $config{processor} -}
379 # We want error [and other] messages in English. Trouble is that make(1)
380 # doesn't pass macros down as environment variables unless there already
381 # was corresponding variable originally set. In other words we can only
382 # reassign environment variables, but not set new ones, not in portable
383 # manner that is. That's why we reassign several, just to be sure...
388 # The main targets ###################################################
390 {- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
391 {- dependmagic('build_libs'); -}: build_libs_nodep
392 {- dependmagic('build_modules'); -}: build_modules_nodep
393 {- dependmagic('build_programs'); -}: build_programs_nodep
395 build_generated: $(GENERATED_MANDATORY)
396 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
397 build_modules_nodep: $(MODULES)
398 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
400 # Kept around for backward compatibility
401 build_apps build_tests: build_programs
403 # Convenience target to prebuild all generated files, not just the mandatory
405 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
406 @ : {- output_off() if $disabled{makedepend}; "" -}
407 @echo "Warning: consider configuring with no-makedepend, because if"
408 @echo " target system doesn't have $(PERL),"
409 @echo " then make will fail..."
410 @ : {- output_on() if $disabled{makedepend}; "" -}
413 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
414 @ : {- output_off() if $disabled{tests}; "" -}
416 mkdir -p test-runs; \
417 SRCTOP=../$(SRCDIR) \
418 BLDTOP=../$(BLDDIR) \
421 EXE_EXT={- platform->binext() -} \
422 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \
423 OPENSSL_MODULES=`cd ../$(BLDDIR)/providers 2>/dev/null && pwd` \
424 OPENSSL_DEBUG_MEMORY=on \
425 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
426 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
427 @echo "Tests are not supported with your chosen Configure options"
428 @ : {- output_on() if !$disabled{tests}; "" -}
431 @ : {- output_off() if $disabled{tests}; "" -}
432 @SRCTOP="$(SRCDIR)" \
433 $(PERL) $(SRCDIR)/test/run_tests.pl list
434 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
435 @echo "Tests are not supported with your chosen Configure options"
436 @ : {- output_on() if !$disabled{tests}; "" -}
438 install: install_sw install_ssldirs install_docs
440 uninstall: uninstall_docs uninstall_sw
443 @set -e; for s in $(SHLIB_INFO); do \
444 if [ "$$s" = ";" ]; then continue; fi; \
445 s1=`echo "$$s" | cut -f1 -d";"`; \
446 s2=`echo "$$s" | cut -f2 -d";"`; \
447 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
450 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
452 if [ "$$s1" != "$$s2" ]; then \
453 $(ECHO) $(RM) $$s2; \
458 $(RM) *{- platform->defext() -}
461 $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
462 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
463 -$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
464 -$(RM) `find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -print`
466 $(RM) tags TAGS doc-nits
467 $(RM) -r test/test-runs
468 $(RM) openssl.pc libcrypto.pc libssl.pc
469 -$(RM) `find . -type l \! -name '.*' -print`
476 # We check if any depfile is newer than Makefile and decide to
477 # concatenate only if that is true.
479 @: {- output_off() if $disabled{makedepend}; "" -}
480 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
481 defined $makedepprog && $makedepprog =~ /\/makedepend/
482 ? 'makedepend' : 'gcc' -}
483 @: {- output_on() if $disabled{makedepend}; "" -}
485 # Install helper targets #############################################
487 install_sw: install_dev install_engines install_runtime
489 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
491 install_docs: install_man_docs install_html_docs
493 uninstall_docs: uninstall_man_docs uninstall_html_docs
494 $(RM) -r $(DESTDIR)$(DOCDIR)
497 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
498 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
499 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
500 @set -e; for x in dummy $(MISC_SCRIPTS); do \
501 if [ "$$x" = "dummy" ]; then continue; fi; \
502 x1=`echo "$$x" | cut -f1 -d:`; \
503 x2=`echo "$$x" | cut -f2 -d:`; \
504 fn=`basename $$x1`; \
505 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
506 cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
507 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
508 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
509 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
510 if [ "$$x1" != "$$x2" ]; then \
511 ln=`basename "$$x2"`; \
512 : {- output_off() unless windowsdll(); "" -}; \
513 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
514 cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
515 : {- output_on() unless windowsdll();
516 output_off() if windowsdll(); "" -}; \
517 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
518 ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
519 : {- output_on() if windowsdll(); "" -}; \
522 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
523 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
524 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
525 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
526 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
527 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
528 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
529 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
531 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
532 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
533 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
534 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
535 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
536 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
537 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
538 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
541 install_dev: install_runtime_libs
542 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
543 @$(ECHO) "*** Installing development files"
544 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
545 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
546 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
547 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
548 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
549 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
550 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
551 $(BLDDIR)/include/openssl/*.h; do \
553 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
554 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
555 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
557 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
558 @set -e; for l in $(INSTALL_LIBS); do \
560 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
561 cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
562 $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
563 chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
564 mv -f $(DESTDIR)$(libdir)/$$fn.new \
565 $(DESTDIR)$(libdir)/$$fn; \
567 @ : {- output_off() if $disabled{shared}; "" -}
568 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
569 s1=`echo "$$s" | cut -f1 -d";"`; \
570 s2=`echo "$$s" | cut -f2 -d";"`; \
571 fn1=`basename $$s1`; \
572 fn2=`basename $$s2`; \
573 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
574 if [ "$$fn1" != "$$fn2" ]; then \
575 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
576 ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
578 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
579 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
580 cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
581 chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
582 mv -f $(DESTDIR)$(libdir)/$$fn2.new \
583 $(DESTDIR)$(libdir)/$$fn2; \
584 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
585 a=$(DESTDIR)$(libdir)/$$fn2; \
586 $(ECHO) "install $$s1 -> $$a"; \
587 if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
588 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
590 for so in `$(AR) t $$a`; do \
593 strip -X32_64 -e $$so; \
594 $(AR) r $$a.new $$so; \
597 $(AR) r $$a.new $$s1; \
599 : {- output_off() if sharedaix(); output_on(); "" -}; \
601 @ : {- output_on() if $disabled{shared}; "" -}
602 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
603 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
604 @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
605 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
606 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
607 @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
608 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
609 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
610 @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
611 @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
613 uninstall_dev: uninstall_runtime_libs
614 @$(ECHO) "*** Uninstalling development files"
615 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
616 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
617 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
618 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
619 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
620 $(BLDDIR)/include/openssl/*.h; do \
622 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
623 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
625 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
626 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
627 @set -e; for l in $(INSTALL_LIBS); do \
629 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
630 $(RM) $(DESTDIR)$(libdir)/$$fn; \
632 @ : {- output_off() if $disabled{shared}; "" -}
633 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
634 s1=`echo "$$s" | cut -f1 -d";"`; \
635 s2=`echo "$$s" | cut -f2 -d";"`; \
636 fn1=`basename $$s1`; \
637 fn2=`basename $$s2`; \
638 : {- output_off() if windowsdll(); "" -}; \
639 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
640 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
641 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
642 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
643 $(RM) $(DESTDIR)$(libdir)/$$fn1; \
645 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
646 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
647 $(RM) $(DESTDIR)$(libdir)/$$fn2; \
648 : {- output_on() unless windowsdll(); "" -}; \
650 @ : {- output_on() if $disabled{shared}; "" -}
651 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
652 $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
653 $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
654 -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
655 -$(RMDIR) $(DESTDIR)$(libdir)
657 install_engines: install_runtime_libs build_modules
658 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
659 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
660 @$(ECHO) "*** Installing ENGINE modules"
661 @set -e; for e in dummy $(INSTALL_ENGINES); do \
662 if [ "$$e" = "dummy" ]; then continue; fi; \
664 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
665 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
666 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
667 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
668 $(DESTDIR)$(ENGINESDIR)/$$fn; \
672 @$(ECHO) "*** Uninstalling ENGINE modules"
673 @set -e; for e in dummy $(INSTALL_ENGINES); do \
674 if [ "$$e" = "dummy" ]; then continue; fi; \
676 if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
679 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
680 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
682 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
684 install_runtime: install_programs
686 install_runtime_libs: build_libs
687 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
688 @ : {- output_off() if windowsdll(); "" -}
689 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
690 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
691 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
692 @ : {- output_on() unless windowsdll(); "" -}
693 @$(ECHO) "*** Installing runtime libraries"
694 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
695 if [ "$$s" = "dummy" ]; then continue; fi; \
697 : {- output_off() unless windowsdll(); "" -}; \
698 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
699 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
700 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
701 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
702 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
703 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
704 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
705 cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
706 chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
707 mv -f $(DESTDIR)$(libdir)/$$fn.new \
708 $(DESTDIR)$(libdir)/$$fn; \
709 : {- output_on() if windowsdll(); "" -}; \
712 install_programs: install_runtime_libs build_programs
713 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
714 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
715 @$(ECHO) "*** Installing runtime programs"
716 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
717 if [ "$$x" = "dummy" ]; then continue; fi; \
719 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
720 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
721 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
722 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
723 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
725 @set -e; for x in dummy $(BIN_SCRIPTS); do \
726 if [ "$$x" = "dummy" ]; then continue; fi; \
728 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
729 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
730 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
731 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
732 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
735 uninstall_runtime: uninstall_programs uninstall_runtime_libs
738 @$(ECHO) "*** Uninstalling runtime programs"
739 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
741 if [ "$$x" = "dummy" ]; then continue; fi; \
743 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
744 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
746 @set -e; for x in dummy $(BIN_SCRIPTS); \
748 if [ "$$x" = "dummy" ]; then continue; fi; \
750 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
751 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
753 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
755 uninstall_runtime_libs:
756 @$(ECHO) "*** Uninstalling runtime libraries"
757 @ : {- output_off() unless windowsdll(); "" -}
758 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
759 if [ "$$s" = "dummy" ]; then continue; fi; \
761 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
762 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
764 @ : {- output_on() unless windowsdll(); "" -}
768 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
769 @$(ECHO) "*** Installing manpages"
770 $(PERL) $(SRCDIR)/util/process_docs.pl \
771 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
774 @$(ECHO) "*** Uninstalling manpages"
775 $(PERL) $(SRCDIR)/util/process_docs.pl \
776 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
780 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
781 @$(ECHO) "*** Installing HTML manpages"
782 $(PERL) $(SRCDIR)/util/process_docs.pl \
783 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
786 @$(ECHO) "*** Uninstalling manpages"
787 $(PERL) $(SRCDIR)/util/process_docs.pl \
788 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
791 # Developer targets (note: these are only available on Unix) #########
793 update: generate errors ordinals
795 generate: generate_apps generate_crypto_bn generate_crypto_objects \
796 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
799 doc-nits: build_generated
800 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -e )
802 # Test coverage is a good idea for the future
803 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
807 lint -DLINT $(INCLUDES) $(SRCS)
810 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
811 < apps/openssl.cnf > apps/openssl-vms.cnf )
812 @ : {- output_off() if $disabled{apps}; "" -}
813 ( b=`pwd`; cd $(SRCDIR); \
814 $(PERL) -I$$b apps/progs.pl -H $(APPS_OPENSSL) > apps/progs.h )
815 ( b=`pwd`; cd $(SRCDIR); \
816 $(PERL) -I$$b apps/progs.pl -C $(APPS_OPENSSL) > apps/progs.c )
817 @ : {- output_on() if $disabled{apps}; "" -}
820 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
822 generate_crypto_objects:
823 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
824 crypto/objects/objects.txt \
825 crypto/objects/obj_mac.num \
826 > crypto/objects/obj_mac.new && \
827 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
828 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
829 crypto/objects/objects.txt \
830 crypto/objects/obj_mac.num \
831 > include/openssl/obj_mac.h )
832 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
833 include/openssl/obj_mac.h \
834 > crypto/objects/obj_dat.h )
835 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
836 crypto/objects/obj_mac.num \
837 crypto/objects/obj_xref.txt \
838 > crypto/objects/obj_xref.h )
840 generate_crypto_conf:
841 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
842 > crypto/conf/conf_def.h )
844 generate_crypto_asn1:
845 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
846 > crypto/asn1/charmap.h )
849 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
850 crypto/objects/obj_dat.h \
853 # Set to -force to force a rebuild
856 ( b=`pwd`; set -e; cd $(SRCDIR); \
857 $(PERL) util/ck_errf.pl -strict -internal; \
858 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
859 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
861 $(PERL) ../util/ck_errf.pl -strict \
862 -conf $$E `basename $$E .ec`.c; \
863 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
864 -conf $$E `basename $$E .ec`.c ; \
867 {- use File::Basename;
870 qw( include/openssl/ssl.h
871 include/openssl/ssl2.h
872 include/openssl/ssl3.h
873 include/openssl/sslerr.h
874 include/openssl/tls1.h
875 include/openssl/dtls1.h
876 include/openssl/srtp.h );
878 qw( include/internal/dso.h
879 include/internal/o_dir.h
880 include/internal/err.h
881 include/internal/sslconf.h );
882 our @cryptoskipheaders = ( @sslheaders,
883 qw( include/openssl/conf_api.h
884 include/openssl/ebcdic.h
885 include/openssl/opensslconf.h
886 include/openssl/symhacks.h ) );
887 foreach my $f ( glob(catfile($config{sourcedir},
888 'include','openssl','*.h')) ) {
889 my $fn = "include/openssl/" . basename($f);
890 push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
894 CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
895 fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
896 SSLHEADERS={- join(" \\\n" . ' ' x 11,
897 fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
900 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
901 --ordinals util/libcrypto.num \
902 --symhacks include/openssl/symhacks.h \
905 $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
906 --ordinals util/libssl.num \
907 --symhacks include/openssl/symhacks.h \
912 SRCTOP=../$(SRCDIR) \
913 BLDTOP=../$(BLDDIR) \
914 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
919 -etags `find . -name '*.[ch]' -o -name '*.pm'`
921 # Release targets (note: only available on Unix) #####################
924 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
926 # Helper targets #####################################################
928 link-utils: $(BLDDIR)/util/opensslwrap.sh
930 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
931 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
932 mkdir -p "$(BLDDIR)/util"; \
933 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
938 # Building targets ###################################################
940 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
942 @ ( echo 'prefix=$(INSTALLTOP)'; \
943 echo 'exec_prefix=$${prefix}'; \
944 if [ -n "$(LIBDIR)" ]; then \
945 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
947 echo 'libdir=$(libdir)'; \
949 echo 'includedir=$${prefix}/include'; \
950 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
952 echo 'Name: OpenSSL-libcrypto'; \
953 echo 'Description: OpenSSL cryptography library'; \
954 echo 'Version: '$(VERSION); \
955 echo 'Libs: -L$${libdir} -lcrypto'; \
956 echo 'Libs.private: $(LIB_EX_LIBS)'; \
957 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
960 @ ( echo 'prefix=$(INSTALLTOP)'; \
961 echo 'exec_prefix=$${prefix}'; \
962 if [ -n "$(LIBDIR)" ]; then \
963 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
965 echo 'libdir=$(libdir)'; \
967 echo 'includedir=$${prefix}/include'; \
969 echo 'Name: OpenSSL-libssl'; \
970 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
971 echo 'Version: '$(VERSION); \
972 echo 'Requires.private: libcrypto'; \
973 echo 'Libs: -L$${libdir} -lssl'; \
974 echo 'Cflags: -I$${includedir}' ) > libssl.pc
977 @ ( echo 'prefix=$(INSTALLTOP)'; \
978 echo 'exec_prefix=$${prefix}'; \
979 if [ -n "$(LIBDIR)" ]; then \
980 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
982 echo 'libdir=$(libdir)'; \
984 echo 'includedir=$${prefix}/include'; \
986 echo 'Name: OpenSSL'; \
987 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
988 echo 'Version: '$(VERSION); \
989 echo 'Requires: libssl libcrypto' ) > openssl.pc
991 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
992 {- join(" \\\n" . ' ' x 15,
993 fill_lines(" ", $COLUMNS - 15,
994 @{$config{build_file_templates}},
995 @{$config{build_infos}},
996 @{$config{conf_files}})) -}
997 @echo "Detected changed: $?"
998 $(PERL) configdata.pm -r
999 @echo "**************************************************"
1001 @echo "*** Please run the same make command again ***"
1003 @echo "**************************************************"
1007 $(PERL) configdata.pm -r
1011 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1013 # Helper function to figure out dependencies on libraries
1014 # It takes a list of library names and outputs a list of dependencies
1015 sub compute_lib_depends {
1016 # Depending on shared libraries:
1017 # On Windows POSIX layers, we depend on {libname}.dll.a
1018 # On Unix platforms, we depend on {shlibname}.so
1019 return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
1024 my $generator = join(" ", @{$args{generator}});
1025 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1026 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1027 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1028 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
1030 if (platform->isdef($args{src})) {
1031 my $target = platform->def($args{src});
1032 (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
1033 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
1034 my $ord_name = $args{generator}->[1] || $args{product};
1036 $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
1037 \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
1039 } elsif (!platform->isasm($args{src})) {
1040 if ($args{generator}->[0] =~ m|^.*\.in$|) {
1041 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1042 "util", "dofile.pl")),
1043 rel2abs($config{builddir}));
1044 my @modules = ( 'configdata.pm',
1045 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1046 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
1047 @modules = map { "-M".basename($_, '.pm') } @modules;
1048 my $modules = join(' ', '', sort keys %moduleincs, @modules);
1050 $args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm
1051 \$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@
1055 $args{src}: $args{generator}->[0] $deps
1056 \$(PERL)$generator_incs $generator > \$@
1061 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1062 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1063 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1064 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1065 } -> {$args{intent}};
1067 if ($args{generator}->[0] =~ /\.pl$/) {
1068 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator
1069 .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSSOR)';
1070 } elsif ($args{generator}->[0] =~ /\.m4$/) {
1071 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
1072 } elsif ($args{generator}->[0] =~ /\.S$/) {
1075 die "Generator type for $args{src} unknown: $generator\n";
1078 if (defined($generator)) {
1080 $args{src}: $args{generator}->[0] $deps
1085 $args{src}: $args{generator}->[0] $deps
1086 \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
1087 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1092 # Should one wonder about the end of the Perl snippet, it's because this
1093 # second regexp eats up line endings as well, if the removed path is the
1094 # last in the line. We may therefore need to put back a line ending.
1097 my $obj = platform->convertext($args{obj});
1098 my $dep = platform->dep($args{obj});
1099 my @srcs = @{$args{srcs}};
1100 my $srcs = join(" ", @srcs);
1101 my $deps = join(" ", @srcs, @{$args{deps}});
1102 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1103 my $defs = join("", map { " -D".$_ } @{$args{defs}});
1107 if (grep /\.rc$/, @srcs) {
1109 $cmdflags = '$(RCFLAGS)';
1111 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1113 $cmdcompile = ' -c';
1115 shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1116 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1117 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1118 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1119 } -> {$args{intent}};
1122 $cmdcompile = ' -c';
1124 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1125 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1126 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1127 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1128 } -> {$args{intent}};
1131 # extension-specific rules
1132 if (grep /\.s$/, @srcs) {
1135 $cmd $cmdflags -c -o \$\@ $srcs
1137 } elsif (grep /\.S$/, @srcs) {
1138 # Originally there was mutli-step rule with $(CC) -E file.S
1139 # followed by $(CC) -c file.s. It compensated for one of
1140 # legacy platform compiler's inability to handle .S files.
1141 # The platform is long discontinued by vendor so there is
1142 # hardly a point to drag it along...
1145 $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
1147 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1148 && !grep /\.rc$/, @srcs) {
1151 $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
1153 \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
1156 mv $dep.tmp $dep; \\
1162 $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
1164 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1166 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1173 # We *know* this routine is only called when we've configure 'shared'.
1178 foreach (@{$args{deps}}) {
1179 if (platform->isstaticlib($_)) {
1180 push @linklibs, platform->convertext($_);
1182 my $d = "-L" . dirname($_);
1183 my $l = basename($_);
1187 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1190 my $linkflags = join("", map { $_." " } @linkdirs);
1191 my $linklibs = join("", map { $_." " } @linklibs);
1192 my @objs = map { platform->convertext($_) }
1193 grep { !platform->isdef($_) }
1195 my @defs = map { platform->def($_) }
1196 grep { platform->isdef($_) }
1198 my @deps = compute_lib_depends(@{$args{deps}});
1199 die "More than one exported symbol map" if scalar @defs > 1;
1201 my $simple = platform->sharedlib_simple($args{lib});
1202 my $full = platform->sharedlib($args{lib});
1203 my $shared_soname = "";
1204 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1205 if defined $target{shared_sonameflag};
1206 my $shared_imp = "";
1207 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1208 if defined $target{shared_impflag};
1209 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1211 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1212 my $deps = join(" \\\n" . ' ' x (length($full) + 2),
1213 fill_lines(' ', $COLUMNS - length($full) - 2,
1214 @objs, @defs, @deps));
1216 my $recipe = <<"EOF";
1222 \$(AR) r $simple $full
1224 } elsif ($simple ne $full) {
1232 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1233 -o $full$shared_def \\
1235 $linklibs \$(LIB_EX_LIBS)
1251 my $dso = platform->dso($args{module});
1254 foreach (@{$args{deps}}) {
1255 next unless defined $_;
1256 if (platform->isstaticlib($_)) {
1257 push @linklibs, platform->convertext($_);
1259 my $d = "-L" . dirname($_);
1260 my $l = basename($_);
1264 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1267 my $linkflags = join("", map { $_." " } @linkdirs);
1268 my $linklibs = join("", map { $_." " } @linklibs);
1269 my @objs = map { platform->convertext($_) }
1270 grep { !platform->isdef($_) }
1272 my @defs = map { platform->def($_) }
1273 grep { platform->isdef($_) }
1275 my @deps = compute_lib_depends(@{$args{deps}});
1276 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1278 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1279 my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
1280 fill_lines(' ', $COLUMNS - length($dso) - 2,
1281 @objs, @defs, @deps));
1285 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1286 -o $dso$shared_def \\
1288 $linklibs\$(DSO_EX_LIBS)
1293 my $lib = platform->staticlib($args{lib});
1294 my @objs = map { platform->obj($_) } @{$args{objs}};
1295 my $objs = join(" \\\n" . ' ' x (length($lib) + 2),
1296 fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
1299 \$(AR) \$(ARFLAGS) \$\@ \$\?
1300 \$(RANLIB) \$\@ || echo Never mind.
1305 my $bin = platform->bin($args{bin});
1306 my @objs = map { platform->obj($_) } @{$args{objs}};
1307 my @deps = compute_lib_depends(@{$args{deps}});
1308 my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
1309 fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
1312 foreach (@{$args{deps}}) {
1313 next unless defined $_;
1314 if (platform->isstaticlib($_)) {
1315 push @linklibs, platform->convertext($_);
1317 my $d = "-L" . dirname($_);
1318 my $l = basename($_);
1322 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1325 my $linkflags = join("", map { $_." " } @linkdirs);
1326 my $linklibs = join("", map { $_." " } @linklibs);
1328 my $cmdflags = '$(BIN_CFLAGS)';
1329 if (grep /_cc\.o$/, @{$args{objs}}) {
1331 $cmdflags = '$(BIN_CXXFLAGS)';
1334 my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
1335 my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
1336 fill_lines(' ', $COLUMNS - length($bin) - 2,
1342 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1345 $linklibs\$(BIN_EX_LIBS)
1350 my $script = $args{script};
1351 my $sources = join(" ", @{$args{sources}});
1352 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1353 "util", "dofile.pl")),
1354 rel2abs($config{builddir}));
1357 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1358 "-o$target{build_file}" $sources > "$script"
1364 my $dir = $args{dir};
1365 my @deps = map { platform->convertext($_) } @{$args{deps}};
1367 my %extinfo = ( dso => platform->dsoext(),
1368 lib => platform->libext(),
1369 bin => platform->binext() );
1371 # We already have a 'test' target, and the top directory is just plain
1373 return if $dir eq "test" || $dir eq ".";
1375 foreach my $type (("dso", "lib", "bin", "script")) {
1376 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1377 # For lib object files, we could update the library. However, it
1378 # was decided that it's enough to build the directory local object
1379 # files, so we don't need to add any actions, and the dependencies
1380 # are already taken care of.
1381 if ($type ne "lib") {
1382 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1383 if (dirname($prod) eq $dir) {
1384 push @deps, $prod.$extinfo{$type};
1386 push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1392 my $target = "$dir $dir/";
1393 my $deps = join(" \\\n\t",
1394 fill_lines(' ', $COLUMNS - 8, @deps));
1395 my $comments = join("\n", "", @comments);
1401 "" # Important! This becomes part of the template result.