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 DSO_CFLAGS={- $target{shared_cflag} || "" -}
178 DSO_LDFLAGS=$(LIB_LDFLAGS)
179 BIN_CFLAGS={- $target{bin_cflags} -}
181 PERL={- $config{perl} -}
183 ARFLAGS= {- $target{arflags} -}
184 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
185 RANLIB= {- $target{ranlib} -}
186 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
187 RCFLAGS={- $target{shared_rcflag} -}
188 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
191 TAR= {- $target{tar} || "tar" -}
192 TARFLAGS= {- $target{tarflags} -}
193 MAKEDEPEND={- $config{makedepprog} -}
196 NAME= $(BASENAME)-$(VERSION)
197 TARFILE= ../$(NAME).tar
199 # We let the C compiler driver to take care of .s files. This is done in
200 # order to be excused from maintaining a separate set of architecture
201 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
202 # gcc, then the driver will automatically translate it to -xarch=v8plus
203 # and pass it down to assembler.
206 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
208 # For x86 assembler: Set PROCESSOR to 386 if you want to support
210 PROCESSOR= {- $config{processor} -}
212 # We want error [and other] messages in English. Trouble is that make(1)
213 # doesn't pass macros down as environment variables unless there already
214 # was corresponding variable originally set. In other words we can only
215 # reassign environment variables, but not set new ones, not in portable
216 # manner that is. That's why we reassign several, just to be sure...
221 # The main targets ###################################################
223 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
224 {- dependmagic('build_libs'); -}: build_libs_nodep
225 {- dependmagic('build_engines'); -}: build_engines_nodep
226 {- dependmagic('build_programs'); -}: build_programs_nodep
228 build_generated: $(GENERATED_MANDATORY)
229 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
230 build_engines_nodep: $(ENGINES)
231 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
233 # Kept around for backward compatibility
234 build_apps build_tests: build_programs
237 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
238 @ : {- output_off() if $disabled{tests}; "" -}
240 SRCTOP=../$(SRCDIR) \
241 BLDTOP=../$(BLDDIR) \
243 EXE_EXT={- $exeext -} \
244 OPENSSL_ENGINES=../$(BLDDIR)/engines \
245 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
246 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
247 @echo "Tests are not supported with your chosen Configure options"
248 @ : {- output_on() if !$disabled{tests}; "" -}
251 @ : {- output_off() if $disabled{tests}; "" -}
252 @SRCTOP="$(SRCDIR)" \
253 $(PERL) $(SRCDIR)/test/run_tests.pl list
254 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
255 @echo "Tests are not supported with your chosen Configure options"
256 @ : {- output_on() if !$disabled{tests}; "" -}
258 install: install_sw install_ssldirs install_docs
260 uninstall: uninstall_docs uninstall_sw
263 @set -e; for s in $(SHLIB_INFO); do \
264 s1=`echo "$$s" | cut -f1 -d";"`; \
265 s2=`echo "$$s" | cut -f2 -d";"`; \
268 if [ "$$s1" != "$$s2" ]; then \
277 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
279 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
280 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
283 $(RM) openssl.pc libcrypto.pc libssl.pc
284 -$(RM) `find . -type l -a \! -path "./.git/*"`
291 # We check if any depfile is newer than Makefile and decide to
292 # concatenate only if that is true.
294 @: {- output_off() if $disabled{makedepend}; "" -}
295 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
296 ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \
297 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
299 for f in $(DEPS); do \
300 if [ -f $$f ]; then cat $$f; fi; \
301 done ) > Makefile.new; \
302 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
303 rm -f Makefile.new; \
305 mv -f Makefile.new Makefile; \
308 @: {- output_on() if $disabled{makedepend}; "" -}
310 # Install helper targets #############################################
312 install_sw: all install_dev install_engines install_runtime
314 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
316 install_docs: install_man_docs install_html_docs
318 uninstall_docs: uninstall_man_docs uninstall_html_docs
319 $(RM) -r -v $(DESTDIR)$(DOCDIR)
322 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
323 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
324 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
325 @set -e; for x in dummy $(MISC_SCRIPTS); do \
326 if [ "$$x" = "dummy" ]; then continue; fi; \
328 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
329 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
330 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
331 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
332 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
334 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
335 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
336 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
337 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
338 @if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
339 echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
340 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
341 chmod 644 $(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 @echo "*** Installing runtime files"
484 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
485 if [ "$$s" = "dummy" ]; then continue; fi; \
487 : {- output_off() unless windowsdll(); "" -}; \
488 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
489 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
490 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
491 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
492 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
493 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
494 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
495 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
496 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
497 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
498 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
499 : {- output_on() if windowsdll(); "" -}; \
501 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
502 if [ "$$x" = "dummy" ]; then continue; fi; \
504 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
505 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
506 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
507 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
508 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
510 @set -e; for x in dummy $(BIN_SCRIPTS); do \
511 if [ "$$x" = "dummy" ]; then continue; fi; \
513 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
514 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
515 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
516 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
517 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
521 @echo "*** Uninstalling runtime files"
522 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
524 if [ "$$x" = "dummy" ]; then continue; fi; \
526 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
527 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
529 @set -e; for x in dummy $(BIN_SCRIPTS); \
531 if [ "$$x" = "dummy" ]; then continue; fi; \
533 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
534 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
536 @ : {- output_off() unless windowsdll(); "" -}
537 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
538 if [ "$$s" = "dummy" ]; then continue; fi; \
540 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
541 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
543 @ : {- output_on() unless windowsdll(); "" -}
544 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
546 # A method to extract all names from a .pod file
547 # The first sed extracts everything between "=head1 NAME" and the next =head1
548 # The perl command joins all the lines into one
549 # The second sed removes the description and turns all commas into spaces
550 # Voilà , you have a space separated list of names!
551 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
552 $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \
553 sed -e 's/ - .*$$//;s/,/ /g'
556 here=`cd $(SRCDIR); pwd`; \
557 point=$$here/util/point.sh; \
558 for ds in apps:1 crypto:3 ssl:3; do \
559 defdir=`echo $$ds | cut -f1 -d:`; \
560 defsec=`echo $$ds | cut -f2 -d:`; \
561 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
562 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
563 [ -z "$$SEC" ] && SEC=$$defsec; \
564 fn=`basename $$p .pod`; \
566 NAME=`echo $$fn | tr '[a-z]' '[A-Z]'`; \
567 suf=`eval "echo $$OUTSUFFIX"`; \
568 top=`eval "echo $$OUTTOP"`; \
569 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
570 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
571 cat $$p | eval "$$GENERATE" \
572 > $$top/man$$SEC/$$fn$$suf; \
573 names=`cat $$p | $(EXTRACT_NAMES)`; \
574 ( cd $$top/man$$SEC; \
575 for n in $$names; do \
578 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
579 comp_n=`echo "$$n" | tr '[A-Z]' '[a-z]'`; \
580 comp_fn=`echo "$$fn" | tr '[A-Z]' '[a-z]'`; \
583 if [ "$$comp_n" != "$$comp_fn" ]; then \
584 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
585 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
592 here=`cd $(SRCDIR); pwd`; \
593 for ds in apps:1 crypto:3 ssl:3; do \
594 defdir=`echo $$ds | cut -f1 -d:`; \
595 defsec=`echo $$ds | cut -f2 -d:`; \
596 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
597 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
598 [ -z "$$SEC" ] && SEC=$$defsec; \
599 fn=`basename $$p .pod`; \
600 suf=`eval "echo $$OUTSUFFIX"`; \
601 top=`eval "echo $$OUTTOP"`; \
602 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
603 $(RM) $$top/man$$SEC/$$fn$$suf; \
604 names=`cat $$p | $(EXTRACT_NAMES)`; \
605 for n in $$names; do \
608 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
609 comp_n=`echo "$$n" | tr '[A-Z]' '[a-z]'`; \
610 comp_fn=`echo "$$fn" | tr '[A-Z]' '[a-z]'`; \
613 if [ "$$comp_n" != "$$comp_fn" ]; then \
614 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
615 $(RM) $$top/man$$SEC/$$n$$suf; \
618 ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
623 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
624 @echo "*** Installing manpages"
626 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
627 OUTTOP="$(DESTDIR)$(MANDIR)"; \
628 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
632 @echo "*** Uninstalling manpages"
634 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
635 OUTTOP="$(DESTDIR)$(MANDIR)"; \
639 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
640 @echo "*** Installing HTML manpages"
642 OUTSUFFIX='.$(HTMLSUFFIX)'; \
643 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
644 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
645 --podpath=apps:crypto:ssl --title=\$$Name \
646 | perl -pe 's|href=\"http://man.he.net/man|href=\"../man|g; s|href=\"(.*/man.*)(?<!\.html)\">|href=\"\$$1.html\">|g;'"; \
650 @echo "*** Uninstalling manpages"
652 OUTSUFFIX='.$(HTMLSUFFIX)'; \
653 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
657 # Developer targets (note: these are only available on Unix) #########
659 update: generate errors ordinals
661 generate: generate_apps generate_crypto_bn generate_crypto_objects \
662 generate_crypto_conf generate_crypto_asn1
664 # Test coverage is a good idea for the future
665 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
669 lint -DLINT $(INCLUDES) $(SRCS)
671 {- # because the program apps/openssl has object files as sources, and
672 # they then have the corresponding C files as source, we need to chain
673 # the lookups in %unified_info
674 my $apps_openssl = catfile("apps","openssl");
675 our @openssl_source = map { @{$unified_info{sources}->{$_}} }
676 @{$unified_info{sources}->{$apps_openssl}};
679 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
680 < apps/openssl.cnf > apps/openssl-vms.cnf )
681 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \
682 {- join(" ", @openssl_source) -} \
686 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
688 generate_crypto_objects:
689 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
690 crypto/objects/objects.txt \
691 crypto/objects/obj_mac.num \
692 include/openssl/obj_mac.h )
693 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
694 include/openssl/obj_mac.h \
695 crypto/objects/obj_dat.h )
696 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
697 crypto/objects/obj_mac.num \
698 crypto/objects/obj_xref.txt \
699 > crypto/objects/obj_xref.h )
701 generate_crypto_conf:
702 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
703 > crypto/conf/conf_def.h )
705 generate_crypto_asn1:
706 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
707 > crypto/asn1/charmap.h )
710 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
711 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
712 ( cd $(SRCDIR)/engines; \
714 $(PERL) ../util/mkerr.pl -conf $$e \
715 -nostatic -staticloader -write *.c; \
719 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
720 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
724 SRCTOP=../$(SRCDIR) \
725 BLDTOP=../$(BLDDIR) \
726 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
731 -etags `find . -name '*.[ch]' -o -name '*.pm'`
733 # Release targets (note: only available on Unix) #####################
735 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
738 TMPDIR=/var/tmp/openssl-copy.$$$$; \
740 mkdir -p $$TMPDIR/$$DISTDIR; \
742 git ls-tree -r --name-only --full-tree HEAD \
743 | grep -v '^fuzz/corpora' \
745 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
746 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
750 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
751 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
752 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
753 $(TAR_COMMAND) $$DISTDIR) \
754 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
756 cd $(SRCDIR); ls -l $(TARFILE).gz
759 @$(MAKE) PREPARE_CMD='./Configure dist' tar
761 # Helper targets #####################################################
763 link-utils: $(BLDDIR)/util/opensslwrap.sh
765 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
766 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
767 mkdir -p "$(BLDDIR)/util"; \
768 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
773 # Building targets ###################################################
775 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
777 @ ( echo 'prefix=$(INSTALLTOP)'; \
778 echo 'exec_prefix=$${prefix}'; \
779 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
780 echo 'includedir=$${prefix}/include'; \
781 echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
783 echo 'Name: OpenSSL-libcrypto'; \
784 echo 'Description: OpenSSL cryptography library'; \
785 echo 'Version: '$(VERSION); \
786 echo 'Libs: -L$${libdir} -lcrypto'; \
787 echo 'Libs.private: $(EX_LIBS)'; \
788 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
791 @ ( echo 'prefix=$(INSTALLTOP)'; \
792 echo 'exec_prefix=$${prefix}'; \
793 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
794 echo 'includedir=$${prefix}/include'; \
796 echo 'Name: OpenSSL-libssl'; \
797 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
798 echo 'Version: '$(VERSION); \
799 echo 'Requires.private: libcrypto'; \
800 echo 'Libs: -L$${libdir} -lssl'; \
801 echo 'Libs.private: $(EX_LIBS)'; \
802 echo 'Cflags: -I$${includedir}' ) > libssl.pc
805 @ ( echo 'prefix=$(INSTALLTOP)'; \
806 echo 'exec_prefix=$${prefix}'; \
807 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
808 echo 'includedir=$${prefix}/include'; \
810 echo 'Name: OpenSSL'; \
811 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
812 echo 'Version: '$(VERSION); \
813 echo 'Requires: libssl libcrypto' ) > openssl.pc
815 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
816 @echo "Detected changed: $?"
817 @echo "Reconfiguring..."
818 $(SRCDIR)/Configure reconf
819 @echo "**************************************************"
821 @echo "*** Please run the same make command again ***"
823 @echo "**************************************************"
828 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
830 # Helper function to figure out dependencies on libraries
831 # It takes a list of library names and outputs a list of dependencies
832 sub compute_lib_depends {
833 if ($disabled{shared}) {
834 return map { $_.$libext } @_;
837 # Depending on shared libraries:
838 # On Windows POSIX layers, we depend on {libname}.dll.a
839 # On Unix platforms, we depend on {shlibname}.so
840 return map { shlib_simple($_) } @_;
845 my $generator = join(" ", @{$args{generator}});
846 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
847 my $incs = join("", map { " -I".$_ } @{$args{incs}});
848 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
850 if ($args{src} !~ /\.[sS]$/) {
851 if ($args{generator}->[0] =~ m|^.*\.in$|) {
852 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
853 "util", "dofile.pl")),
854 rel2abs($config{builddir}));
856 $args{src}: $args{generator}->[0] $deps
857 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
858 "-o$target{build_file}" $generator > \$@
862 $args{src}: $args{generator}->[0] $deps
863 \$(PERL)$generator_incs $generator > \$@
867 if ($args{generator}->[0] =~ /\.pl$/) {
868 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
869 } elsif ($args{generator}->[0] =~ /\.m4$/) {
870 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
871 } elsif ($args{generator}->[0] =~ /\.S$/) {
874 die "Generator type for $args{src} unknown: $generator\n";
877 if (defined($generator)) {
878 # If the target is named foo.S in build.info, we want to
879 # end up generating foo.s in two steps.
880 if ($args{src} =~ /\.S$/) {
881 (my $target = $args{src}) =~ s|\.S$|.s|;
883 $target: $args{generator}->[0] $deps
884 ( trap "rm -f \$@.*" INT 0; \\
886 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
887 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
893 $args{src}: $args{generator}->[0] $deps
898 $args{src}: $args{generator}->[0] $deps
899 \$(CC) $incs \$(CFLAGS) -E \$< | \\
900 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
905 # Should one wonder about the end of the Perl snippet, it's because this
906 # second regexp eats up line endings as well, if the removed path is the
907 # last in the line. We may therefore need to put back a line ending.
910 my $obj = $args{obj};
911 my @srcs = map { if ($unified_info{generate}->{$_}) {
912 (my $x = $_) =~ s/\.S$/.s/; $x
916 } ( @{$args{srcs}} );
917 my $srcs = join(" ", @srcs);
918 my $deps = join(" ", @srcs, @{$args{deps}});
919 my $incs = join("", map { " -I".$_ } @{$args{incs}});
920 unless ($disabled{zlib}) {
921 if ($withargs{zlib_include}) {
922 $incs .= " -I".$withargs{zlib_include};
925 my $ecflags = { lib => '$(LIB_CFLAGS)',
926 dso => '$(DSO_CFLAGS)',
927 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
928 my $makedepprog = $config{makedepprog};
929 my $recipe = <<"EOF";
932 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
934 \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
935 \@touch $obj$depext.tmp
936 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
937 rm -f $obj$depext.tmp; \\
939 mv $obj$depext.tmp $obj$depext; \\
944 \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
946 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
948 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
949 >$obj$depext.tmp 2>/dev/null
950 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
951 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
952 rm -f $obj$depext.tmp; \\
954 mv $obj$depext.tmp $obj$depext; \\
961 # On Unix, we build shlibs from static libs, so we're ignoring the
962 # object file array. We *know* this routine is only called when we've
963 # configure 'shared'.
966 my $lib = $args{lib};
967 my $shlib = $args{shlib};
968 my $libd = dirname($lib);
969 my $libn = basename($lib);
970 (my $libname = $libn) =~ s/^lib//;
971 my $linklibs = join("", map { my $d = dirname($_);
972 my $f = basename($_);
973 (my $l = $f) =~ s/^lib//;
974 " -L$d -l$l" } @{$args{deps}});
975 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
976 my $shlib_target = $target{shared_target};
977 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
978 my $target = shlib_simple($lib);
980 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
981 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
982 # With all other Unix platforms, we often build a shared library with the
983 # SO version built into the file name and a symlink without the SO version
984 # It's not necessary to have both as targets. The choice falls on the
985 # simplest, {libname}$shlibextimport for Windows POSIX layers and
986 # {libname}$shlibextsimple for the Unix platforms.
987 $target: $lib$libext $deps $ordinalsfile
988 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
989 PLATFORM=\$(PLATFORM) \\
990 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
991 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
992 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
993 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
994 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
995 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
996 LDFLAGS='\$(LDFLAGS)' \\
997 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
998 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
999 link_shlib.$shlib_target
1001 . (windowsdll() ? <<"EOF" : "");
1002 rm -f apps/$shlib$shlibext
1003 rm -f test/$shlib$shlibext
1004 cp -p $shlib$shlibext apps/
1005 cp -p $shlib$shlibext test/
1010 my $lib = $args{lib};
1011 my $libd = dirname($lib);
1012 my $libn = basename($lib);
1013 (my $libname = $libn) =~ s/^lib//;
1014 my $shlibdeps = join("", map { my $d = dirname($_);
1015 my $f = basename($_);
1016 (my $l = $f) =~ s/^lib//;
1017 " -L$d -l$l" } @{$args{deps}});
1018 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1019 my $shlib_target = $target{shared_target};
1020 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1021 my $target = dso($lib);
1023 $target: $objs $deps
1024 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1025 PLATFORM=\$(PLATFORM) \\
1026 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
1027 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
1028 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
1029 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
1030 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
1031 SHLIB_EXT=$dsoext \\
1032 LIBEXTRAS="$objs" \\
1033 link_dso.$shlib_target
1038 my $lib = $args{lib};
1039 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1043 \$(RANLIB) \$\@ || echo Never mind.
1048 my $bin = $args{bin};
1049 my $bind = dirname($bin);
1050 my $binn = basename($bin);
1051 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1052 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1053 my $linklibs = join("", map { my $d = dirname($_);
1054 my $f = basename($_);
1055 $d = "." if $d eq $f;
1056 (my $l = $f) =~ s/^lib//;
1057 " -L$d -l$l" } @{$args{deps}});
1058 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1060 $bin$exeext: $objs $deps
1062 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1063 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1064 APPNAME=$bin$exeext OBJECTS="$objs" \\
1065 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1066 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
1067 LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\
1068 link_app.$shlib_target
1073 my $script = $args{script};
1074 my $sources = join(" ", @{$args{sources}});
1075 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1076 "util", "dofile.pl")),
1077 rel2abs($config{builddir}));
1080 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1081 "-o$target{build_file}" $sources > "$script"
1087 my $dir = $args{dir};
1088 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1090 my %extinfo = ( dso => $dsoext,
1094 foreach my $type (("dso", "lib", "bin", "script")) {
1095 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1096 # For lib object files, we could update the library. However, it
1097 # was decided that it's enough to build the directory local object
1098 # files, so we don't need to add any actions, and the dependencies
1099 # are already taken care of.
1100 if ($type ne "lib") {
1101 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1102 if (dirname($prod) eq $dir) {
1103 push @deps, $prod.$extinfo{$type};
1105 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1111 my $deps = join(" ", @deps);
1112 my $actions = join("\n", "", @actions);
1114 $args{dir} $args{dir}/: $deps$actions
1117 "" # Important! This becomes part of the template result.