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 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
90 PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test/| } @{$unified_info{programs}}) -}
91 TESTPROGS={- join(" ", map { $_.$exeext } grep { m|^test/| } @{$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 {- output_off() if $disabled{apps}; "" -}
107 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
108 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
109 {- output_on() if $disabled{apps}; "" -}
111 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
113 # DESTDIR is for package builders so that they can configure for, say,
114 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
115 # Normally it is left empty.
118 # Do not edit these manually. Use Configure with --prefix or --openssldir
119 # to change this! Short explanation in the top comment in Configure
120 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
122 our $prefix = $config{prefix} || "/usr/local";
125 # The logic here is that if no --openssldir was given,
126 # OPENSSLDIR will get the value from $prefix plus "/ssl".
127 # If --openssldir was given and the value is an absolute
128 # path, OPENSSLDIR will get its value without change.
129 # If the value from --openssldir is a relative path,
130 # OPENSSLDIR will get $prefix with the --openssldir
131 # value appended as a subdirectory.
133 use File::Spec::Functions;
135 $config{openssldir} ?
136 (file_name_is_absolute($config{openssldir}) ?
138 : catdir($prefix, $config{openssldir}))
139 : catdir($prefix, "ssl");
142 # if $prefix/lib$target{multilib} is not an existing
143 # directory, then assume that it's not searched by linker
144 # automatically, in which case adding $target{multilib} suffix
145 # causes more grief than we're ready to tolerate, so don't...
147 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
148 our $libdir = $config{libdir} || "lib$multilib";
150 ENGINESDIR={- use File::Spec::Functions;
151 catdir($prefix,$libdir,"engines-$sover") -}
153 MANDIR=$(INSTALLTOP)/share/man
154 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
155 HTMLDIR=$(DOCDIR)/html
157 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
158 # appended after the manpage file section number. "ssl" is popular,
159 # resulting in files such as config.5ssl rather than config.5.
165 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
166 CC= $(CROSS_COMPILE){- $target{cc} -}
167 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
168 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
169 LDFLAGS= {- $target{lflags} -}
170 PLIB_LDFLAGS= {- $target{plib_lflags} -}
171 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
172 LIB_CFLAGS={- $target{shared_cflag} || "" -}
173 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
174 # Unlike other OSes (like Solaris, Linux, Tru64,
175 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
176 # and FreeBSD) "demand" RPATH set on .so objects.
177 # Apparently application RPATH is not global and
178 # does not apply to .so linked with other .so.
179 # Problem manifests itself when libssl.so fails to
180 # load libcrypto.so. One can argue that we should
181 # engrave this into Makefile.shared rules or into
182 # BSD-* config lines above. Meanwhile let's try to
183 # be cautious and pass -rpath to linker only when
184 # $prefix is not /usr.
185 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
186 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
187 DSO_CFLAGS={- $target{shared_cflag} || "" -}
188 DSO_LDFLAGS=$(LIB_LDFLAGS)
189 BIN_CFLAGS={- $target{bin_cflags} -}
191 PERL={- $config{perl} -}
193 ARFLAGS= {- $target{arflags} -}
194 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
195 RANLIB= {- $target{ranlib} -}
196 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
197 RCFLAGS={- $target{shared_rcflag} -}
198 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
201 TAR= {- $target{tar} || "tar" -}
202 TARFLAGS= {- $target{tarflags} -}
203 MAKEDEPEND={- $config{makedepprog} -}
206 NAME= $(BASENAME)-$(VERSION)
207 TARFILE= ../$(NAME).tar
209 # We let the C compiler driver to take care of .s files. This is done in
210 # order to be excused from maintaining a separate set of architecture
211 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
212 # gcc, then the driver will automatically translate it to -xarch=v8plus
213 # and pass it down to assembler.
216 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
218 # For x86 assembler: Set PROCESSOR to 386 if you want to support
220 PROCESSOR= {- $config{processor} -}
222 # The main targets ###################################################
224 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_apps_nodep link-utils
225 {- dependmagic('build_libs'); -}: build_libs_nodep
226 {- dependmagic('build_engines'); -}: build_engines_nodep
227 {- dependmagic('build_apps'); -}: build_apps_nodep
228 {- dependmagic('build_tests'); -}: build_tests_nodep
230 build_generated: $(GENERATED_MANDATORY)
231 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
232 build_engines_nodep: $(ENGINES)
233 build_apps_nodep: $(PROGRAMS) $(SCRIPTS)
234 build_tests_nodep: $(TESTPROGS)
237 {- dependmagic('tests'); -}: build_tests_nodep build_apps_nodep \
238 build_engines_nodep link-utils
239 @ : {- output_off() if $disabled{tests}; "" -}
241 SRCTOP=../$(SRCDIR) \
242 BLDTOP=../$(BLDDIR) \
244 EXE_EXT={- $exeext -} \
245 OPENSSL_ENGINES=../$(BLDDIR)/engines \
246 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
247 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
248 @echo "Tests are not supported with your chosen Configure options"
249 @ : {- output_on() if !$disabled{tests}; "" -}
252 @ : {- output_off() if $disabled{tests}; "" -}
253 @SRCTOP="$(SRCDIR)" \
254 $(PERL) $(SRCDIR)/test/run_tests.pl list
255 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
256 @echo "Tests are not supported with your chosen Configure options"
257 @ : {- output_on() if !$disabled{tests}; "" -}
259 install: install_sw install_ssldirs install_docs
261 uninstall: uninstall_docs uninstall_sw
264 @set -e; for s in $(SHLIB_INFO); do \
265 s1=`echo "$$s" | cut -f1 -d";"`; \
266 s2=`echo "$$s" | cut -f2 -d";"`; \
269 if [ "$$s1" != "$$s2" ]; then \
278 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
280 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
281 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
284 $(RM) openssl.pc libcrypto.pc libssl.pc
285 -$(RM) `find . -type l -a \! -path "./.git/*"`
292 # This exists solely for those who still type 'make depend'
294 # We check if any depfile is newer than Makefile and decide to
295 # concatenate only if that is true.
297 @: {- output_off() if $disabled{makedepend}; "" -}
298 @if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \
299 ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \
300 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
302 for f in $(DEPS); do \
303 if [ -f $$f ]; then cat $$f; fi; \
304 done ) > Makefile.new; \
305 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
306 rm -f Makefile.new; \
308 mv -f Makefile.new Makefile; \
311 @: {- output_on() if $disabled{makedepend}; "" -}
313 # Install helper targets #############################################
315 install_sw: all install_dev install_engines install_runtime
317 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
319 install_docs: install_man_docs install_html_docs
321 uninstall_docs: uninstall_man_docs uninstall_html_docs
322 $(RM) -r -v $(DESTDIR)$(DOCDIR)
325 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
326 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
327 @set -e; for x in dummy $(MISC_SCRIPTS); do \
328 if [ "$$x" = "dummy" ]; then continue; fi; \
330 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
331 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
332 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
333 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
334 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
336 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"
337 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
338 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
339 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
342 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
343 @echo "*** Installing development files"
344 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
345 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
346 @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
347 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
348 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
349 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
350 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
351 $(BLDDIR)/include/openssl/*.h; do \
353 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
354 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
355 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
357 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
358 @set -e; for l in $(LIBS); do \
360 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
361 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
362 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
363 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
364 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
365 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
367 @ : {- output_off() if $disabled{shared}; "" -}
368 @set -e; for s in $(SHLIB_INFO); do \
369 s1=`echo "$$s" | cut -f1 -d";"`; \
370 s2=`echo "$$s" | cut -f2 -d";"`; \
371 fn1=`basename $$s1`; \
372 fn2=`basename $$s2`; \
373 : {- output_off() if windowsdll(); "" -}; \
374 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
375 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
376 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
377 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
378 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
379 if [ "$$fn1" != "$$fn2" ]; then \
380 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
381 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
383 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
384 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
385 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
386 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
387 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
388 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
389 : {- output_on() unless windowsdll(); "" -}; \
391 @ : {- output_on() if $disabled{shared}; "" -}
392 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
393 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
394 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
395 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
396 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
397 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
398 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
399 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
400 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
401 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
404 @echo "*** Uninstalling development files"
405 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
406 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
407 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
408 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
409 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
410 $(BLDDIR)/include/openssl/*.h; do \
412 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
413 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
415 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
416 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
417 @set -e; for l in $(LIBS); do \
419 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
420 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
422 @ : {- output_off() if $disabled{shared}; "" -}
423 @set -e; for s in $(SHLIB_INFO); do \
424 s1=`echo "$$s" | cut -f1 -d";"`; \
425 s2=`echo "$$s" | cut -f2 -d";"`; \
426 fn1=`basename $$s1`; \
427 fn2=`basename $$s2`; \
428 : {- output_off() if windowsdll(); "" -}; \
429 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
430 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
431 if [ "$$fn1" != "$$fn2" ]; then \
432 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
433 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
435 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
436 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
437 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
438 : {- output_on() unless windowsdll(); "" -}; \
440 @ : {- output_on() if $disabled{shared}; "" -}
441 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
442 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
443 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
444 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
445 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
448 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
449 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
450 @echo "*** Installing engines"
451 @set -e; for e in dummy $(ENGINES); do \
452 if [ "$$e" = "dummy" ]; then continue; fi; \
454 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
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 $(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 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
481 @echo "*** Installing runtime files"
482 @ : {- output_off() unless windowsdll(); "" -}
483 @set -e; for s in dummy $(SHLIBS); do \
484 if [ "$$s" = "dummy" ]; then continue; fi; \
486 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
487 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
488 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
489 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
490 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
492 @ : {- output_on() unless windowsdll(); "" -}
493 @set -e; for x in dummy $(PROGRAMS); do \
494 if [ "$$x" = "dummy" ]; then continue; fi; \
496 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
497 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
498 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
499 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
500 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
502 @set -e; for x in dummy $(BIN_SCRIPTS); 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; \
513 @echo "*** Uninstalling runtime files"
514 @set -e; for x in dummy $(PROGRAMS); \
516 if [ "$$x" = "dummy" ]; then continue; fi; \
518 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
519 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
521 @set -e; for x in dummy $(BIN_SCRIPTS); \
523 if [ "$$x" = "dummy" ]; then continue; fi; \
525 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
526 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
528 @set -e; for x in dummy $(MISC_SCRIPTS); \
530 if [ "$$x" = "dummy" ]; then continue; fi; \
532 echo "$(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
533 $(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
535 @ : {- output_off() unless windowsdll(); "" -}
536 @set -e; for s in dummy $(SHLIBS); do \
537 if [ "$$s" = "dummy" ]; then continue; fi; \
539 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
540 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
542 @ : {- output_on() unless windowsdll(); "" -}
543 $(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
544 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
545 -$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc
547 # A method to extract all names from a .pod file
548 # The first sed extracts everything between "=head1 NAME" and the next =head1
549 # The perl command joins all the lines into one
550 # The second sed removes the description and turns all commas into spaces
551 # Voilà , you have a space separated list of names!
552 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
553 $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \
554 sed -e 's/ - .*$$//;s/,/ /g'
557 here=`cd $(SRCDIR); pwd`; \
558 point=$$here/util/point.sh; \
559 for ds in apps:1 crypto:3 ssl:3; do \
560 defdir=`echo $$ds | cut -f1 -d:`; \
561 defsec=`echo $$ds | cut -f2 -d:`; \
562 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
563 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
564 [ -z "$$SEC" ] && SEC=$$defsec; \
565 fn=`basename $$p .pod`; \
567 NAME=`echo $$fn | tr [a-z] [A-Z]`; \
568 suf=`eval "echo $$OUTSUFFIX"`; \
569 top=`eval "echo $$OUTTOP"`; \
570 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
571 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
572 cat $$p | eval "$$GENERATE" \
573 > $$top/man$$SEC/$$fn$$suf; \
574 names=`cat $$p | $(EXTRACT_NAMES)`; \
575 ( cd $$top/man$$SEC; \
576 for n in $$names; do \
579 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
580 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
581 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
584 if [ "$$comp_n" != "$$comp_fn" ]; then \
585 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
586 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
593 here=`cd $(SRCDIR); pwd`; \
594 for ds in apps:1 crypto:3 ssl:3; do \
595 defdir=`echo $$ds | cut -f1 -d:`; \
596 defsec=`echo $$ds | cut -f2 -d:`; \
597 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
598 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
599 [ -z "$$SEC" ] && SEC=$$defsec; \
600 fn=`basename $$p .pod`; \
601 suf=`eval "echo $$OUTSUFFIX"`; \
602 top=`eval "echo $$OUTTOP"`; \
603 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
604 $(RM) $$top/man$$SEC/$$fn$$suf; \
605 names=`cat $$p | $(EXTRACT_NAMES)`; \
606 for n in $$names; do \
609 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
610 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
611 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
614 if [ "$$comp_n" != "$$comp_fn" ]; then \
615 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
616 $(RM) $$top/man$$SEC/$$n$$suf; \
619 ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
624 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
625 @echo "*** Installing manpages"
627 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
628 OUTTOP="$(DESTDIR)$(MANDIR)"; \
629 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
633 @echo "*** Uninstalling manpages"
635 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
636 OUTTOP="$(DESTDIR)$(MANDIR)"; \
640 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
641 @echo "*** Installing HTML manpages"
643 OUTSUFFIX='.$(HTMLSUFFIX)'; \
644 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
645 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
646 --podpath=apps:crypto:ssl --title=\$$Name \
647 | perl -pe 's|href=\"http://man.he.net/man|href=\"../man|g; s|href=\"(.*/man.*)(?<!\.html)\">|href=\"\$$1.html\">|g;'"; \
651 @echo "*** Uninstalling manpages"
653 OUTSUFFIX='.$(HTMLSUFFIX)'; \
654 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
658 # Developer targets (note: these are only available on Unix) #########
660 update: generate errors ordinals
662 generate: generate_apps generate_crypto_bn generate_crypto_objects \
663 generate_crypto_conf generate_crypto_asn1
665 # Test coverage is a good idea for the future
666 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
670 lint -DLINT $(INCLUDES) $(SRCS)
672 {- # because the program apps/openssl has object files as sources, and
673 # they then have the corresponding C files as source, we need to chain
674 # the lookups in %unified_info
675 my $apps_openssl = catfile("apps","openssl");
676 our @openssl_source = map { @{$unified_info{sources}->{$_}} }
677 @{$unified_info{sources}->{$apps_openssl}};
680 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
681 < apps/openssl.cnf > apps/openssl-vms.cnf )
682 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \
683 {- join(" ", @openssl_source) -} \
687 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
689 generate_crypto_objects:
690 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
691 crypto/objects/objects.txt \
692 crypto/objects/obj_mac.num \
693 include/openssl/obj_mac.h )
694 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
695 include/openssl/obj_mac.h \
696 crypto/objects/obj_dat.h )
697 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
698 crypto/objects/obj_mac.num \
699 crypto/objects/obj_xref.txt \
700 > crypto/objects/obj_xref.h )
702 generate_crypto_conf:
703 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
704 > crypto/conf/conf_def.h )
706 generate_crypto_asn1:
707 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
708 > crypto/asn1/charmap.h )
711 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
712 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
713 ( cd $(SRCDIR)/engines; \
715 $(PERL) ../util/mkerr.pl -conf $$e \
716 -nostatic -staticloader -write *.c; \
720 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
721 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
725 SRCTOP=../$(SRCDIR) \
726 BLDTOP=../$(BLDDIR) \
727 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
732 -etags `find . -name '*.[ch]' -o -name '*.pm'`
734 # Release targets (note: only available on Unix) #####################
736 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
739 TMPDIR=/var/tmp/openssl-copy.$$$$; \
741 mkdir -p $$TMPDIR/$$DISTDIR; \
743 git ls-tree -r --name-only --full-tree HEAD \
744 | grep -v '^fuzz/corpora' \
746 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
747 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
751 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
752 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
753 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
754 $(TAR_COMMAND) $$DISTDIR) \
755 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
757 cd $(SRCDIR); ls -l $(TARFILE).gz
760 @$(MAKE) PREPARE_CMD='./Configure dist' tar
762 # Helper targets #####################################################
764 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
766 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
767 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
768 mkdir -p "$(BLDDIR)/util"; \
769 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
771 $(BLDDIR)/util/shlib_wrap.sh: configdata.pm
772 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
773 mkdir -p "$(BLDDIR)/util"; \
774 ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
778 # Building targets ###################################################
780 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
782 @ ( echo 'prefix=$(INSTALLTOP)'; \
783 echo 'exec_prefix=$${prefix}'; \
784 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
785 echo 'includedir=$${prefix}/include'; \
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: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -}
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};
934 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
937 -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
938 >\$\@.tmp 2>/dev/null
939 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp
940 \@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\
946 $deps = $obj.$depext;
948 if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) {
951 \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
954 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
957 \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
958 \@touch $obj$depext.tmp
959 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
960 rm -f $obj$depext.tmp; \\
962 mv $obj$depext.tmp $obj$depext; \\
968 # On Unix, we build shlibs from static libs, so we're ignoring the
969 # object file array. We *know* this routine is only called when we've
970 # configure 'shared'.
973 my $lib = $args{lib};
974 my $shlib = $args{shlib};
975 my $libd = dirname($lib);
976 my $libn = basename($lib);
977 (my $libname = $libn) =~ s/^lib//;
978 my $linklibs = join("", map { my $d = dirname($_);
979 my $f = basename($_);
980 (my $l = $f) =~ s/^lib//;
981 " -L$d -l$l" } @{$args{deps}});
982 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
983 my $shlib_target = $target{shared_target};
984 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
985 my $target = shlib_simple($lib);
987 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
988 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
989 # With all other Unix platforms, we often build a shared library with the
990 # SO version built into the file name and a symlink without the SO version
991 # It's not necessary to have both as targets. The choice falls on the
992 # simplest, {libname}$shlibextimport for Windows POSIX layers and
993 # {libname}$shlibextsimple for the Unix platforms.
994 $target: $lib$libext $deps $ordinalsfile
995 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
996 PLATFORM=\$(PLATFORM) \\
997 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
998 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
999 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1000 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
1001 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
1002 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
1003 LDFLAGS='\$(LDFLAGS)' \\
1004 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
1005 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
1006 link_shlib.$shlib_target
1008 . (windowsdll() ? <<"EOF" : "");
1009 rm -f apps/$shlib$shlibext
1010 rm -f test/$shlib$shlibext
1011 cp -p $shlib$shlibext apps/
1012 cp -p $shlib$shlibext test/
1017 my $lib = $args{lib};
1018 my $libd = dirname($lib);
1019 my $libn = basename($lib);
1020 (my $libname = $libn) =~ s/^lib//;
1021 my $shlibdeps = join("", map { my $d = dirname($_);
1022 my $f = basename($_);
1023 (my $l = $f) =~ s/^lib//;
1024 " -L$d -l$l" } @{$args{deps}});
1025 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1026 my $shlib_target = $target{shared_target};
1027 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1028 my $target = dso($lib);
1030 $target: $objs $deps
1031 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1032 PLATFORM=\$(PLATFORM) \\
1033 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
1034 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
1035 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
1036 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
1037 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
1038 SHLIB_EXT=$dsoext \\
1039 LIBEXTRAS="$objs" \\
1040 link_dso.$shlib_target
1045 my $lib = $args{lib};
1046 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1050 \$(RANLIB) \$\@ || echo Never mind.
1055 my $bin = $args{bin};
1056 my $bind = dirname($bin);
1057 my $binn = basename($bin);
1058 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1059 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1060 my $linklibs = join("", map { my $d = dirname($_);
1061 my $f = basename($_);
1062 $d = "." if $d eq $f;
1063 (my $l = $f) =~ s/^lib//;
1064 " -L$d -l$l" } @{$args{deps}});
1065 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1067 $bin$exeext: $objs $deps
1069 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1070 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1071 APPNAME=$bin$exeext OBJECTS="$objs" \\
1072 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1073 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
1074 LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\
1075 link_app.$shlib_target
1080 my $script = $args{script};
1081 my $sources = join(" ", @{$args{sources}});
1082 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1083 "util", "dofile.pl")),
1084 rel2abs($config{builddir}));
1087 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1088 "-o$target{build_file}" $sources > "$script"
1094 my $dir = $args{dir};
1095 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1097 my %extinfo = ( dso => $dsoext,
1101 foreach my $type (("dso", "lib", "bin", "script")) {
1102 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1103 # For lib object files, we could update the library. However, it
1104 # was decided that it's enough to build the directory local object
1105 # files, so we don't need to add any actions, and the dependencies
1106 # are already taken care of.
1107 if ($type ne "lib") {
1108 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1109 if (dirname($prod) eq $dir) {
1110 push @deps, $prod.$extinfo{$type};
1112 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1118 my $deps = join(" ", @deps);
1119 my $actions = join("\n", "", @actions);
1121 $args{dir} $args{dir}/: $deps$actions
1124 "" # Important! This becomes part of the template result.