2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 our $objext = $target{obj_extension} || ".o";
7 our $depext = $target{dep_extension} || ".d";
8 our $exeext = $target{exe_extension} || "";
9 our $libext = $target{lib_extension} || ".a";
10 our $shlibext = $target{shared_extension} || ".so";
11 our $shlibvariant = $target{shlib_variant} || "";
12 our $shlibextsimple = $target{shared_extension_simple} || ".so";
13 our $shlibextimport = $target{shared_import_extension} || "";
14 our $dsoext = $target{dso_extension} || ".so";
15 our $makedepprog = $disabled{makedepend} ? undef : $config{makedepprog};
17 # $mingw_installroot and $mingw_commonroot is relevant for mingw only.
18 my $build_scheme = $target{build_scheme};
19 my $install_flavour = $build_scheme->[$#$build_scheme]; # last element
20 my $mingw_installenv = $install_flavour eq "WOW" ? "ProgramFiles(x86)"
22 my $mingw_commonenv = $install_flavour eq "WOW" ? "CommonProgramFiles(x86)"
23 : "CommonProgramW6432";
24 our $mingw_installroot =
25 defined($ENV{$mingw_installenv}) ? $mingw_installenv : 'ProgramFiles';
26 our $mingw_commonroot =
27 defined($ENV{$mingw_commonenv}) ? $mingw_commonenv : 'CommonProgramFiles';
28 my $mingw_installdflt =
29 $install_flavour eq "WOW" ? "C:/Program Files (x86)"
31 my $mingw_commondflt = "$mingw_installdflt/Common Files";
33 # expand variables early
34 $mingw_installroot = $ENV{$mingw_installroot} // $mingw_installdflt;
35 $mingw_commonroot = $ENV{$mingw_commonroot} // $mingw_commondflt;
37 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
39 # Shared AIX support is special. We put libcrypto[64].so.ver into
40 # libcrypto.a and use libcrypto_a.a as static one.
41 sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
43 our $sover_dirname = $config{shlib_version_number};
44 $sover_dirname =~ s|\.|_|g
45 if $config{target} =~ /^mingw/;
47 # shlib and shlib_simple both take a static library name and figure
48 # out what the shlib name should be.
50 # When OpenSSL is configured "no-shared", these functions will just
51 # return empty lists, making them suitable to join().
53 # With Windows DLL producers, shlib($libname) will return the shared
54 # library name (which usually is different from the static library
55 # name) with the default shared extension appended to it, while
56 # shlib_simple($libname) will return the static library name with
57 # the shared extension followed by ".a" appended to it. The former
58 # result is used as the runtime shared library while the latter is
59 # used as the DLL import library.
61 # On all Unix systems, shlib($libname) will return the library name
62 # with the default shared extension, while shlib_simple($libname)
63 # will return the name from shlib($libname) with any SO version number
64 # removed. On some systems, they may therefore return the exact same
68 return () if $disabled{shared} || $lib =~ /\.a$/;
69 return $unified_info{sharednames}->{$lib}. $shlibvariant. '$(SHLIB_EXT)';
73 return () if $disabled{shared} || $lib =~ /\.a$/;
76 return $lib . '$(SHLIB_EXT_IMPORT)';
78 return $lib . '$(SHLIB_EXT_SIMPLE)';
81 # Easy fixing of static library names
83 (my $lib = shift) =~ s/\.a$//;
84 return $lib . $libext;
87 # dso is a complement to shlib / shlib_simple that returns the
88 # given libname with the simple shared extension (possible SO version
89 # removed). This differs from shlib_simple() by being unconditional.
93 return $engine . $dsoext;
95 # This makes sure things get built in the order they need
100 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
104 PLATFORM={- $config{target} -}
105 OPTIONS={- $config{options} -}
106 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
107 SRCDIR={- $config{sourcedir} -}
108 BLDDIR={- $config{builddir} -}
110 VERSION={- $config{version} -}
111 MAJOR={- $config{major} -}
112 MINOR={- $config{minor} -}
113 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
114 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
115 SHLIB_MAJOR={- $config{shlib_major} -}
116 SHLIB_MINOR={- $config{shlib_minor} -}
117 SHLIB_TARGET={- $target{shared_target} -}
118 SHLIB_EXT={- $shlibext -}
119 SHLIB_EXT_SIMPLE={- $shlibextsimple -}
120 SHLIB_EXT_IMPORT={- $shlibextimport -}
122 LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -}
123 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
124 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
125 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
126 PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
127 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
128 {- output_off() if $disabled{makedepend}; "" -}
129 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
130 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
131 keys %{$unified_info{sources}}); -}
132 {- output_on() if $disabled{makedepend}; "" -}
133 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -}
134 GENERATED={- # common0.tmpl provides @generated
135 join(" ", @generated ) -}
137 INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -}
138 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
139 INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -}
140 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
141 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -}
142 {- output_off() if $disabled{apps}; "" -}
143 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
144 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget.pl:tsget
145 {- output_on() if $disabled{apps}; "" -}
147 APPS_OPENSSL={- use File::Spec::Functions;
148 catfile("apps","openssl") -}
150 # DESTDIR is for package builders so that they can configure for, say,
151 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
152 # Normally it is left empty.
155 {- output_off() if $config{target} =~ /^mingw/; "" -}
156 # Do not edit these manually. Use Configure with --prefix or --openssldir
157 # to change this! Short explanation in the top comment in Configure
158 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
160 our $prefix = $config{prefix} || "/usr/local";
163 # The logic here is that if no --openssldir was given,
164 # OPENSSLDIR will get the value from $prefix plus "/ssl".
165 # If --openssldir was given and the value is an absolute
166 # path, OPENSSLDIR will get its value without change.
167 # If the value from --openssldir is a relative path,
168 # OPENSSLDIR will get $prefix with the --openssldir
169 # value appended as a subdirectory.
171 use File::Spec::Functions;
173 $config{openssldir} ?
174 (file_name_is_absolute($config{openssldir}) ?
176 : catdir($prefix, $config{openssldir}))
177 : catdir($prefix, "ssl");
179 LIBDIR={- our $libdir = $config{libdir};
182 # if $prefix/lib$target{multilib} is not an existing
183 # directory, then assume that it's not searched by linker
184 # automatically, in which case adding $target{multilib} suffix
185 # causes more grief than we're ready to tolerate, so don't...
187 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
188 $libdir = "lib$multilib";
190 file_name_is_absolute($libdir) ? "" : $libdir -}
191 # $(libdir) is chosen to be compatible with the GNU coding standards
192 libdir={- file_name_is_absolute($libdir)
193 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
194 ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
196 # Convenience variable for those who want to set the rpath in shared
197 # libraries and applications
199 {- output_on() if $config{target} =~ /^mingw/;
200 output_off() if $config{target} !~ /^mingw/;
202 # Do not edit these manually. Use Configure with --prefix or --openssldir
203 # to change this! Short explanation in the top comment in Configure
204 INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
206 use File::Spec::Win32;
207 my $prefix_default = "$mingw_installroot/OpenSSL";
209 File::Spec::Win32->canonpath($config{prefix}
211 our ($prefix_dev, $prefix_dir, $prefix_file) =
212 File::Spec::Win32->splitpath($prefix, 1);
214 $prefix_dir =~ s|\\|/|g;
216 INSTALLTOP_dir={- my $x = File::Spec::Win32->canonpath($prefix_dir);
220 # The logic here is that if no --openssldir was given,
221 # OPENSSLDIR will get the value "$mingw_commonroot/SSL".
222 # If --openssldir was given and the value is an absolute
223 # path, OPENSSLDIR will get its value without change.
224 # If the value from --openssldir is a relative path,
225 # OPENSSLDIR will get $prefix with the --openssldir
226 # value appended as a subdirectory.
228 use File::Spec::Win32;
230 $config{openssldir} ?
231 (File::Spec::Win32->file_name_is_absolute($config{openssldir}) ?
232 File::Spec::Win32->canonpath($config{openssldir})
233 : File::Spec::Win32->catdir($prefix, $config{openssldir}))
234 : File::Spec::Win32->canonpath("$mingw_commonroot/SSL");
235 our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
236 File::Spec::Win32->splitpath($openssldir, 1);
237 $openssldir =~ s|\\|/|g;
238 $openssldir_dir =~ s|\\|/|g;
240 OPENSSLDIR_dir={- my $x = File::Spec::Win32->canonpath($openssldir_dir);
243 LIBDIR={- our $libdir = $config{libdir} || "lib";
244 File::Spec::Win32->file_name_is_absolute($libdir) ? "" : $libdir -}
245 ENGINESDIR_dev={- use File::Spec::Win32;
247 File::Spec::Win32->catdir($prefix,$libdir,
248 "engines-$sover_dirname");
249 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
250 File::Spec::Win32->splitpath($enginesdir, 1);
251 $enginesdir =~ s|\\|/|g;
252 $enginesdir_dir =~ s|\\|/|g;
254 ENGINESDIR_dir={- my $x = File::Spec::Win32->canonpath($enginesdir_dir);
257 # In a Windows environment, $(DESTDIR) is harder to contatenate with other
258 # directory variables, because both may contain devices. What we do here is
259 # to adapt INSTALLTOP, OPENSSLDIR and ENGINESDIR depending on if $(DESTDIR)
260 # has a value or not, to ensure that concatenation will always work further
262 ifneq "$(DESTDIR)" ""
263 INSTALLTOP=$(INSTALLTOP_dir)
264 OPENSSLDIR=$(OPENSSLDIR_dir)
265 ENGINESDIR=$(ENGINESDIR_dir)
267 INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
268 OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
269 ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
272 # $(libdir) is chosen to be compatible with the GNU coding standards
273 libdir={- File::Spec::Win32->file_name_is_absolute($libdir)
274 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
275 {- output_on() if $config{target} !~ /^mingw/; "" -}
277 MANDIR=$(INSTALLTOP)/share/man
278 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
279 HTMLDIR=$(DOCDIR)/html
281 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
282 # appended after the manpage file section number. "ssl" is popular,
283 # resulting in files such as config.5ssl rather than config.5.
287 # For "optional" echo messages, to get "real" silence
290 ##### User defined commands and flags ################################
292 # We let the C compiler driver to take care of .s files. This is done in
293 # order to be excused from maintaining a separate set of architecture
294 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
295 # gcc, then the driver will automatically translate it to -xarch=v8plus
296 # and pass it down to assembler. In any case, we do not define AS or
297 # ASFLAGS for this reason.
299 CROSS_COMPILE={- $config{CROSS_COMPILE} -}
300 CC=$(CROSS_COMPILE){- $config{CC} -}
301 CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
302 CPPFLAGS={- our $cppflags1 = join(" ",
303 (map { "-D".$_} @{$config{CPPDEFINES}}),
304 (map { "-I".$_} @{$config{CPPINCLUDES}}),
305 @{$config{CPPFLAGS}}) -}
306 CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
307 CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
308 LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
309 EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
311 MAKEDEPEND={- $config{makedepprog} -}
313 PERL={- $config{PERL} -}
315 AR=$(CROSS_COMPILE){- $config{AR} -}
316 ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
317 RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
318 RC= $(CROSS_COMPILE){- $config{RC} -}
319 RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
323 TAR= {- $target{TAR} || "tar" -}
324 TARFLAGS= {- $target{TARFLAGS} -}
327 NAME= $(BASENAME)-$(VERSION)
328 # Relative to $(SRCDIR)
329 TARFILE= ../$(NAME).tar
331 ##### Project flags ##################################################
333 # Variables starting with CNF_ are common variables for all product types
335 CNF_CPPFLAGS={- our $cppflags2 =
336 join(' ', $target{cppflags} || (),
337 (map { "-D".$_} @{$target{defines}},
338 @{$config{defines}}),
339 (map { "-I".$_} @{$target{includes}},
340 @{$config{includes}}),
341 @{$config{cppflags}}) -}
342 CNF_CFLAGS={- join(' ', $target{cflags} || (),
343 @{$config{cflags}}) -}
344 CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
345 @{$config{cxxflags}}) -}
346 CNF_LDFLAGS={- join(' ', $target{lflags} || (),
347 @{$config{lflags}}) -}
348 CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
349 @{$config{ex_libs}}) -}
351 # Variables starting with LIB_ are used to build library object files
352 # and shared libraries.
353 # Variables starting with DSO_ are used to build DSOs and their object files.
354 # Variables starting with BIN_ are used to build programs and their object
357 LIB_CPPFLAGS={- our $lib_cppflags =
358 join(' ', $target{lib_cppflags} || (),
359 $target{shared_cppflag} || (),
361 @{$config{lib_defines} || ()},
362 @{$config{shared_defines} || ()}),
363 @{$config{lib_cppflags}},
364 @{$config{shared_cppflag}});
365 join(' ', $lib_cppflags,
367 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
368 'ENGINESDIR="\"$(ENGINESDIR)\""'),
369 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
370 LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
371 $target{shared_cflag} || (),
372 @{$config{lib_cflags}},
373 @{$config{shared_cflag}},
374 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
375 LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
376 $target{shared_cxxflag} || (),
377 @{$config{lib_cxxflags}},
378 @{$config{shared_cxxflag}},
379 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
380 LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
381 $config{shared_ldflag} || (),
382 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
383 LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
384 DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
385 $target{module_cppflags} || (),
387 @{$config{dso_defines} || ()},
388 @{$config{module_defines} || ()}),
389 @{$config{dso_cppflags}},
390 @{$config{module_cppflags}},
391 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
392 DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
393 $target{module_cflags} || (),
394 @{$config{dso_cflags}},
395 @{$config{module_cflags}},
396 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
397 DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
398 $target{module_cxxflags} || (),
399 @{$config{dso_cxxflags}},
400 @{$config{module_cxxflag}},
401 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
402 DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
403 $target{module_ldflags} || (),
404 @{$config{dso_ldflags}},
405 @{$config{module_ldflags}},
406 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
407 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
408 BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
409 (map { '-D'.$_ } @{$config{bin_defines} || ()}),
410 @{$config{bin_cppflags}},
411 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
412 BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
413 @{$config{bin_cflags}},
414 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
415 BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
416 @{$config{bin_cxxflags}},
417 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
418 BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
419 @{$config{bin_lflags}},
420 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
421 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
423 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
424 CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
425 $cppflags2 =~ s|([\\"])|\\$1|g;
426 $lib_cppflags =~ s|([\\"])|\\$1|g;
427 join(' ', $lib_cppflags || (), $cppflags2 || (),
430 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
432 # For x86 assembler: Set PROCESSOR to 386 if you want to support
434 PROCESSOR= {- $config{processor} -}
436 # We want error [and other] messages in English. Trouble is that make(1)
437 # doesn't pass macros down as environment variables unless there already
438 # was corresponding variable originally set. In other words we can only
439 # reassign environment variables, but not set new ones, not in portable
440 # manner that is. That's why we reassign several, just to be sure...
445 # The main targets ###################################################
447 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
448 {- dependmagic('build_libs'); -}: build_libs_nodep
449 {- dependmagic('build_engines'); -}: build_engines_nodep
450 {- dependmagic('build_programs'); -}: build_programs_nodep
452 build_generated: $(GENERATED_MANDATORY)
453 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
454 build_engines_nodep: $(ENGINES)
455 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
457 # Kept around for backward compatibility
458 build_apps build_tests: build_programs
460 # Convenience target to prebuild all generated files, not just the mandatory
462 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
463 @ : {- output_off() if $disabled{makedepend}; "" -}
464 @echo "Warning: consider configuring with no-makedepend, because if"
465 @echo " target system doesn't have $(PERL),"
466 @echo " then make will fail..."
467 @ : {- output_on() if $disabled{makedepend}; "" -}
470 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
471 @ : {- output_off() if $disabled{tests}; "" -}
473 mkdir -p test-runs; \
474 SRCTOP=../$(SRCDIR) \
475 BLDTOP=../$(BLDDIR) \
478 EXE_EXT={- $exeext -} \
479 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \
480 OPENSSL_DEBUG_MEMORY=on \
481 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
482 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
483 @echo "Tests are not supported with your chosen Configure options"
484 @ : {- output_on() if !$disabled{tests}; "" -}
487 @ : {- output_off() if $disabled{tests}; "" -}
488 @SRCTOP="$(SRCDIR)" \
489 $(PERL) $(SRCDIR)/test/run_tests.pl list
490 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
491 @echo "Tests are not supported with your chosen Configure options"
492 @ : {- output_on() if !$disabled{tests}; "" -}
494 install: install_sw install_ssldirs install_docs
496 uninstall: uninstall_docs uninstall_sw
499 @set -e; for s in $(SHLIB_INFO); do \
500 if [ "$$s" = ";" ]; then continue; fi; \
501 s1=`echo "$$s" | cut -f1 -d";"`; \
502 s2=`echo "$$s" | cut -f2 -d";"`; \
503 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
506 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
508 if [ "$$s1" != "$$s2" ]; then \
509 $(ECHO) $(RM) $$s2; \
517 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
518 $(RM) $(GENERATED_MANDATORY) $(GENERATED)
519 -$(RM) `find . -name '*{- $depext -}' \! -name '.*' \! -type d -print`
520 -$(RM) `find . -name '*{- $objext -}' \! -name '.*' \! -type d -print`
522 $(RM) tags TAGS doc-nits
523 $(RM) -r test/test-runs
524 $(RM) openssl.pc libcrypto.pc libssl.pc
525 -$(RM) `find . -type l \! -name '.*' -print`
531 # We check if any depfile is newer than Makefile and decide to
532 # concatenate only if that is true.
534 @: {- output_off() if $disabled{makedepend}; "" -}
535 @$(PERL) $(SRCDIR)/util/add-depends.pl {-
536 defined $makedepprog && $makedepprog =~ /\/makedepend/
537 ? 'makedepend' : 'gcc' -}
538 @: {- output_on() if $disabled{makedepend}; "" -}
540 # Install helper targets #############################################
542 install_sw: install_dev install_engines install_runtime
544 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
546 install_docs: install_man_docs install_html_docs
548 uninstall_docs: uninstall_man_docs uninstall_html_docs
549 $(RM) -r "$(DESTDIR)$(DOCDIR)"
552 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs"
553 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private"
554 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc"
555 @set -e; for x in dummy $(MISC_SCRIPTS); do \
556 if [ "$$x" = "dummy" ]; then continue; fi; \
557 x1=`echo "$$x" | cut -f1 -d:`; \
558 x2=`echo "$$x" | cut -f2 -d:`; \
559 fn=`basename $$x1`; \
560 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
561 cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
562 chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
563 mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \
564 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
565 if [ "$$x1" != "$$x2" ]; then \
566 ln=`basename "$$x2"`; \
567 : {- output_off() unless windowsdll(); "" -}; \
568 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
569 cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
570 : {- output_on() unless windowsdll();
571 output_off() if windowsdll(); "" -}; \
572 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
573 ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
574 : {- output_on() if windowsdll(); "" -}; \
577 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
578 @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
579 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
580 @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
581 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
582 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
583 cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
584 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
586 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
587 @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
588 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
589 @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
590 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
591 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
592 cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
593 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
596 install_dev: install_runtime_libs
597 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
598 @$(ECHO) "*** Installing development files"
599 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl"
600 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
601 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
602 @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
603 @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
604 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
605 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
606 $(BLDDIR)/include/openssl/*.h; do \
608 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
609 cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
610 chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
612 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
613 @set -e; for l in $(INSTALL_LIBS); do \
615 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
616 cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \
617 $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \
618 chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \
619 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
620 "$(DESTDIR)$(libdir)/$$fn"; \
622 @ : {- output_off() if $disabled{shared}; "" -}
623 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
624 s1=`echo "$$s" | cut -f1 -d";"`; \
625 s2=`echo "$$s" | cut -f2 -d";"`; \
626 fn1=`basename $$s1`; \
627 fn2=`basename $$s2`; \
628 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
629 if [ "$$fn1" != "$$fn2" ]; then \
630 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
631 ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \
633 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
634 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
635 cp $$s2 "$(DESTDIR)$(libdir)/$$fn2.new"; \
636 chmod 755 "$(DESTDIR)$(libdir)/$$fn2.new"; \
637 mv -f "$(DESTDIR)$(libdir)/$$fn2.new" \
638 "$(DESTDIR)$(libdir)/$$fn2"; \
639 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
640 a="$(DESTDIR)$(libdir)/$$fn2"; \
641 $(ECHO) "install $$s1 -> $$a"; \
642 if [ -f "$$a" ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
643 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
644 cp -f "$$a" "$$a.new"; \
645 for so in `$(AR) t "$$a"`; do \
646 $(AR) x "$$a" "$$so"; \
648 strip -X32_64 -e "$$so"; \
649 $(AR) r "$$a.new" "$$so"; \
652 $(AR) r "$$a.new" "$$s1"; \
653 mv -f "$$a.new" "$$a"; \
654 : {- output_off() if sharedaix(); output_on(); "" -}; \
656 @ : {- output_on() if $disabled{shared}; "" -}
657 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)/pkgconfig"
658 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
659 @cp libcrypto.pc "$(DESTDIR)$(libdir)/pkgconfig"
660 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
661 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
662 @cp libssl.pc "$(DESTDIR)$(libdir)/pkgconfig"
663 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
664 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
665 @cp openssl.pc "$(DESTDIR)$(libdir)/pkgconfig"
666 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
668 uninstall_dev: uninstall_runtime_libs
669 @$(ECHO) "*** Uninstalling development files"
670 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
671 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
672 @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
673 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
674 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
675 $(BLDDIR)/include/openssl/*.h; do \
677 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
678 $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
680 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl"
681 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include"
682 @set -e; for l in $(INSTALL_LIBS); do \
684 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
685 $(RM) "$(DESTDIR)$(libdir)/$$fn"; \
687 @ : {- output_off() if $disabled{shared}; "" -}
688 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
689 s1=`echo "$$s" | cut -f1 -d";"`; \
690 s2=`echo "$$s" | cut -f2 -d";"`; \
691 fn1=`basename $$s1`; \
692 fn2=`basename $$s2`; \
693 : {- output_off() if windowsdll(); "" -}; \
694 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
695 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \
696 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
697 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
698 $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \
700 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
701 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
702 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \
703 : {- output_on() unless windowsdll(); "" -}; \
705 @ : {- output_on() if $disabled{shared}; "" -}
706 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
707 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
708 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
709 -$(RMDIR) "$(DESTDIR)$(libdir)/pkgconfig"
710 -$(RMDIR) "$(DESTDIR)$(libdir)"
712 install_engines: install_runtime_libs build_engines
713 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
714 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/"
715 @$(ECHO) "*** Installing engines"
716 @set -e; for e in dummy $(INSTALL_ENGINES); do \
717 if [ "$$e" = "dummy" ]; then continue; fi; \
719 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
720 cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
721 chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
722 mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \
723 "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
727 @$(ECHO) "*** Uninstalling engines"
728 @set -e; for e in dummy $(INSTALL_ENGINES); do \
729 if [ "$$e" = "dummy" ]; then continue; fi; \
731 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
734 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
735 $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
737 -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)"
739 install_runtime: install_programs
741 install_runtime_libs: build_libs
742 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
743 @ : {- output_off() if windowsdll(); "" -}
744 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
745 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
746 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin"
747 @ : {- output_on() unless windowsdll(); "" -}
748 @$(ECHO) "*** Installing runtime libraries"
749 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
750 if [ "$$s" = "dummy" ]; then continue; fi; \
752 : {- output_off() unless windowsdll(); "" -}; \
753 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
754 cp $$s "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \
755 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \
756 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \
757 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
758 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
759 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
760 cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \
761 chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \
762 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
763 "$(DESTDIR)$(libdir)/$$fn"; \
764 : {- output_on() if windowsdll(); "" -}; \
767 install_programs: install_runtime_libs build_programs
768 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
769 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin"
770 @$(ECHO) "*** Installing runtime programs"
771 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
772 if [ "$$x" = "dummy" ]; then continue; fi; \
774 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
775 cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \
776 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \
777 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \
778 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
780 @set -e; for x in dummy $(BIN_SCRIPTS); do \
781 if [ "$$x" = "dummy" ]; then continue; fi; \
783 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
784 cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \
785 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \
786 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \
787 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
790 uninstall_runtime: uninstall_programs uninstall_runtime_libs
793 @$(ECHO) "*** Uninstalling runtime programs"
794 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
796 if [ "$$x" = "dummy" ]; then continue; fi; \
798 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
799 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
801 @set -e; for x in dummy $(BIN_SCRIPTS); \
803 if [ "$$x" = "dummy" ]; then continue; fi; \
805 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
806 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
808 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/bin"
810 uninstall_runtime_libs:
811 @$(ECHO) "*** Uninstalling runtime libraries"
812 @ : {- output_off() unless windowsdll(); "" -}
813 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
814 if [ "$$s" = "dummy" ]; then continue; fi; \
816 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
817 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
819 @ : {- output_on() unless windowsdll(); "" -}
823 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
824 @$(ECHO) "*** Installing manpages"
825 $(PERL) $(SRCDIR)/util/process_docs.pl \
826 "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX)
829 @$(ECHO) "*** Uninstalling manpages"
830 $(PERL) $(SRCDIR)/util/process_docs.pl \
831 "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) \
835 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
836 @$(ECHO) "*** Installing HTML manpages"
837 $(PERL) $(SRCDIR)/util/process_docs.pl \
838 "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html
841 @$(ECHO) "*** Uninstalling manpages"
842 $(PERL) $(SRCDIR)/util/process_docs.pl \
843 "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html --remove
846 # Developer targets (note: these are only available on Unix) #########
848 update: generate errors ordinals
850 generate: generate_apps generate_crypto_bn generate_crypto_objects \
851 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
855 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
856 @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \
857 else echo 'doc-nits: no errors.'; rm doc-nits ; fi
859 # Test coverage is a good idea for the future
860 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
864 lint -DLINT $(INCLUDES) $(SRCS)
867 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
868 < apps/openssl.cnf > apps/openssl-vms.cnf )
871 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
873 generate_crypto_objects:
874 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
875 crypto/objects/objects.txt \
876 crypto/objects/obj_mac.num \
877 > crypto/objects/obj_mac.new && \
878 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
879 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
880 crypto/objects/objects.txt \
881 crypto/objects/obj_mac.num \
882 > include/openssl/obj_mac.h )
883 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
884 include/openssl/obj_mac.h \
885 > crypto/objects/obj_dat.h )
886 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
887 crypto/objects/obj_mac.num \
888 crypto/objects/obj_xref.txt \
889 > crypto/objects/obj_xref.h )
891 generate_crypto_conf:
892 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
893 > crypto/conf/conf_def.h )
895 generate_crypto_asn1:
896 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
897 > crypto/asn1/charmap.h )
900 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
901 crypto/objects/obj_dat.h \
904 # Set to -force to force a rebuild
907 ( b=`pwd`; set -e; cd $(SRCDIR); \
908 $(PERL) util/ck_errf.pl -strict -internal; \
909 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
910 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
912 $(PERL) ../util/ck_errf.pl -strict \
913 -conf $$E `basename $$E .ec`.c; \
914 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
915 -conf $$E `basename $$E .ec`.c ; \
919 $(PERL) $(SRCDIR)/util/mkdef.pl crypto update
920 $(PERL) $(SRCDIR)/util/mkdef.pl ssl update
924 SRCTOP=../$(SRCDIR) \
925 BLDTOP=../$(BLDDIR) \
926 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
931 -etags `find . -name '*.[ch]' -o -name '*.pm'`
933 # Release targets (note: only available on Unix) #####################
936 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
938 # Helper targets #####################################################
940 link-utils: $(BLDDIR)/util/opensslwrap.sh
942 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
943 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
944 mkdir -p "$(BLDDIR)/util"; \
945 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
950 # Building targets ###################################################
952 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
954 @ ( echo 'prefix=$(INSTALLTOP)'; \
955 echo 'exec_prefix=$${prefix}'; \
956 if [ -n "$(LIBDIR)" ]; then \
957 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
959 echo 'libdir=$(libdir)'; \
961 echo 'includedir=$${prefix}/include'; \
962 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
964 echo 'Name: OpenSSL-libcrypto'; \
965 echo 'Description: OpenSSL cryptography library'; \
966 echo 'Version: '$(VERSION); \
967 echo 'Libs: -L$${libdir} -lcrypto'; \
968 echo 'Libs.private: $(LIB_EX_LIBS)'; \
969 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
972 @ ( echo 'prefix=$(INSTALLTOP)'; \
973 echo 'exec_prefix=$${prefix}'; \
974 if [ -n "$(LIBDIR)" ]; then \
975 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
977 echo 'libdir=$(libdir)'; \
979 echo 'includedir=$${prefix}/include'; \
981 echo 'Name: OpenSSL-libssl'; \
982 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
983 echo 'Version: '$(VERSION); \
984 echo 'Requires.private: libcrypto'; \
985 echo 'Libs: -L$${libdir} -lssl'; \
986 echo 'Cflags: -I$${includedir}' ) > libssl.pc
989 @ ( echo 'prefix=$(INSTALLTOP)'; \
990 echo 'exec_prefix=$${prefix}'; \
991 if [ -n "$(LIBDIR)" ]; then \
992 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
994 echo 'libdir=$(libdir)'; \
996 echo 'includedir=$${prefix}/include'; \
998 echo 'Name: OpenSSL'; \
999 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
1000 echo 'Version: '$(VERSION); \
1001 echo 'Requires: libssl libcrypto' ) > openssl.pc
1003 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
1004 @echo "Detected changed: $?"
1005 $(PERL) configdata.pm -r
1006 @echo "**************************************************"
1008 @echo "*** Please run the same make command again ***"
1010 @echo "**************************************************"
1014 $(PERL) configdata.pm -r
1018 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
1020 # Helper function to figure out dependencies on libraries
1021 # It takes a list of library names and outputs a list of dependencies
1022 sub compute_lib_depends {
1023 if ($disabled{shared}) {
1024 return map { lib($_) } @_;
1027 # Depending on shared libraries:
1028 # On Windows POSIX layers, we depend on {libname}.dll.a
1029 # On Unix platforms, we depend on {shlibname}.so
1030 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_;
1035 my $generator = join(" ", @{$args{generator}});
1036 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
1037 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1038 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
1040 if ($args{src} !~ /\.[sS]$/) {
1041 if ($args{generator}->[0] =~ m|^.*\.in$|) {
1042 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1043 "util", "dofile.pl")),
1044 rel2abs($config{builddir}));
1046 $args{src}: $args{generator}->[0] $deps
1047 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1048 "-o$target{build_file}" $generator > \$@
1052 $args{src}: $args{generator}->[0] $deps
1053 \$(PERL)$generator_incs $generator > \$@
1057 if ($args{generator}->[0] =~ /\.pl$/) {
1058 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
1059 } elsif ($args{generator}->[0] =~ /\.m4$/) {
1060 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
1061 } elsif ($args{generator}->[0] =~ /\.S$/) {
1064 die "Generator type for $args{src} unknown: $generator\n";
1068 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1069 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1070 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1071 } -> {$args{intent}};
1072 if (defined($generator)) {
1074 $args{src}: $args{generator}->[0] $deps
1079 $args{src}: $args{generator}->[0] $deps
1080 \$(CC) $incs $cppflags -E $args{generator}->[0] | \\
1081 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
1086 # Should one wonder about the end of the Perl snippet, it's because this
1087 # second regexp eats up line endings as well, if the removed path is the
1088 # last in the line. We may therefore need to put back a line ending.
1091 (my $obj = $args{obj}) =~ s|\.o$||;
1092 my @srcs = @{$args{srcs}};
1093 my $srcs = join(" ", @srcs);
1094 my $deps = join(" ", @srcs, @{$args{deps}});
1095 my $incs = join("", map { " -I".$_ } @{$args{incs}});
1099 if (grep /\.rc$/, @srcs) {
1101 $cmdflags = '$(RCFLAGS)';
1103 } elsif (grep /\.(cc|cpp)$/, @srcs) {
1105 $cmdcompile = ' -c';
1107 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
1108 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
1109 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
1110 } -> {$args{intent}};
1113 $cmdcompile = ' -c';
1115 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
1116 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
1117 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
1118 } -> {$args{intent}};
1121 # extension-specific rules
1122 if (grep /\.s$/, @srcs) {
1125 $cmd $cmdflags -c -o \$\@ $srcs
1127 } elsif (grep /\.S$/, @srcs) {
1128 # Originally there was mutli-step rule with $(CC) -E file.S
1129 # followed by $(CC) -c file.s. It compensated for one of
1130 # legacy platform compiler's inability to handle .S files.
1131 # The platform is long discontinued by vendor so there is
1132 # hardly a point to drag it along...
1135 $cmd $incs $cmdflags -c -o \$\@ $srcs
1137 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
1138 && !grep /\.rc$/, @srcs) {
1141 $cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
1142 \@touch $obj$depext.tmp
1143 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
1144 rm -f $obj$depext.tmp; \\
1146 mv $obj$depext.tmp $obj$depext; \\
1152 $cmd $incs $cmdflags $cmdcompile -o \$\@ $srcs
1154 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
1156 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
1163 # We *know* this routine is only called when we've configure 'shared'.
1166 my $lib = $args{lib};
1167 my $shlib = $args{shlib};
1168 my $libd = dirname($lib);
1169 my $libn = basename($lib);
1170 (my $libname = $libn) =~ s/^lib//;
1172 foreach (@{args{deps}}) {
1173 my $d = dirname($_);
1174 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1176 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1177 my $linklibs = join("", map { my $f = basename($_);
1178 (my $l = $f) =~ s/^lib//;
1179 " -l$l" } @{$args{deps}});
1180 my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" }
1181 grep { $_ !~ m/\.(?:def|map)$/ }
1183 my @defs = grep { $_ =~ /\.(?:def|map)$/ } @{$args{objs}};
1184 my @deps = compute_lib_depends(@{$args{deps}});
1185 die "More than one exported symbol map" if scalar @defs > 1;
1186 my $objs = join(" ", @objs);
1187 my $deps = join(" ", @objs, @defs, @deps);
1188 my $simple = shlib_simple($lib);
1189 my $full = shlib($lib);
1190 my $target = "$simple $full";
1191 my $shared_soname = "";
1192 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
1193 if defined $target{shared_sonameflag};
1194 my $shared_imp = "";
1195 $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
1196 if defined $target{shared_impflag};
1197 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
1198 my $recipe = <<"EOF";
1200 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
1201 -o $full$shared_def $objs \\
1202 $linklibs \$(LIB_EX_LIBS)
1206 rm -f apps/$shlib'\$(SHLIB_EXT)'
1207 rm -f test/$shlib'\$(SHLIB_EXT)'
1208 rm -f fuzz/$shlib'\$(SHLIB_EXT)'
1209 cp -p $shlib'\$(SHLIB_EXT)' apps/
1210 cp -p $shlib'\$(SHLIB_EXT)' test/
1211 cp -p $shlib'\$(SHLIB_EXT)' fuzz/
1213 } elsif (sharedaix()) {
1216 \$(AR) r $simple $full
1220 if [ '$simple' != '$full' ]; then \\
1222 ln -s $full $simple; \\
1229 my $dso = $args{lib};
1230 my $dsod = dirname($dso);
1231 my $dson = basename($dso);
1233 foreach (@{args{deps}}) {
1234 my $d = dirname($_);
1235 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1237 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1238 my $linklibs = join("", map { my $f = basename($_);
1239 (my $l = $f) =~ s/^lib//;
1240 " -l$l" } @{$args{deps}});
1241 my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" }
1242 grep { $_ !~ m/\.(?:def|map)$/ }
1244 my @deps = compute_lib_depends(@{$args{deps}});
1245 my $objs = join(" ", @objs);
1246 my $deps = join(" ", @deps);
1247 my $target = dso($dso);
1249 $target: $objs $deps
1250 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
1252 $linklibs \$(DSO_EX_LIBS)
1257 (my $lib = $args{lib}) =~ s/\.a$//;
1258 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
1259 my $objs = join(" ", @objs);
1262 \$(AR) \$(ARFLAGS) \$\@ \$\?
1263 \$(RANLIB) \$\@ || echo Never mind.
1268 my $bin = $args{bin};
1269 my $bind = dirname($bin);
1270 my $binn = basename($bin);
1271 my $objs = join(" ", map { (my $x = $_) =~ s|\.o$||; "$x$objext" }
1273 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1275 foreach (@{args{deps}}) {
1276 next if $_ =~ /\.a$/;
1277 my $d = dirname($_);
1278 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
1280 my $linkflags = join("", map { "-L$_ " } @linkdirs);
1281 my $linklibs = join("", map { if ($_ =~ s/\.a$//) {
1284 my $f = basename($_);
1285 (my $l = $f) =~ s/^lib//;
1290 my $cmdflags = '$(BIN_CFLAGS)';
1291 if (grep /_cc\.o$/, @{$args{objs}}) {
1293 $cmdflags = '$(BIN_CXXFLAGS)';
1296 $bin$exeext: $objs $deps
1298 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
1299 -o $bin$exeext $objs \\
1300 $linklibs \$(BIN_EX_LIBS)
1305 my $script = $args{script};
1306 my $sources = join(" ", @{$args{sources}});
1307 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1308 "util", "dofile.pl")),
1309 rel2abs($config{builddir}));
1312 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1313 "-o$target{build_file}" $sources > "$script"
1319 my $dir = $args{dir};
1320 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1322 my %extinfo = ( dso => $dsoext,
1326 # We already have a 'test' target, and the top directory is just plain
1328 return if $dir eq "test" || $dir eq ".";
1330 foreach my $type (("dso", "lib", "bin", "script")) {
1331 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1332 # For lib object files, we could update the library. However, it
1333 # was decided that it's enough to build the directory local object
1334 # files, so we don't need to add any actions, and the dependencies
1335 # are already taken care of.
1336 if ($type ne "lib") {
1337 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1338 if (dirname($prod) eq $dir) {
1339 push @deps, $prod.$extinfo{$type};
1341 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1347 my $deps = join(" ", @deps);
1348 my $actions = join("\n", "", @actions);
1350 $dir $dir/: $deps$actions
1353 "" # Important! This becomes part of the template result.