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";
16 # $mingw_installroot and $mingw_commonroot is relevant for mingw only.
17 my $mingw_installenv =
18 $target{build_scheme}->[2] eq "mingw"
19 ? "ProgramFiles(x86)" : "ProgramW6432";
21 $target{build_scheme}->[2] eq "mingw"
22 ? "CommonProgramFiles(x86)" : "CommonProgramW6432";
23 our $mingw_installroot =
24 defined($ENV{$mingw_installenv})
25 ? $mingw_installenv : 'ProgramFiles';
26 our $mingw_commonroot =
27 defined($ENV{$mingw_commonenv})
28 ? $mingw_commonenv : 'CommonProgramFiles';
29 my $mingw_installdflt =
30 defined($ENV{$mingw_installenv})
31 ? "C:/Program Files (x86)" : "C:/Program Files";
32 my $mingw_commondflt = "$mingw_installdflt/Common Files";
34 # expand variables early
35 $mingw_installroot = $ENV{$mingw_installroot} // $mingw_installdflt;
36 $mingw_commonroot = $ENV{$mingw_commonroot} // $mingw_commondflt;
38 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
40 our $sover = $config{target} =~ /^mingw/
41 ? $config{shlib_major}."_".$config{shlib_minor}
42 : $config{shlib_major}.".".$config{shlib_minor};
44 # shlib and shlib_simple both take a static library name and figure
45 # out what the shlib name should be.
47 # When OpenSSL is configured "no-shared", these functions will just
48 # return empty lists, making them suitable to join().
50 # With Windows DLL producers, shlib($libname) will return the shared
51 # library name (which usually is different from the static library
52 # name) with the default shared extension appended to it, while
53 # shlib_simple($libname) will return the static library name with
54 # the shared extension followed by ".a" appended to it. The former
55 # result is used as the runtime shared library while the latter is
56 # used as the DLL import library.
58 # On all Unix systems, shlib($libname) will return the library name
59 # with the default shared extension, while shlib_simple($libname)
60 # will return the name from shlib($libname) with any SO version number
61 # removed. On some systems, they may therefore return the exact same
64 return () if $disabled{shared};
66 return $unified_info{sharednames}->{$lib}. $shlibvariant. $shlibext;
69 return () if $disabled{shared};
73 return $lib . $shlibextimport;
75 return $lib . $shlibextsimple;
78 # dso is a complement to shlib / shlib_simple that returns the
79 # given libname with the simple shared extension (possible SO version
80 # removed). This differs from shlib_simple() by being unconditional.
84 return $engine . $dsoext;
86 # This makes sure things get built in the order they need
91 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
95 PLATFORM={- $config{target} -}
96 OPTIONS={- $config{options} -}
97 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
98 SRCDIR={- $config{sourcedir} -}
99 BLDDIR={- $config{builddir} -}
101 VERSION={- $config{version} -}
102 MAJOR={- $config{major} -}
103 MINOR={- $config{minor} -}
104 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
105 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
106 SHLIB_MAJOR={- $config{shlib_major} -}
107 SHLIB_MINOR={- $config{shlib_minor} -}
108 SHLIB_TARGET={- $target{shared_target} -}
110 LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -}
111 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
112 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
113 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
114 PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
115 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
116 {- output_off() if $disabled{makedepend}; "" -}
117 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
118 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
119 keys %{$unified_info{sources}}); -}
120 {- output_on() if $disabled{makedepend}; "" -}
121 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
122 GENERATED={- join(" ",
123 ( grep { defined $unified_info{generate}->{$_} }
124 map { @{$unified_info{sources}->{$_}} }
125 grep { /\.o$/ } keys %{$unified_info{sources}} ),
126 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
128 INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -}
129 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
130 INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -}
131 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
132 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -}
133 {- output_off() if $disabled{apps}; "" -}
134 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
135 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
136 {- output_on() if $disabled{apps}; "" -}
138 APPS_OPENSSL={- use File::Spec::Functions;
139 catfile("apps","openssl") -}
141 # DESTDIR is for package builders so that they can configure for, say,
142 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
143 # Normally it is left empty.
146 {- output_off() if $config{target} =~ /^mingw/; "" -}
147 # Do not edit these manually. Use Configure with --prefix or --openssldir
148 # to change this! Short explanation in the top comment in Configure
149 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
151 our $prefix = $config{prefix} || "/usr/local";
154 # The logic here is that if no --openssldir was given,
155 # OPENSSLDIR will get the value from $prefix plus "/ssl".
156 # If --openssldir was given and the value is an absolute
157 # path, OPENSSLDIR will get its value without change.
158 # If the value from --openssldir is a relative path,
159 # OPENSSLDIR will get $prefix with the --openssldir
160 # value appended as a subdirectory.
162 use File::Spec::Functions;
164 $config{openssldir} ?
165 (file_name_is_absolute($config{openssldir}) ?
167 : catdir($prefix, $config{openssldir}))
168 : catdir($prefix, "ssl");
171 # if $prefix/lib$target{multilib} is not an existing
172 # directory, then assume that it's not searched by linker
173 # automatically, in which case adding $target{multilib} suffix
174 # causes more grief than we're ready to tolerate, so don't...
176 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
177 our $libdir = $config{libdir} || "lib$multilib";
179 ENGINESDIR={- use File::Spec::Functions;
180 catdir($prefix,$libdir,"engines-$sover") -}
182 # Convenience variable for those who want to set the rpath in shared
183 # libraries and applications
184 LIBRPATH=$(INSTALLTOP)/$(LIBDIR)
185 {- output_on() if $config{target} =~ /^mingw/;
186 output_off() if $config{target} !~ /^mingw/;
188 # Do not edit these manually. Use Configure with --prefix or --openssldir
189 # to change this! Short explanation in the top comment in Configure
190 INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
192 use File::Spec::Win32;
193 my $prefix_default = "$mingw_installroot/OpenSSL";
195 File::Spec::Win32->canonpath($config{prefix}
197 our ($prefix_dev, $prefix_dir, $prefix_file) =
198 File::Spec::Win32->splitpath($prefix, 1);
200 $prefix_dir =~ s|\\|/|g;
202 INSTALLTOP_dir={- my $x = File::Spec::Win32->canonpath($prefix_dir);
206 # The logic here is that if no --openssldir was given,
207 # OPENSSLDIR will get the value "$mingw_commonroot/SSL".
208 # If --openssldir was given and the value is an absolute
209 # path, OPENSSLDIR will get its value without change.
210 # If the value from --openssldir is a relative path,
211 # OPENSSLDIR will get $prefix with the --openssldir
212 # value appended as a subdirectory.
214 use File::Spec::Win32;
216 $config{openssldir} ?
217 (File::Spec::Win32->file_name_is_absolute($config{openssldir}) ?
218 File::Spec::Win32->canonpath($config{openssldir})
219 : File::Spec::Win32->catdir($prefix, $config{openssldir}))
220 : File::Spec::Win32->canonpath("$mingw_commonroot/SSL");
221 our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
222 File::Spec::Win32->splitpath($openssldir, 1);
223 $openssldir =~ s|\\|/|g;
224 $openssldir_dir =~ s|\\|/|g;
226 OPENSSLDIR_dir={- my $x = File::Spec::Win32->canonpath($openssldir_dir);
229 LIBDIR={- our $libdir = $config{libdir} || "lib";
231 ENGINESDIR_dev={- use File::Spec::Win32;
233 File::Spec::Win32->catdir($prefix,$libdir,
234 "engines-$sover_dirname");
235 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
236 File::Spec::Win32->splitpath($enginesdir, 1);
237 $enginesdir =~ s|\\|/|g;
238 $enginesdir_dir =~ s|\\|/|g;
240 ENGINESDIR_dir={- my $x = File::Spec::Win32->canonpath($enginesdir_dir);
243 # In a Windows environment, $(DESTDIR) is harder to contatenate with other
244 # directory variables, because both may contain devices. What we do here is
245 # to adapt INSTALLTOP, OPENSSLDIR and ENGINESDIR depending on if $(DESTDIR)
246 # has a value or not, to ensure that concatenation will always work further
248 ifneq "$(DESTDIR)" ""
249 INSTALLTOP=$(INSTALLTOP_dir)
250 OPENSSLDIR=$(OPENSSLDIR_dir)
251 ENGINESDIR=$(ENGINESDIR_dir)
253 INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
254 OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
255 ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
257 {- output_on() if $config{target} !~ /^mingw/; "" -}
259 MANDIR=$(INSTALLTOP)/share/man
260 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
261 HTMLDIR=$(DOCDIR)/html
263 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
264 # appended after the manpage file section number. "ssl" is popular,
265 # resulting in files such as config.5ssl rather than config.5.
271 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
272 CC= $(CROSS_COMPILE){- $target{cc} -}
273 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
274 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
275 LDFLAGS= {- $target{lflags} -}
276 PLIB_LDFLAGS= {- $target{plib_lflags} -}
277 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
278 LIB_CFLAGS={- $target{shared_cflag} || "" -}
279 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
280 DSO_CFLAGS={- $target{shared_cflag} || "" -}
281 DSO_LDFLAGS=$(LIB_LDFLAGS)
282 BIN_CFLAGS={- $target{bin_cflags} -}
284 PERL={- $config{perl} -}
286 ARFLAGS= {- $target{arflags} -}
287 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
288 RANLIB= {- $target{ranlib} -}
289 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
290 RCFLAGS={- $target{shared_rcflag} -}
291 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
294 TAR= {- $target{tar} || "tar" -}
295 TARFLAGS= {- $target{tarflags} -}
296 MAKEDEPEND={- $config{makedepprog} -}
299 NAME= $(BASENAME)-$(VERSION)
300 # Relative to $(SRCDIR)
301 TARFILE= ../$(NAME).tar
303 # We let the C compiler driver to take care of .s files. This is done in
304 # order to be excused from maintaining a separate set of architecture
305 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
306 # gcc, then the driver will automatically translate it to -xarch=v8plus
307 # and pass it down to assembler. In any case, we do not define AS or
308 # ASFLAGS for this reason.
309 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
311 # For x86 assembler: Set PROCESSOR to 386 if you want to support
313 PROCESSOR= {- $config{processor} -}
315 # We want error [and other] messages in English. Trouble is that make(1)
316 # doesn't pass macros down as environment variables unless there already
317 # was corresponding variable originally set. In other words we can only
318 # reassign environment variables, but not set new ones, not in portable
319 # manner that is. That's why we reassign several, just to be sure...
324 # The main targets ###################################################
326 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
327 {- dependmagic('build_libs'); -}: build_libs_nodep
328 {- dependmagic('build_engines'); -}: build_engines_nodep
329 {- dependmagic('build_programs'); -}: build_programs_nodep
331 build_generated: $(GENERATED_MANDATORY)
332 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
333 build_engines_nodep: $(ENGINES)
334 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
336 # Kept around for backward compatibility
337 build_apps build_tests: build_programs
339 # Convenience target to prebuild all generated files, not just the mandatory
341 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
344 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
345 @ : {- output_off() if $disabled{tests}; "" -}
347 mkdir -p test-runs; \
348 SRCTOP=../$(SRCDIR) \
349 BLDTOP=../$(BLDDIR) \
352 EXE_EXT={- $exeext -} \
353 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines; pwd` \
354 OPENSSL_DEBUG_MEMORY=on \
355 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
356 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
357 @echo "Tests are not supported with your chosen Configure options"
358 @ : {- output_on() if !$disabled{tests}; "" -}
361 @ : {- output_off() if $disabled{tests}; "" -}
362 @SRCTOP="$(SRCDIR)" \
363 $(PERL) $(SRCDIR)/test/run_tests.pl list
364 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
365 @echo "Tests are not supported with your chosen Configure options"
366 @ : {- output_on() if !$disabled{tests}; "" -}
368 install: install_sw install_ssldirs install_docs
370 uninstall: uninstall_docs uninstall_sw
373 @set -e; for s in $(SHLIB_INFO); do \
374 s1=`echo "$$s" | cut -f1 -d";"`; \
375 s2=`echo "$$s" | cut -f2 -d";"`; \
378 if [ "$$s1" != "$$s2" ]; then \
387 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
389 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
390 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
392 $(RM) tags TAGS doc-nits
393 $(RM) -r test/test-runs
394 $(RM) openssl.pc libcrypto.pc libssl.pc
395 -$(RM) `find . -type l -a \! -path "./.git/*"`
402 # We check if any depfile is newer than Makefile and decide to
403 # concatenate only if that is true.
405 @: {- output_off() if $disabled{makedepend}; "" -}
406 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
407 ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
408 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
410 for f in $(DEPS); do \
411 if [ -f $$f ]; then cat $$f; fi; \
412 done ) > Makefile.new; \
413 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
414 rm -f Makefile.new; \
416 mv -f Makefile.new Makefile; \
419 @: {- output_on() if $disabled{makedepend}; "" -}
421 # Install helper targets #############################################
423 install_sw: install_dev install_engines install_runtime
425 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
427 install_docs: install_man_docs install_html_docs
429 uninstall_docs: uninstall_man_docs uninstall_html_docs
430 $(RM) -r -v $(DESTDIR)$(DOCDIR)
433 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
434 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
435 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
436 @set -e; for x in dummy $(MISC_SCRIPTS); do \
437 if [ "$$x" = "dummy" ]; then continue; fi; \
439 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
440 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
441 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
442 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
443 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
445 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
446 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
447 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
448 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
449 @if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
450 echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
451 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
452 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
455 install_dev: install_runtime_libs
456 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
457 @echo "*** Installing development files"
458 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
459 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
460 @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
461 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
462 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
463 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
464 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
465 $(BLDDIR)/include/openssl/*.h; do \
467 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
468 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
469 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
471 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
472 @set -e; for l in $(INSTALL_LIBS); do \
474 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
475 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
476 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
477 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
478 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
479 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
481 @ : {- output_off() if $disabled{shared}; "" -}
482 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
483 s1=`echo "$$s" | cut -f1 -d";"`; \
484 s2=`echo "$$s" | cut -f2 -d";"`; \
485 fn1=`basename $$s1`; \
486 fn2=`basename $$s2`; \
487 : {- output_off() if windowsdll(); "" -}; \
488 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
489 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
490 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
491 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
492 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
493 if [ "$$fn1" != "$$fn2" ]; then \
494 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
495 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
497 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
498 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
499 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
500 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
501 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
502 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
503 : {- output_on() unless windowsdll(); "" -}; \
505 @ : {- output_on() if $disabled{shared}; "" -}
506 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
507 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
508 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
509 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
510 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
511 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
512 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
513 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
514 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
515 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
518 @echo "*** Uninstalling development files"
519 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
520 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
521 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
522 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
523 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
524 $(BLDDIR)/include/openssl/*.h; do \
526 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
527 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
529 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
530 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
531 @set -e; for l in $(INSTALL_LIBS); do \
533 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
534 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
536 @ : {- output_off() if $disabled{shared}; "" -}
537 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
538 s1=`echo "$$s" | cut -f1 -d";"`; \
539 s2=`echo "$$s" | cut -f2 -d";"`; \
540 fn1=`basename $$s1`; \
541 fn2=`basename $$s2`; \
542 : {- output_off() if windowsdll(); "" -}; \
543 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
544 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
545 if [ "$$fn1" != "$$fn2" ]; then \
546 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
547 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
549 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
550 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
551 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
552 : {- output_on() unless windowsdll(); "" -}; \
554 @ : {- output_on() if $disabled{shared}; "" -}
555 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
556 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
557 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
558 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
559 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
561 install_engines: install_runtime_libs build_engines
562 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
563 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
564 @echo "*** Installing engines"
565 @set -e; for e in dummy $(INSTALL_ENGINES); do \
566 if [ "$$e" = "dummy" ]; then continue; fi; \
568 echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
569 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
570 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
571 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
572 $(DESTDIR)$(ENGINESDIR)/$$fn; \
576 @echo "*** Uninstalling engines"
577 @set -e; for e in dummy $(INSTALL_ENGINES); do \
578 if [ "$$e" = "dummy" ]; then continue; fi; \
580 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
583 echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
584 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
586 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
588 install_runtime: install_programs
590 install_runtime_libs: build_libs
591 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
592 @ : {- output_off() if windowsdll(); "" -}
593 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
594 @ : {- output_on() if windowsdll(); "" -}
595 @echo "*** Installing runtime files"
596 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
597 if [ "$$s" = "dummy" ]; then continue; fi; \
599 : {- output_off() unless windowsdll(); "" -}; \
600 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
601 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
602 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
603 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
604 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
605 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
606 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
607 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
608 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
609 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
610 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
611 : {- output_on() if windowsdll(); "" -}; \
614 install_programs: install_runtime_libs build_programs
615 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
616 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
617 @echo "*** Installing runtime programs"
618 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
619 if [ "$$x" = "dummy" ]; then continue; fi; \
621 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
622 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
623 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
624 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
625 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
627 @set -e; for x in dummy $(BIN_SCRIPTS); do \
628 if [ "$$x" = "dummy" ]; then continue; fi; \
630 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
631 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
632 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
633 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
634 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
637 uninstall_runtime: uninstall_programs uninstall_runtime_libs
640 @echo "*** Uninstalling runtime programs"
641 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
643 if [ "$$x" = "dummy" ]; then continue; fi; \
645 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
646 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
648 @set -e; for x in dummy $(BIN_SCRIPTS); \
650 if [ "$$x" = "dummy" ]; then continue; fi; \
652 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
653 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
655 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
657 uninstall_runtime_libs:
658 @echo "*** Uninstalling runtime libraries"
659 @ : {- output_off() unless windowsdll(); "" -}
660 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
661 if [ "$$s" = "dummy" ]; then continue; fi; \
663 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
664 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
666 @ : {- output_on() unless windowsdll(); "" -}
670 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
671 @echo "*** Installing manpages"
672 $(PERL) $(SRCDIR)/util/process_docs.pl \
673 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
676 @echo "*** Uninstalling manpages"
677 $(PERL) $(SRCDIR)/util/process_docs.pl \
678 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
682 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
683 @echo "*** Installing HTML manpages"
684 $(PERL) $(SRCDIR)/util/process_docs.pl \
685 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
688 @echo "*** Uninstalling manpages"
689 $(PERL) $(SRCDIR)/util/process_docs.pl \
690 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
693 # Developer targets (note: these are only available on Unix) #########
695 update: generate errors ordinals
697 generate: generate_apps generate_crypto_bn generate_crypto_objects \
698 generate_crypto_conf generate_crypto_asn1
701 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n ) >doc-nits
702 if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi
704 # Test coverage is a good idea for the future
705 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
709 lint -DLINT $(INCLUDES) $(SRCS)
712 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
713 < apps/openssl.cnf > apps/openssl-vms.cnf )
716 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
718 generate_crypto_objects:
719 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
720 crypto/objects/objects.txt \
721 crypto/objects/obj_mac.num \
722 include/openssl/obj_mac.h )
723 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
724 include/openssl/obj_mac.h \
725 crypto/objects/obj_dat.h )
726 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
727 crypto/objects/obj_mac.num \
728 crypto/objects/obj_xref.txt \
729 > crypto/objects/obj_xref.h )
731 generate_crypto_conf:
732 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
733 > crypto/conf/conf_def.h )
735 generate_crypto_asn1:
736 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
737 > crypto/asn1/charmap.h )
740 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
741 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
742 ( cd $(SRCDIR)/engines; \
744 $(PERL) ../util/mkerr.pl -conf $$e \
745 -nostatic -staticloader -write *.c; \
749 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
750 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
754 SRCTOP=../$(SRCDIR) \
755 BLDTOP=../$(BLDDIR) \
756 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
761 -etags `find . -name '*.[ch]' -o -name '*.pm'`
763 # Release targets (note: only available on Unix) #####################
766 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
768 # Helper targets #####################################################
770 link-utils: $(BLDDIR)/util/opensslwrap.sh
772 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
773 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
774 mkdir -p "$(BLDDIR)/util"; \
775 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
780 # Building targets ###################################################
782 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
784 @ ( echo 'prefix=$(INSTALLTOP)'; \
785 echo 'exec_prefix=$${prefix}'; \
786 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
787 echo 'includedir=$${prefix}/include'; \
788 echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
790 echo 'Name: OpenSSL-libcrypto'; \
791 echo 'Description: OpenSSL cryptography library'; \
792 echo 'Version: '$(VERSION); \
793 echo 'Libs: -L$${libdir} -lcrypto'; \
794 echo 'Libs.private: $(EX_LIBS)'; \
795 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
798 @ ( echo 'prefix=$(INSTALLTOP)'; \
799 echo 'exec_prefix=$${prefix}'; \
800 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
801 echo 'includedir=$${prefix}/include'; \
803 echo 'Name: OpenSSL-libssl'; \
804 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
805 echo 'Version: '$(VERSION); \
806 echo 'Requires.private: libcrypto'; \
807 echo 'Libs: -L$${libdir} -lssl'; \
808 echo 'Cflags: -I$${includedir}' ) > libssl.pc
811 @ ( echo 'prefix=$(INSTALLTOP)'; \
812 echo 'exec_prefix=$${prefix}'; \
813 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
814 echo 'includedir=$${prefix}/include'; \
816 echo 'Name: OpenSSL'; \
817 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
818 echo 'Version: '$(VERSION); \
819 echo 'Requires: libssl libcrypto' ) > openssl.pc
821 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
822 @echo "Detected changed: $?"
823 @echo "Reconfiguring..."
824 $(PERL) $(SRCDIR)/Configure reconf
825 @echo "**************************************************"
827 @echo "*** Please run the same make command again ***"
829 @echo "**************************************************"
834 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
836 # Helper function to figure out dependencies on libraries
837 # It takes a list of library names and outputs a list of dependencies
838 sub compute_lib_depends {
839 if ($disabled{shared}) {
840 return map { $_.$libext } @_;
843 # Depending on shared libraries:
844 # On Windows POSIX layers, we depend on {libname}.dll.a
845 # On Unix platforms, we depend on {shlibname}.so
846 return map { shlib_simple($_) } @_;
851 my $generator = join(" ", @{$args{generator}});
852 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
853 my $incs = join("", map { " -I".$_ } @{$args{incs}});
854 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
856 if ($args{src} !~ /\.[sS]$/) {
857 if ($args{generator}->[0] =~ m|^.*\.in$|) {
858 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
859 "util", "dofile.pl")),
860 rel2abs($config{builddir}));
862 $args{src}: $args{generator}->[0] $deps
863 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
864 "-o$target{build_file}" $generator > \$@
868 $args{src}: $args{generator}->[0] $deps
869 \$(PERL)$generator_incs $generator > \$@
873 if ($args{generator}->[0] =~ /\.pl$/) {
874 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
875 } elsif ($args{generator}->[0] =~ /\.m4$/) {
876 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
877 } elsif ($args{generator}->[0] =~ /\.S$/) {
880 die "Generator type for $args{src} unknown: $generator\n";
883 if (defined($generator)) {
885 $args{src}: $args{generator}->[0] $deps
890 $args{src}: $args{generator}->[0] $deps
891 \$(CC) $incs \$(CFLAGS) -E $args{generator}->[0] | \\
892 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
897 # Should one wonder about the end of the Perl snippet, it's because this
898 # second regexp eats up line endings as well, if the removed path is the
899 # last in the line. We may therefore need to put back a line ending.
902 my $obj = $args{obj};
903 my @srcs = @{$args{srcs}};
904 my $srcs = join(" ", @srcs);
905 my $deps = join(" ", @srcs, @{$args{deps}});
906 my $incs = join("", map { " -I".$_ } @{$args{incs}});
907 unless ($disabled{zlib}) {
908 if ($withargs{zlib_include}) {
909 $incs .= " -I".$withargs{zlib_include};
912 my $ecflags = { lib => '$(LIB_CFLAGS)',
913 dso => '$(DSO_CFLAGS)',
914 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
915 my $makedepprog = $config{makedepprog};
917 # extension-specific rules
918 if (grep /\.s$/, @srcs) {
921 \$(CC) \$(CFLAGS) $ecflags -c -o \$\@ $srcs
923 } elsif (grep /\.S$/, @srcs) {
924 # In case one wonders why not just $(CC) -c file.S. While it
925 # does work with contemporary compilers, there are some legacy
926 # ones that get it wrong. Hence the elaborate scheme... We
927 # don't care to maintain dependecy lists, because dependency
928 # is rather weak, at most one header file that lists constants
929 # which are assigned in ascending order.
932 ( trap "rm -f \$@.*" INT 0; \\
933 \$(CC) $incs \$(CFLAGS) $ecflags -E $srcs | \\
934 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.s && \\
935 \$(CC) \$(CFLAGS) $ecflags -c -o \$\@ \$@.s )
937 } elsif (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
940 \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
941 \@touch $obj$depext.tmp
942 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
943 rm -f $obj$depext.tmp; \\
945 mv $obj$depext.tmp $obj$depext; \\
951 \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
953 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
955 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
956 >$obj$depext.tmp 2>/dev/null
957 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
958 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
959 rm -f $obj$depext.tmp; \\
961 mv $obj$depext.tmp $obj$depext; \\
968 # On Unix, we build shlibs from static libs, so we're ignoring the
969 # object file array. We *know* this routine is only called when we've
970 # configure 'shared'.
973 my $lib = $args{lib};
974 my $shlib = $args{shlib};
975 my $libd = dirname($lib);
976 my $libn = basename($lib);
977 (my $libname = $libn) =~ s/^lib//;
978 my $linklibs = join("", map { my $d = dirname($_);
979 my $f = basename($_);
980 (my $l = $f) =~ s/^lib//;
981 " -L$d -l$l" } @{$args{deps}});
982 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
983 my $shlib_target = $target{shared_target};
984 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
985 my $target = shlib_simple($lib);
986 my $target_full = shlib($lib);
988 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
989 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
990 # With all other Unix platforms, we often build a shared library with the
991 # SO version built into the file name and a symlink without the SO version
992 # It's not necessary to have both as targets. The choice falls on the
993 # simplest, {libname}$shlibextimport for Windows POSIX layers and
994 # {libname}$shlibextsimple for the Unix platforms.
995 $target: $lib$libext $deps $ordinalsfile
996 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
997 PLATFORM=\$(PLATFORM) \\
998 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
999 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
1000 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1001 LIBNAME=$libname SHLIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
1002 STLIBNAME=$lib$libext \\
1003 SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\
1004 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
1005 LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\
1006 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
1007 link_shlib.$shlib_target
1009 . (windowsdll() ? <<"EOF" : "");
1010 rm -f apps/$shlib$shlibext
1011 rm -f test/$shlib$shlibext
1012 rm -f fuzz/$shlib$shlibext
1013 cp -p $shlib$shlibext apps/
1014 cp -p $shlib$shlibext test/
1015 cp -p $shlib$shlibext fuzz/
1020 my $dso = $args{lib};
1021 my $dsod = dirname($dso);
1022 my $dson = basename($dso);
1023 my $shlibdeps = join("", map { my $d = dirname($_);
1024 my $f = basename($_);
1025 (my $l = $f) =~ s/^lib//;
1026 " -L$d -l$l" } @{$args{deps}});
1027 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1028 my $shlib_target = $target{shared_target};
1029 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1030 my $target = dso($dso);
1032 $target: $objs $deps
1033 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1034 PLATFORM=\$(PLATFORM) \\
1035 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\
1036 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
1037 SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\
1038 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
1039 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
1040 LIBEXTRAS="$objs" \\
1041 link_dso.$shlib_target
1046 my $lib = $args{lib};
1047 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1051 \$(RANLIB) \$\@ || echo Never mind.
1056 my $bin = $args{bin};
1057 my $bind = dirname($bin);
1058 my $binn = basename($bin);
1059 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1060 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1061 my $linklibs = join("", map { my $d = dirname($_);
1062 my $f = basename($_);
1063 $d = "." if $d eq $f;
1064 (my $l = $f) =~ s/^lib//;
1065 " -L$d -l$l" } @{$args{deps}});
1066 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1068 $bin$exeext: $objs $deps
1070 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1071 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1072 APPNAME=$bin$exeext OBJECTS="$objs" \\
1073 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1074 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
1075 LDFLAGS='\$(LDFLAGS)' \\
1076 link_app.$shlib_target
1081 my $script = $args{script};
1082 my $sources = join(" ", @{$args{sources}});
1083 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1084 "util", "dofile.pl")),
1085 rel2abs($config{builddir}));
1088 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1089 "-o$target{build_file}" $sources > "$script"
1095 my $dir = $args{dir};
1096 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1098 my %extinfo = ( dso => $dsoext,
1102 foreach my $type (("dso", "lib", "bin", "script")) {
1103 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1104 # For lib object files, we could update the library. However, it
1105 # was decided that it's enough to build the directory local object
1106 # files, so we don't need to add any actions, and the dependencies
1107 # are already taken care of.
1108 if ($type ne "lib") {
1109 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1110 if (dirname($prod) eq $dir) {
1111 push @deps, $prod.$extinfo{$type};
1113 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1119 my $deps = join(" ", @deps);
1120 my $actions = join("\n", "", @actions);
1122 $args{dir} $args{dir}/: $deps$actions
1125 "" # Important! This becomes part of the template result.