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 # Convenience variable for those who want to set the rpath in shared
157 # libraries and applications
158 LIBRPATH=$(INSTALLTOP)/$(LIBDIR)
160 MANDIR=$(INSTALLTOP)/share/man
161 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
162 HTMLDIR=$(DOCDIR)/html
164 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
165 # appended after the manpage file section number. "ssl" is popular,
166 # resulting in files such as config.5ssl rather than config.5.
172 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
173 CC= $(CROSS_COMPILE){- $target{cc} -}
174 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
175 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
176 LDFLAGS= {- $target{lflags} -}
177 PLIB_LDFLAGS= {- $target{plib_lflags} -}
178 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
179 LIB_CFLAGS={- $target{shared_cflag} || "" -}
180 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
181 DSO_CFLAGS={- $target{shared_cflag} || "" -}
182 DSO_LDFLAGS=$(LIB_LDFLAGS)
183 BIN_CFLAGS={- $target{bin_cflags} -}
185 PERL={- $config{perl} -}
187 ARFLAGS= {- $target{arflags} -}
188 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
189 RANLIB= {- $target{ranlib} -}
190 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
191 RCFLAGS={- $target{shared_rcflag} -}
192 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
195 TAR= {- $target{tar} || "tar" -}
196 TARFLAGS= {- $target{tarflags} -}
197 MAKEDEPEND={- $config{makedepprog} -}
200 NAME= $(BASENAME)-$(VERSION)
201 TARFILE= ../$(NAME).tar
203 # We let the C compiler driver to take care of .s files. This is done in
204 # order to be excused from maintaining a separate set of architecture
205 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
206 # gcc, then the driver will automatically translate it to -xarch=v8plus
207 # and pass it down to assembler.
210 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
212 # For x86 assembler: Set PROCESSOR to 386 if you want to support
214 PROCESSOR= {- $config{processor} -}
216 # We want error [and other] messages in English. Trouble is that make(1)
217 # doesn't pass macros down as environment variables unless there already
218 # was corresponding variable originally set. In other words we can only
219 # reassign environment variables, but not set new ones, not in portable
220 # manner that is. That's why we reassign several, just to be sure...
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 # We check if any depfile is newer than Makefile and decide to
296 # concatenate only if that is true.
298 @: {- output_off() if $disabled{makedepend}; "" -}
299 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
300 ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
301 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
303 for f in $(DEPS); do \
304 if [ -f $$f ]; then cat $$f; fi; \
305 done ) > Makefile.new; \
306 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
307 rm -f Makefile.new; \
309 mv -f Makefile.new Makefile; \
312 @: {- output_on() if $disabled{makedepend}; "" -}
314 # Install helper targets #############################################
316 install_sw: all install_dev install_engines install_runtime
318 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
320 install_docs: install_man_docs install_html_docs
322 uninstall_docs: uninstall_man_docs uninstall_html_docs
323 $(RM) -r -v $(DESTDIR)$(DOCDIR)
326 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
327 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
328 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
329 @set -e; for x in dummy $(MISC_SCRIPTS); do \
330 if [ "$$x" = "dummy" ]; then continue; fi; \
332 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
333 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
334 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
335 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
336 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
338 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
339 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
340 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
341 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
342 @if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
343 echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
344 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
345 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
349 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
350 @echo "*** Installing development files"
351 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
352 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
353 @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
354 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
355 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
356 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
357 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
358 $(BLDDIR)/include/openssl/*.h; do \
360 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
361 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
362 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
364 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
365 @set -e; for l in $(INSTALL_LIBS); do \
367 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
368 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
369 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
370 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
371 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
372 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
374 @ : {- output_off() if $disabled{shared}; "" -}
375 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
376 s1=`echo "$$s" | cut -f1 -d";"`; \
377 s2=`echo "$$s" | cut -f2 -d";"`; \
378 fn1=`basename $$s1`; \
379 fn2=`basename $$s2`; \
380 : {- output_off() if windowsdll(); "" -}; \
381 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
382 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
383 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
384 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
385 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
386 if [ "$$fn1" != "$$fn2" ]; then \
387 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
388 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
390 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
391 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
392 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
393 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
394 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
395 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
396 : {- output_on() unless windowsdll(); "" -}; \
398 @ : {- output_on() if $disabled{shared}; "" -}
399 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
400 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
401 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
402 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
403 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
404 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
405 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
406 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
407 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
408 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
411 @echo "*** Uninstalling development files"
412 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
413 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
414 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
415 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
416 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
417 $(BLDDIR)/include/openssl/*.h; do \
419 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
420 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
422 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
423 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
424 @set -e; for l in $(INSTALL_LIBS); do \
426 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
427 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
429 @ : {- output_off() if $disabled{shared}; "" -}
430 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
431 s1=`echo "$$s" | cut -f1 -d";"`; \
432 s2=`echo "$$s" | cut -f2 -d";"`; \
433 fn1=`basename $$s1`; \
434 fn2=`basename $$s2`; \
435 : {- output_off() if windowsdll(); "" -}; \
436 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
437 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
438 if [ "$$fn1" != "$$fn2" ]; then \
439 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
440 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
442 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
443 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
444 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
445 : {- output_on() unless windowsdll(); "" -}; \
447 @ : {- output_on() if $disabled{shared}; "" -}
448 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
449 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
450 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
451 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
452 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
455 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
456 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
457 @echo "*** Installing engines"
458 @set -e; for e in dummy $(INSTALL_ENGINES); do \
459 if [ "$$e" = "dummy" ]; then continue; fi; \
461 echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
462 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
463 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
464 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
465 $(DESTDIR)$(ENGINESDIR)/$$fn; \
469 @echo "*** Uninstalling engines"
470 @set -e; for e in dummy $(INSTALL_ENGINES); do \
471 if [ "$$e" = "dummy" ]; then continue; fi; \
473 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
476 echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
477 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
479 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
482 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
483 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
484 @ : {- output_off() if windowsdll(); "" -}
485 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
486 @ : {- output_on() if windowsdll(); "" -}
487 @echo "*** Installing runtime files"
488 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
489 if [ "$$s" = "dummy" ]; then continue; fi; \
491 : {- output_off() unless windowsdll(); "" -}; \
492 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
493 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
494 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
495 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
496 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
497 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
498 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
499 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
500 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
501 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
502 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
503 : {- output_on() if windowsdll(); "" -}; \
505 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
506 if [ "$$x" = "dummy" ]; then continue; fi; \
508 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
509 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
510 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
511 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
512 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
514 @set -e; for x in dummy $(BIN_SCRIPTS); do \
515 if [ "$$x" = "dummy" ]; then continue; fi; \
517 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
518 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
519 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
520 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
521 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
525 @echo "*** Uninstalling runtime files"
526 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
528 if [ "$$x" = "dummy" ]; then continue; fi; \
530 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
531 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
533 @set -e; for x in dummy $(BIN_SCRIPTS); \
535 if [ "$$x" = "dummy" ]; then continue; fi; \
537 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
538 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
540 @ : {- output_off() unless windowsdll(); "" -}
541 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
542 if [ "$$s" = "dummy" ]; then continue; fi; \
544 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
545 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
547 @ : {- output_on() unless windowsdll(); "" -}
548 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
550 # A method to extract all names from a .pod file
551 # The first sed extracts everything between "=head1 NAME" and the next =head1
552 # The perl command joins all the lines into one
553 # The second sed removes the description and turns all commas into spaces
554 # Voilà , you have a space separated list of names!
555 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
556 $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \
557 sed -e 's/ - .*$$//;s/,/ /g'
560 here=`cd $(SRCDIR); pwd`; \
561 point=$$here/util/point.sh; \
562 for ds in apps:1 crypto:3 ssl:3; do \
563 defdir=`echo $$ds | cut -f1 -d:`; \
564 defsec=`echo $$ds | cut -f2 -d:`; \
565 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
566 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
567 [ -z "$$SEC" ] && SEC=$$defsec; \
568 fn=`basename $$p .pod`; \
570 NAME=`echo $$fn | tr '[a-z]' '[A-Z]'`; \
571 suf=`eval "echo $$OUTSUFFIX"`; \
572 top=`eval "echo $$OUTTOP"`; \
573 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
574 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
575 cat $$p | eval "$$GENERATE" \
576 > $$top/man$$SEC/$$fn$$suf; \
577 names=`cat $$p | $(EXTRACT_NAMES)`; \
578 ( cd $$top/man$$SEC; \
579 for n in $$names; do \
582 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
583 comp_n=`echo "$$n" | tr '[A-Z]' '[a-z]'`; \
584 comp_fn=`echo "$$fn" | tr '[A-Z]' '[a-z]'`; \
587 if [ "$$comp_n" != "$$comp_fn" ]; then \
588 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
589 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
596 here=`cd $(SRCDIR); pwd`; \
597 for ds in apps:1 crypto:3 ssl:3; do \
598 defdir=`echo $$ds | cut -f1 -d:`; \
599 defsec=`echo $$ds | cut -f2 -d:`; \
600 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
601 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
602 [ -z "$$SEC" ] && SEC=$$defsec; \
603 fn=`basename $$p .pod`; \
604 suf=`eval "echo $$OUTSUFFIX"`; \
605 top=`eval "echo $$OUTTOP"`; \
606 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
607 $(RM) $$top/man$$SEC/$$fn$$suf; \
608 names=`cat $$p | $(EXTRACT_NAMES)`; \
609 for n in $$names; do \
612 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
613 comp_n=`echo "$$n" | tr '[A-Z]' '[a-z]'`; \
614 comp_fn=`echo "$$fn" | tr '[A-Z]' '[a-z]'`; \
617 if [ "$$comp_n" != "$$comp_fn" ]; then \
618 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
619 $(RM) $$top/man$$SEC/$$n$$suf; \
622 ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
627 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
628 @echo "*** Installing manpages"
630 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
631 OUTTOP="$(DESTDIR)$(MANDIR)"; \
632 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
636 @echo "*** Uninstalling manpages"
638 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
639 OUTTOP="$(DESTDIR)$(MANDIR)"; \
643 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
644 @echo "*** Installing HTML manpages"
646 OUTSUFFIX='.$(HTMLSUFFIX)'; \
647 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
648 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
649 --podpath=apps:crypto:ssl --title=\$$Name \
650 | perl -pe 's|href=\"http://man.he.net/man|href=\"../man|g; s|href=\"(.*/man.*)(?<!\.html)\">|href=\"\$$1.html\">|g;'"; \
654 @echo "*** Uninstalling manpages"
656 OUTSUFFIX='.$(HTMLSUFFIX)'; \
657 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
661 # Developer targets (note: these are only available on Unix) #########
663 update: generate errors ordinals
665 generate: generate_apps generate_crypto_bn generate_crypto_objects \
666 generate_crypto_conf generate_crypto_asn1
668 # Test coverage is a good idea for the future
669 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
673 lint -DLINT $(INCLUDES) $(SRCS)
675 {- # because the program apps/openssl has object files as sources, and
676 # they then have the corresponding C files as source, we need to chain
677 # the lookups in %unified_info
678 my $apps_openssl = catfile("apps","openssl");
679 our @openssl_source = map { @{$unified_info{sources}->{$_}} }
680 @{$unified_info{sources}->{$apps_openssl}};
683 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
684 < apps/openssl.cnf > apps/openssl-vms.cnf )
685 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \
686 {- join(" ", @openssl_source) -} \
690 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
692 generate_crypto_objects:
693 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
694 crypto/objects/objects.txt \
695 crypto/objects/obj_mac.num \
696 include/openssl/obj_mac.h )
697 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
698 include/openssl/obj_mac.h \
699 crypto/objects/obj_dat.h )
700 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
701 crypto/objects/obj_mac.num \
702 crypto/objects/obj_xref.txt \
703 > crypto/objects/obj_xref.h )
705 generate_crypto_conf:
706 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
707 > crypto/conf/conf_def.h )
709 generate_crypto_asn1:
710 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
711 > crypto/asn1/charmap.h )
714 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
715 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
716 ( cd $(SRCDIR)/engines; \
718 $(PERL) ../util/mkerr.pl -conf $$e \
719 -nostatic -staticloader -write *.c; \
723 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
724 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
728 SRCTOP=../$(SRCDIR) \
729 BLDTOP=../$(BLDDIR) \
730 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
735 -etags `find . -name '*.[ch]' -o -name '*.pm'`
737 # Release targets (note: only available on Unix) #####################
739 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
742 TMPDIR=/var/tmp/openssl-copy.$$$$; \
744 mkdir -p $$TMPDIR/$$DISTDIR; \
746 git ls-tree -r --name-only --full-tree HEAD \
747 | grep -v '^fuzz/corpora' \
749 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
750 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
754 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
755 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
756 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
757 $(TAR_COMMAND) $$DISTDIR) \
758 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
760 cd $(SRCDIR); ls -l $(TARFILE).gz
763 @$(MAKE) PREPARE_CMD='./Configure dist' tar
765 # Helper targets #####################################################
767 link-utils: $(BLDDIR)/util/opensslwrap.sh
769 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
770 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
771 mkdir -p "$(BLDDIR)/util"; \
772 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
777 # Building targets ###################################################
779 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
781 @ ( echo 'prefix=$(INSTALLTOP)'; \
782 echo 'exec_prefix=$${prefix}'; \
783 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
784 echo 'includedir=$${prefix}/include'; \
785 echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
787 echo 'Name: OpenSSL-libcrypto'; \
788 echo 'Description: OpenSSL cryptography library'; \
789 echo 'Version: '$(VERSION); \
790 echo 'Libs: -L$${libdir} -lcrypto'; \
791 echo 'Libs.private: $(EX_LIBS)'; \
792 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
795 @ ( echo 'prefix=$(INSTALLTOP)'; \
796 echo 'exec_prefix=$${prefix}'; \
797 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
798 echo 'includedir=$${prefix}/include'; \
800 echo 'Name: OpenSSL-libssl'; \
801 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
802 echo 'Version: '$(VERSION); \
803 echo 'Requires.private: libcrypto'; \
804 echo 'Libs: -L$${libdir} -lssl'; \
805 echo 'Libs.private: $(EX_LIBS)'; \
806 echo 'Cflags: -I$${includedir}' ) > libssl.pc
809 @ ( echo 'prefix=$(INSTALLTOP)'; \
810 echo 'exec_prefix=$${prefix}'; \
811 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
812 echo 'includedir=$${prefix}/include'; \
814 echo 'Name: OpenSSL'; \
815 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
816 echo 'Version: '$(VERSION); \
817 echo 'Requires: libssl libcrypto' ) > openssl.pc
819 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
820 @echo "Detected changed: $?"
821 @echo "Reconfiguring..."
822 $(SRCDIR)/Configure reconf
823 @echo "**************************************************"
825 @echo "*** Please run the same make command again ***"
827 @echo "**************************************************"
832 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
834 # Helper function to figure out dependencies on libraries
835 # It takes a list of library names and outputs a list of dependencies
836 sub compute_lib_depends {
837 if ($disabled{shared}) {
838 return map { $_.$libext } @_;
841 # Depending on shared libraries:
842 # On Windows POSIX layers, we depend on {libname}.dll.a
843 # On Unix platforms, we depend on {shlibname}.so
844 return map { shlib_simple($_) } @_;
849 my $generator = join(" ", @{$args{generator}});
850 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
851 my $incs = join("", map { " -I".$_ } @{$args{incs}});
852 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
854 if ($args{src} !~ /\.[sS]$/) {
855 if ($args{generator}->[0] =~ m|^.*\.in$|) {
856 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
857 "util", "dofile.pl")),
858 rel2abs($config{builddir}));
860 $args{src}: $args{generator}->[0] $deps
861 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
862 "-o$target{build_file}" $generator > \$@
866 $args{src}: $args{generator}->[0] $deps
867 \$(PERL)$generator_incs $generator > \$@
871 if ($args{generator}->[0] =~ /\.pl$/) {
872 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
873 } elsif ($args{generator}->[0] =~ /\.m4$/) {
874 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
875 } elsif ($args{generator}->[0] =~ /\.S$/) {
878 die "Generator type for $args{src} unknown: $generator\n";
881 if (defined($generator)) {
882 # If the target is named foo.S in build.info, we want to
883 # end up generating foo.s in two steps.
884 if ($args{src} =~ /\.S$/) {
885 (my $target = $args{src}) =~ s|\.S$|.s|;
887 $target: $args{generator}->[0] $deps
888 ( trap "rm -f \$@.*" INT 0; \\
890 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
891 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
897 $args{src}: $args{generator}->[0] $deps
902 $args{src}: $args{generator}->[0] $deps
903 \$(CC) $incs \$(CFLAGS) -E \$< | \\
904 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
909 # Should one wonder about the end of the Perl snippet, it's because this
910 # second regexp eats up line endings as well, if the removed path is the
911 # last in the line. We may therefore need to put back a line ending.
914 my $obj = $args{obj};
915 my @srcs = map { if ($unified_info{generate}->{$_}) {
916 (my $x = $_) =~ s/\.S$/.s/; $x
920 } ( @{$args{srcs}} );
921 my $srcs = join(" ", @srcs);
922 my $deps = join(" ", @srcs, @{$args{deps}});
923 my $incs = join("", map { " -I".$_ } @{$args{incs}});
924 unless ($disabled{zlib}) {
925 if ($withargs{zlib_include}) {
926 $incs .= " -I".$withargs{zlib_include};
929 my $ecflags = { lib => '$(LIB_CFLAGS)',
930 dso => '$(DSO_CFLAGS)',
931 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
932 my $makedepprog = $config{makedepprog};
933 my $recipe = <<"EOF";
936 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
938 \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
939 \@touch $obj$depext.tmp
940 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
941 rm -f $obj$depext.tmp; \\
943 mv $obj$depext.tmp $obj$depext; \\
948 \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
950 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
952 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
953 >$obj$depext.tmp 2>/dev/null
954 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
955 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
956 rm -f $obj$depext.tmp; \\
958 mv $obj$depext.tmp $obj$depext; \\
965 # On Unix, we build shlibs from static libs, so we're ignoring the
966 # object file array. We *know* this routine is only called when we've
967 # configure 'shared'.
970 my $lib = $args{lib};
971 my $shlib = $args{shlib};
972 my $libd = dirname($lib);
973 my $libn = basename($lib);
974 (my $libname = $libn) =~ s/^lib//;
975 my $linklibs = join("", map { my $d = dirname($_);
976 my $f = basename($_);
977 (my $l = $f) =~ s/^lib//;
978 " -L$d -l$l" } @{$args{deps}});
979 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
980 my $shlib_target = $target{shared_target};
981 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
982 my $target = shlib_simple($lib);
984 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
985 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
986 # With all other Unix platforms, we often build a shared library with the
987 # SO version built into the file name and a symlink without the SO version
988 # It's not necessary to have both as targets. The choice falls on the
989 # simplest, {libname}$shlibextimport for Windows POSIX layers and
990 # {libname}$shlibextsimple for the Unix platforms.
991 $target: $lib$libext $deps $ordinalsfile
992 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
993 PLATFORM=\$(PLATFORM) \\
994 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
995 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
996 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
997 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
998 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
999 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
1000 LDFLAGS='\$(LDFLAGS)' \\
1001 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
1002 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
1003 link_shlib.$shlib_target
1005 . (windowsdll() ? <<"EOF" : "");
1006 rm -f apps/$shlib$shlibext
1007 rm -f test/$shlib$shlibext
1008 cp -p $shlib$shlibext apps/
1009 cp -p $shlib$shlibext test/
1014 my $lib = $args{lib};
1015 my $libd = dirname($lib);
1016 my $libn = basename($lib);
1017 (my $libname = $libn) =~ s/^lib//;
1018 my $shlibdeps = join("", map { my $d = dirname($_);
1019 my $f = basename($_);
1020 (my $l = $f) =~ s/^lib//;
1021 " -L$d -l$l" } @{$args{deps}});
1022 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1023 my $shlib_target = $target{shared_target};
1024 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1025 my $target = dso($lib);
1027 $target: $objs $deps
1028 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1029 PLATFORM=\$(PLATFORM) \\
1030 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
1031 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
1032 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
1033 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
1034 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
1035 SHLIB_EXT=$dsoext \\
1036 LIBEXTRAS="$objs" \\
1037 link_dso.$shlib_target
1042 my $lib = $args{lib};
1043 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1047 \$(RANLIB) \$\@ || echo Never mind.
1052 my $bin = $args{bin};
1053 my $bind = dirname($bin);
1054 my $binn = basename($bin);
1055 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1056 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1057 my $linklibs = join("", map { my $d = dirname($_);
1058 my $f = basename($_);
1059 $d = "." if $d eq $f;
1060 (my $l = $f) =~ s/^lib//;
1061 " -L$d -l$l" } @{$args{deps}});
1062 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1064 $bin$exeext: $objs $deps
1066 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1067 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1068 APPNAME=$bin$exeext OBJECTS="$objs" \\
1069 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1070 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
1071 LDFLAGS='\$(LDFLAGS)' \\
1072 link_app.$shlib_target
1077 my $script = $args{script};
1078 my $sources = join(" ", @{$args{sources}});
1079 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1080 "util", "dofile.pl")),
1081 rel2abs($config{builddir}));
1084 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1085 "-o$target{build_file}" $sources > "$script"
1091 my $dir = $args{dir};
1092 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1094 my %extinfo = ( dso => $dsoext,
1098 foreach my $type (("dso", "lib", "bin", "script")) {
1099 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1100 # For lib object files, we could update the library. However, it
1101 # was decided that it's enough to build the directory local object
1102 # files, so we don't need to add any actions, and the dependencies
1103 # are already taken care of.
1104 if ($type ne "lib") {
1105 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1106 if (dirname($prod) eq $dir) {
1107 push @deps, $prod.$extinfo{$type};
1109 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1115 my $deps = join(" ", @deps);
1116 my $actions = join("\n", "", @actions);
1118 $args{dir} $args{dir}/: $deps$actions
1121 "" # Important! This becomes part of the template result.