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 $shlibextsimple = $target{shared_extension_simple} || ".so";
12 our $shlibextimport = $target{shared_import_extension} || "";
13 our $dsoext = $target{dso_extension} || ".so";
15 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
17 our $sover = $config{target} =~ /^mingw/
18 ? $config{shlib_major}."_".$config{shlib_minor}
19 : $config{shlib_major}.".".$config{shlib_minor};
21 # shlib and shlib_simple both take a static library name and figure
22 # out what the shlib name should be.
24 # When OpenSSL is configured "no-shared", these functions will just
25 # return empty lists, making them suitable to join().
27 # With Windows DLL producers, shlib($libname) will return the shared
28 # library name (which usually is different from the static library
29 # name) with the default shared extension appended to it, while
30 # shlib_simple($libname) will return the static library name with
31 # the shared extension followed by ".a" appended to it. The former
32 # result is used as the runtime shared library while the latter is
33 # used as the DLL import library.
35 # On all Unix systems, shlib($libname) will return the library name
36 # with the default shared extension, while shlib_simple($libname)
37 # will return the name from shlib($libname) with any SO version number
38 # removed. On some systems, they may therefore return the exact same
41 return () if $disabled{shared};
43 return $unified_info{sharednames}->{$lib} . $shlibext;
46 return () if $disabled{shared};
50 return $lib . $shlibextimport;
52 return $lib . $shlibextsimple;
55 # dso is a complement to shlib / shlib_simple that returns the
56 # given libname with the simple shared extension (possible SO version
57 # removed). This differs from shlib_simple() by being unconditional.
61 return $engine . $dsoext;
63 # This makes sure things get built in the order they need
68 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
72 PLATFORM={- $config{target} -}
73 OPTIONS={- $config{options} -}
74 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
75 SRCDIR={- $config{sourcedir} -}
76 BLDDIR={- $config{builddir} -}
78 VERSION={- $config{version} -}
79 MAJOR={- $config{major} -}
80 MINOR={- $config{minor} -}
81 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
82 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
83 SHLIB_MAJOR={- $config{shlib_major} -}
84 SHLIB_MINOR={- $config{shlib_minor} -}
85 SHLIB_TARGET={- $target{shared_target} -}
87 LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -}
88 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
89 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
90 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
91 PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
92 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
93 {- output_off() if $disabled{makedepend}; "" -}
94 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
95 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
96 keys %{$unified_info{sources}}); -}
97 {- output_on() if $disabled{makedepend}; "" -}
98 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
99 GENERATED={- join(" ",
100 ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
101 grep { defined $unified_info{generate}->{$_} }
102 map { @{$unified_info{sources}->{$_}} }
103 grep { /\.o$/ } keys %{$unified_info{sources}} ),
104 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
106 INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -}
107 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
108 INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -}
109 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
110 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -}
111 {- output_off() if $disabled{apps}; "" -}
112 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
113 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
114 {- output_on() if $disabled{apps}; "" -}
116 # DESTDIR is for package builders so that they can configure for, say,
117 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
118 # Normally it is left empty.
121 # Do not edit these manually. Use Configure with --prefix or --openssldir
122 # to change this! Short explanation in the top comment in Configure
123 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
125 our $prefix = $config{prefix} || "/usr/local";
128 # The logic here is that if no --openssldir was given,
129 # OPENSSLDIR will get the value from $prefix plus "/ssl".
130 # If --openssldir was given and the value is an absolute
131 # path, OPENSSLDIR will get its value without change.
132 # If the value from --openssldir is a relative path,
133 # OPENSSLDIR will get $prefix with the --openssldir
134 # value appended as a subdirectory.
136 use File::Spec::Functions;
138 $config{openssldir} ?
139 (file_name_is_absolute($config{openssldir}) ?
141 : catdir($prefix, $config{openssldir}))
142 : catdir($prefix, "ssl");
145 # if $prefix/lib$target{multilib} is not an existing
146 # directory, then assume that it's not searched by linker
147 # automatically, in which case adding $target{multilib} suffix
148 # causes more grief than we're ready to tolerate, so don't...
150 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
151 our $libdir = $config{libdir} || "lib$multilib";
153 ENGINESDIR={- use File::Spec::Functions;
154 catdir($prefix,$libdir,"engines-$sover") -}
156 MANDIR=$(INSTALLTOP)/share/man
157 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
158 HTMLDIR=$(DOCDIR)/html
160 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
161 # appended after the manpage file section number. "ssl" is popular,
162 # resulting in files such as config.5ssl rather than config.5.
168 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
169 CC= $(CROSS_COMPILE){- $target{cc} -}
170 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
171 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
172 LDFLAGS= {- $target{lflags} -}
173 PLIB_LDFLAGS= {- $target{plib_lflags} -}
174 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
175 LIB_CFLAGS={- $target{shared_cflag} || "" -}
176 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
177 # Unlike other OSes (like Solaris, Linux, Tru64,
178 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
179 # and FreeBSD) "demand" RPATH set on .so objects.
180 # Apparently application RPATH is not global and
181 # does not apply to .so linked with other .so.
182 # Problem manifests itself when libssl.so fails to
183 # load libcrypto.so. One can argue that we should
184 # engrave this into Makefile.shared rules or into
185 # BSD-* config lines above. Meanwhile let's try to
186 # be cautious and pass -rpath to linker only when
187 # $prefix is not /usr.
188 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
189 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
190 DSO_CFLAGS={- $target{shared_cflag} || "" -}
191 DSO_LDFLAGS=$(LIB_LDFLAGS)
192 BIN_CFLAGS={- $target{bin_cflags} -}
194 PERL={- $config{perl} -}
196 ARFLAGS= {- $target{arflags} -}
197 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
198 RANLIB= {- $target{ranlib} -}
199 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
200 RCFLAGS={- $target{shared_rcflag} -}
201 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
204 TAR= {- $target{tar} || "tar" -}
205 TARFLAGS= {- $target{tarflags} -}
206 MAKEDEPEND={- $config{makedepprog} -}
209 NAME= $(BASENAME)-$(VERSION)
210 TARFILE= ../$(NAME).tar
212 # We let the C compiler driver to take care of .s files. This is done in
213 # order to be excused from maintaining a separate set of architecture
214 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
215 # gcc, then the driver will automatically translate it to -xarch=v8plus
216 # and pass it down to assembler.
219 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
221 # For x86 assembler: Set PROCESSOR to 386 if you want to support
223 PROCESSOR= {- $config{processor} -}
225 # The main targets ###################################################
227 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
228 {- dependmagic('build_libs'); -}: build_libs_nodep
229 {- dependmagic('build_engines'); -}: build_engines_nodep
230 {- dependmagic('build_programs'); -}: build_programs_nodep
232 build_generated: $(GENERATED_MANDATORY)
233 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
234 build_engines_nodep: $(ENGINES)
235 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
237 # Kept around for backward compatibility
238 build_apps build_tests: build_programs
241 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
242 @ : {- output_off() if $disabled{tests}; "" -}
244 SRCTOP=../$(SRCDIR) \
245 BLDTOP=../$(BLDDIR) \
247 EXE_EXT={- $exeext -} \
248 OPENSSL_ENGINES=../$(BLDDIR)/engines \
249 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
250 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
251 @echo "Tests are not supported with your chosen Configure options"
252 @ : {- output_on() if !$disabled{tests}; "" -}
255 @ : {- output_off() if $disabled{tests}; "" -}
256 @SRCTOP="$(SRCDIR)" \
257 $(PERL) $(SRCDIR)/test/run_tests.pl list
258 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
259 @echo "Tests are not supported with your chosen Configure options"
260 @ : {- output_on() if !$disabled{tests}; "" -}
262 install: install_sw install_ssldirs install_docs
264 uninstall: uninstall_docs uninstall_sw
267 @set -e; for s in $(SHLIB_INFO); do \
268 s1=`echo "$$s" | cut -f1 -d";"`; \
269 s2=`echo "$$s" | cut -f2 -d";"`; \
272 if [ "$$s1" != "$$s2" ]; then \
281 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
283 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
284 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
287 $(RM) openssl.pc libcrypto.pc libssl.pc
288 -$(RM) `find . -type l -a \! -path "./.git/*"`
295 # This exists solely for those who still type 'make depend'
297 # We check if any depfile is newer than Makefile and decide to
298 # concatenate only if that is true.
300 @: {- output_off() if $disabled{makedepend}; "" -}
301 @if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \
302 ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \
303 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
305 for f in $(DEPS); do \
306 if [ -f $$f ]; then cat $$f; fi; \
307 done ) > Makefile.new; \
308 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
309 rm -f Makefile.new; \
311 mv -f Makefile.new Makefile; \
314 @: {- output_on() if $disabled{makedepend}; "" -}
316 # Install helper targets #############################################
318 install_sw: all install_dev install_engines install_runtime
320 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
322 install_docs: install_man_docs install_html_docs
324 uninstall_docs: uninstall_man_docs uninstall_html_docs
325 $(RM) -r -v $(DESTDIR)$(DOCDIR)
328 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
329 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
330 @set -e; for x in dummy $(MISC_SCRIPTS); do \
331 if [ "$$x" = "dummy" ]; then continue; fi; \
333 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
334 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
335 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
336 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
337 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
339 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"
340 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
341 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
342 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
345 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
346 @echo "*** Installing development files"
347 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
348 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
349 @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
350 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
351 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
352 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
353 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
354 $(BLDDIR)/include/openssl/*.h; do \
356 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
357 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
358 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
360 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
361 @set -e; for l in $(INSTALL_LIBS); do \
363 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
364 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
365 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
366 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
367 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
368 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
370 @ : {- output_off() if $disabled{shared}; "" -}
371 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
372 s1=`echo "$$s" | cut -f1 -d";"`; \
373 s2=`echo "$$s" | cut -f2 -d";"`; \
374 fn1=`basename $$s1`; \
375 fn2=`basename $$s2`; \
376 : {- output_off() if windowsdll(); "" -}; \
377 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
378 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
379 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
380 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
381 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
382 if [ "$$fn1" != "$$fn2" ]; then \
383 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
384 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
386 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
387 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
388 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
389 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
390 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
391 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
392 : {- output_on() unless windowsdll(); "" -}; \
394 @ : {- output_on() if $disabled{shared}; "" -}
395 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
396 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
397 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
398 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
399 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
400 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
401 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
402 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
403 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
404 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
407 @echo "*** Uninstalling development files"
408 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
409 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
410 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
411 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
412 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
413 $(BLDDIR)/include/openssl/*.h; do \
415 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
416 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
418 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
419 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
420 @set -e; for l in $(INSTALL_LIBS); do \
422 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
423 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
425 @ : {- output_off() if $disabled{shared}; "" -}
426 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
427 s1=`echo "$$s" | cut -f1 -d";"`; \
428 s2=`echo "$$s" | cut -f2 -d";"`; \
429 fn1=`basename $$s1`; \
430 fn2=`basename $$s2`; \
431 : {- output_off() if windowsdll(); "" -}; \
432 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
433 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
434 if [ "$$fn1" != "$$fn2" ]; then \
435 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
436 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
438 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
439 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
440 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
441 : {- output_on() unless windowsdll(); "" -}; \
443 @ : {- output_on() if $disabled{shared}; "" -}
444 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
445 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
446 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
447 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
448 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
451 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
452 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
453 @echo "*** Installing engines"
454 @set -e; for e in dummy $(INSTALL_ENGINES); do \
455 if [ "$$e" = "dummy" ]; then continue; fi; \
457 echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
458 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
459 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
460 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
461 $(DESTDIR)$(ENGINESDIR)/$$fn; \
465 @echo "*** Uninstalling engines"
466 @set -e; for e in dummy $(INSTALL_ENGINES); do \
467 if [ "$$e" = "dummy" ]; then continue; fi; \
469 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
472 echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
473 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
475 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
478 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
479 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
480 @ : {- output_off() if windowsdll(); "" -}
481 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
482 @ : {- output_on() if windowsdll(); "" -}
483 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
484 @echo "*** Installing runtime files"
485 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
486 if [ "$$s" = "dummy" ]; then continue; fi; \
488 : {- output_off() unless windowsdll(); "" -}; \
489 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
490 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
491 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
492 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
493 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
494 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
495 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
496 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
497 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
498 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
499 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
500 : {- output_on() if windowsdll(); "" -}; \
502 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
503 if [ "$$x" = "dummy" ]; then continue; fi; \
505 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
506 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
507 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
508 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
509 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
511 @set -e; for x in dummy $(BIN_SCRIPTS); do \
512 if [ "$$x" = "dummy" ]; then continue; fi; \
514 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
515 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
516 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
517 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
518 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
522 @echo "*** Uninstalling runtime files"
523 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
525 if [ "$$x" = "dummy" ]; then continue; fi; \
527 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
528 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
530 @set -e; for x in dummy $(BIN_SCRIPTS); \
532 if [ "$$x" = "dummy" ]; then continue; fi; \
534 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
535 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
537 @set -e; for x in dummy $(MISC_SCRIPTS); \
539 if [ "$$x" = "dummy" ]; then continue; fi; \
541 echo "$(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
542 $(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
544 @ : {- output_off() unless windowsdll(); "" -}
545 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
546 if [ "$$s" = "dummy" ]; then continue; fi; \
548 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
549 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
551 @ : {- output_on() unless windowsdll(); "" -}
552 $(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
553 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
554 -$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc
556 # A method to extract all names from a .pod file
557 # The first sed extracts everything between "=head1 NAME" and the next =head1
558 # The perl command joins all the lines into one
559 # The second sed removes the description and turns all commas into spaces
560 # Voilà , you have a space separated list of names!
561 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
562 $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \
563 sed -e 's/ - .*$$//;s/,/ /g'
566 here=`cd $(SRCDIR); pwd`; \
567 point=$$here/util/point.sh; \
568 for ds in apps:1 crypto:3 ssl:3; do \
569 defdir=`echo $$ds | cut -f1 -d:`; \
570 defsec=`echo $$ds | cut -f2 -d:`; \
571 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
572 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
573 [ -z "$$SEC" ] && SEC=$$defsec; \
574 fn=`basename $$p .pod`; \
576 NAME=`echo $$fn | tr [a-z] [A-Z]`; \
577 suf=`eval "echo $$OUTSUFFIX"`; \
578 top=`eval "echo $$OUTTOP"`; \
579 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
580 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
581 cat $$p | eval "$$GENERATE" \
582 > $$top/man$$SEC/$$fn$$suf; \
583 names=`cat $$p | $(EXTRACT_NAMES)`; \
584 ( cd $$top/man$$SEC; \
585 for n in $$names; do \
588 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
589 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
590 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
593 if [ "$$comp_n" != "$$comp_fn" ]; then \
594 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
595 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
602 here=`cd $(SRCDIR); pwd`; \
603 for ds in apps:1 crypto:3 ssl:3; do \
604 defdir=`echo $$ds | cut -f1 -d:`; \
605 defsec=`echo $$ds | cut -f2 -d:`; \
606 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
607 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
608 [ -z "$$SEC" ] && SEC=$$defsec; \
609 fn=`basename $$p .pod`; \
610 suf=`eval "echo $$OUTSUFFIX"`; \
611 top=`eval "echo $$OUTTOP"`; \
612 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
613 $(RM) $$top/man$$SEC/$$fn$$suf; \
614 names=`cat $$p | $(EXTRACT_NAMES)`; \
615 for n in $$names; do \
618 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
619 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
620 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
623 if [ "$$comp_n" != "$$comp_fn" ]; then \
624 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
625 $(RM) $$top/man$$SEC/$$n$$suf; \
628 ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
633 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
634 @echo "*** Installing manpages"
636 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
637 OUTTOP="$(DESTDIR)$(MANDIR)"; \
638 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
642 @echo "*** Uninstalling manpages"
644 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
645 OUTTOP="$(DESTDIR)$(MANDIR)"; \
649 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
650 @echo "*** Installing HTML manpages"
652 OUTSUFFIX='.$(HTMLSUFFIX)'; \
653 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
654 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
655 --podpath=apps:crypto:ssl --title=\$$Name \
656 | perl -pe 's|href=\"http://man.he.net/man|href=\"../man|g; s|href=\"(.*/man.*)(?<!\.html)\">|href=\"\$$1.html\">|g;'"; \
660 @echo "*** Uninstalling manpages"
662 OUTSUFFIX='.$(HTMLSUFFIX)'; \
663 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
667 # Developer targets (note: these are only available on Unix) #########
669 update: generate errors ordinals
671 generate: generate_apps generate_crypto_bn generate_crypto_objects \
672 generate_crypto_conf generate_crypto_asn1
674 # Test coverage is a good idea for the future
675 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
679 lint -DLINT $(INCLUDES) $(SRCS)
681 {- # because the program apps/openssl has object files as sources, and
682 # they then have the corresponding C files as source, we need to chain
683 # the lookups in %unified_info
684 my $apps_openssl = catfile("apps","openssl");
685 our @openssl_source = map { @{$unified_info{sources}->{$_}} }
686 @{$unified_info{sources}->{$apps_openssl}};
689 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
690 < apps/openssl.cnf > apps/openssl-vms.cnf )
691 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \
692 {- join(" ", @openssl_source) -} \
696 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
698 generate_crypto_objects:
699 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
700 crypto/objects/objects.txt \
701 crypto/objects/obj_mac.num \
702 include/openssl/obj_mac.h )
703 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
704 include/openssl/obj_mac.h \
705 crypto/objects/obj_dat.h )
706 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
707 crypto/objects/obj_mac.num \
708 crypto/objects/obj_xref.txt \
709 > crypto/objects/obj_xref.h )
711 generate_crypto_conf:
712 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
713 > crypto/conf/conf_def.h )
715 generate_crypto_asn1:
716 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
717 > crypto/asn1/charmap.h )
720 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
721 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
722 ( cd $(SRCDIR)/engines; \
724 $(PERL) ../util/mkerr.pl -conf $$e \
725 -nostatic -staticloader -write *.c; \
729 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
730 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
734 SRCTOP=../$(SRCDIR) \
735 BLDTOP=../$(BLDDIR) \
736 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
741 -etags `find . -name '*.[ch]' -o -name '*.pm'`
743 # Release targets (note: only available on Unix) #####################
745 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
748 TMPDIR=/var/tmp/openssl-copy.$$$$; \
750 mkdir -p $$TMPDIR/$$DISTDIR; \
752 git ls-tree -r --name-only --full-tree HEAD \
753 | grep -v '^fuzz/corpora' \
755 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
756 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
760 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
761 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
762 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
763 $(TAR_COMMAND) $$DISTDIR) \
764 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
766 cd $(SRCDIR); ls -l $(TARFILE).gz
769 @$(MAKE) PREPARE_CMD='./Configure dist' tar
771 # Helper targets #####################################################
773 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
775 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
776 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
777 mkdir -p "$(BLDDIR)/util"; \
778 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
780 $(BLDDIR)/util/shlib_wrap.sh: configdata.pm
781 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
782 mkdir -p "$(BLDDIR)/util"; \
783 ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
787 # Building targets ###################################################
789 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
791 @ ( echo 'prefix=$(INSTALLTOP)'; \
792 echo 'exec_prefix=$${prefix}'; \
793 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
794 echo 'includedir=$${prefix}/include'; \
796 echo 'Name: OpenSSL-libcrypto'; \
797 echo 'Description: OpenSSL cryptography library'; \
798 echo 'Version: '$(VERSION); \
799 echo 'Libs: -L$${libdir} -lcrypto'; \
800 echo 'Libs.private: $(EX_LIBS)'; \
801 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
804 @ ( echo 'prefix=$(INSTALLTOP)'; \
805 echo 'exec_prefix=$${prefix}'; \
806 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
807 echo 'includedir=$${prefix}/include'; \
809 echo 'Name: OpenSSL-libssl'; \
810 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
811 echo 'Version: '$(VERSION); \
812 echo 'Requires.private: libcrypto'; \
813 echo 'Libs: -L$${libdir} -lssl'; \
814 echo 'Libs.private: $(EX_LIBS)'; \
815 echo 'Cflags: -I$${includedir}' ) > libssl.pc
818 @ ( echo 'prefix=$(INSTALLTOP)'; \
819 echo 'exec_prefix=$${prefix}'; \
820 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
821 echo 'includedir=$${prefix}/include'; \
823 echo 'Name: OpenSSL'; \
824 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
825 echo 'Version: '$(VERSION); \
826 echo 'Requires: libssl libcrypto' ) > openssl.pc
828 configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -}
829 @echo "Detected changed: $?"
830 @echo "Reconfiguring..."
831 $(SRCDIR)/Configure reconf
832 @echo "**************************************************"
834 @echo "*** Please run the same make command again ***"
836 @echo "**************************************************"
841 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
843 # Helper function to figure out dependencies on libraries
844 # It takes a list of library names and outputs a list of dependencies
845 sub compute_lib_depends {
846 if ($disabled{shared}) {
847 return map { $_.$libext } @_;
850 # Depending on shared libraries:
851 # On Windows POSIX layers, we depend on {libname}.dll.a
852 # On Unix platforms, we depend on {shlibname}.so
853 return map { shlib_simple($_) } @_;
858 my $generator = join(" ", @{$args{generator}});
859 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
860 my $incs = join("", map { " -I".$_ } @{$args{incs}});
861 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
863 if ($args{src} !~ /\.[sS]$/) {
864 if ($args{generator}->[0] =~ m|^.*\.in$|) {
865 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
866 "util", "dofile.pl")),
867 rel2abs($config{builddir}));
869 $args{src}: $args{generator}->[0] $deps
870 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
871 "-o$target{build_file}" $generator > \$@
875 $args{src}: $args{generator}->[0] $deps
876 \$(PERL)$generator_incs $generator > \$@
880 if ($args{generator}->[0] =~ /\.pl$/) {
881 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
882 } elsif ($args{generator}->[0] =~ /\.m4$/) {
883 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
884 } elsif ($args{generator}->[0] =~ /\.S$/) {
887 die "Generator type for $args{src} unknown: $generator\n";
890 if (defined($generator)) {
891 # If the target is named foo.S in build.info, we want to
892 # end up generating foo.s in two steps.
893 if ($args{src} =~ /\.S$/) {
894 (my $target = $args{src}) =~ s|\.S$|.s|;
896 $target: $args{generator}->[0] $deps
897 ( trap "rm -f \$@.*" INT 0; \\
899 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
900 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
906 $args{src}: $args{generator}->[0] $deps
911 $args{src}: $args{generator}->[0] $deps
912 \$(CC) $incs \$(CFLAGS) -E \$< | \\
913 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
918 # Should one wonder about the end of the Perl snippet, it's because this
919 # second regexp eats up line endings as well, if the removed path is the
920 # last in the line. We may therefore need to put back a line ending.
923 my $obj = $args{obj};
924 my @srcs = map { if ($unified_info{generate}->{$_}) {
925 (my $x = $_) =~ s/\.S$/.s/; $x
929 } ( @{$args{srcs}} );
930 my $srcs = join(" ", @srcs);
931 my $deps = join(" ", @srcs, @{$args{deps}});
932 my $incs = join("", map { " -I".$_ } @{$args{incs}});
933 unless ($disabled{zlib}) {
934 if ($withargs{zlib_include}) {
935 $incs .= " -I".$withargs{zlib_include};
938 my $ecflags = { lib => '$(LIB_CFLAGS)',
939 dso => '$(DSO_CFLAGS)',
940 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
941 my $makedepprog = $config{makedepprog};
943 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
946 -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
947 >\$\@.tmp 2>/dev/null
948 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp
949 \@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\
955 $deps = $obj.$depext;
957 if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) {
960 \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
963 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
966 \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
967 \@touch $obj$depext.tmp
968 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
969 rm -f $obj$depext.tmp; \\
971 mv $obj$depext.tmp $obj$depext; \\
977 # On Unix, we build shlibs from static libs, so we're ignoring the
978 # object file array. We *know* this routine is only called when we've
979 # configure 'shared'.
982 my $lib = $args{lib};
983 my $shlib = $args{shlib};
984 my $libd = dirname($lib);
985 my $libn = basename($lib);
986 (my $libname = $libn) =~ s/^lib//;
987 my $linklibs = join("", map { my $d = dirname($_);
988 my $f = basename($_);
989 (my $l = $f) =~ s/^lib//;
990 " -L$d -l$l" } @{$args{deps}});
991 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
992 my $shlib_target = $target{shared_target};
993 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
994 my $target = shlib_simple($lib);
996 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
997 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
998 # With all other Unix platforms, we often build a shared library with the
999 # SO version built into the file name and a symlink without the SO version
1000 # It's not necessary to have both as targets. The choice falls on the
1001 # simplest, {libname}$shlibextimport for Windows POSIX layers and
1002 # {libname}$shlibextsimple for the Unix platforms.
1003 $target: $lib$libext $deps $ordinalsfile
1004 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1005 PLATFORM=\$(PLATFORM) \\
1006 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
1007 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
1008 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1009 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
1010 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
1011 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
1012 LDFLAGS='\$(LDFLAGS)' \\
1013 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
1014 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
1015 link_shlib.$shlib_target
1017 . (windowsdll() ? <<"EOF" : "");
1018 rm -f apps/$shlib$shlibext
1019 rm -f test/$shlib$shlibext
1020 cp -p $shlib$shlibext apps/
1021 cp -p $shlib$shlibext test/
1026 my $lib = $args{lib};
1027 my $libd = dirname($lib);
1028 my $libn = basename($lib);
1029 (my $libname = $libn) =~ s/^lib//;
1030 my $shlibdeps = join("", map { my $d = dirname($_);
1031 my $f = basename($_);
1032 (my $l = $f) =~ s/^lib//;
1033 " -L$d -l$l" } @{$args{deps}});
1034 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1035 my $shlib_target = $target{shared_target};
1036 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1037 my $target = dso($lib);
1039 $target: $objs $deps
1040 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1041 PLATFORM=\$(PLATFORM) \\
1042 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
1043 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
1044 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
1045 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
1046 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
1047 SHLIB_EXT=$dsoext \\
1048 LIBEXTRAS="$objs" \\
1049 link_dso.$shlib_target
1054 my $lib = $args{lib};
1055 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1059 \$(RANLIB) \$\@ || echo Never mind.
1064 my $bin = $args{bin};
1065 my $bind = dirname($bin);
1066 my $binn = basename($bin);
1067 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1068 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1069 my $linklibs = join("", map { my $d = dirname($_);
1070 my $f = basename($_);
1071 $d = "." if $d eq $f;
1072 (my $l = $f) =~ s/^lib//;
1073 " -L$d -l$l" } @{$args{deps}});
1074 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1076 $bin$exeext: $objs $deps
1078 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1079 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1080 APPNAME=$bin$exeext OBJECTS="$objs" \\
1081 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1082 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
1083 LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\
1084 link_app.$shlib_target
1089 my $script = $args{script};
1090 my $sources = join(" ", @{$args{sources}});
1091 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1092 "util", "dofile.pl")),
1093 rel2abs($config{builddir}));
1096 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1097 "-o$target{build_file}" $sources > "$script"
1103 my $dir = $args{dir};
1104 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1106 my %extinfo = ( dso => $dsoext,
1110 foreach my $type (("dso", "lib", "bin", "script")) {
1111 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1112 # For lib object files, we could update the library. However, it
1113 # was decided that it's enough to build the directory local object
1114 # files, so we don't need to add any actions, and the dependencies
1115 # are already taken care of.
1116 if ($type ne "lib") {
1117 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1118 if (dirname($prod) eq $dir) {
1119 push @deps, $prod.$extinfo{$type};
1121 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1127 my $deps = join(" ", @deps);
1128 my $actions = join("\n", "", @actions);
1130 $args{dir} $args{dir}/: $deps$actions
1133 "" # Important! This becomes part of the template result.