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
42 return () if $disabled{shared} || $lib =~ /\.a$/;
43 return $unified_info{sharednames}->{$lib} . $shlibext;
47 return () if $disabled{shared} || $lib =~ /\.a$/;
50 return $lib . $shlibextimport;
52 return $lib . $shlibextsimple;
55 # Easy fixing of static library names
57 (my $lib = shift) =~ s/\.a$//;
58 return $lib . $libext;
61 # dso is a complement to shlib / shlib_simple that returns the
62 # given libname with the simple shared extension (possible SO version
63 # removed). This differs from shlib_simple() by being unconditional.
67 return $engine . $dsoext;
69 # This makes sure things get built in the order they need
74 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
78 PLATFORM={- $config{target} -}
79 OPTIONS={- $config{options} -}
80 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
81 SRCDIR={- $config{sourcedir} -}
82 BLDDIR={- $config{builddir} -}
84 VERSION={- $config{version} -}
85 MAJOR={- $config{major} -}
86 MINOR={- $config{minor} -}
87 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
88 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
89 SHLIB_MAJOR={- $config{shlib_major} -}
90 SHLIB_MINOR={- $config{shlib_minor} -}
91 SHLIB_TARGET={- $target{shared_target} -}
93 LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -}
94 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
95 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
96 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
97 PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
98 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
99 {- output_off() if $disabled{makedepend}; "" -}
100 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
101 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
102 keys %{$unified_info{sources}}); -}
103 {- output_on() if $disabled{makedepend}; "" -}
104 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
105 GENERATED={- join(" ",
106 ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
107 grep { defined $unified_info{generate}->{$_} }
108 map { @{$unified_info{sources}->{$_}} }
109 grep { /\.o$/ } keys %{$unified_info{sources}} ),
110 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
112 INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -}
113 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
114 INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -}
115 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
116 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -}
117 {- output_off() if $disabled{apps}; "" -}
118 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
119 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
120 {- output_on() if $disabled{apps}; "" -}
122 APPS_OPENSSL={- use File::Spec::Functions;
123 catfile("apps","openssl") -}
125 # DESTDIR is for package builders so that they can configure for, say,
126 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
127 # Normally it is left empty.
130 # Do not edit these manually. Use Configure with --prefix or --openssldir
131 # to change this! Short explanation in the top comment in Configure
132 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
134 our $prefix = $config{prefix} || "/usr/local";
137 # The logic here is that if no --openssldir was given,
138 # OPENSSLDIR will get the value from $prefix plus "/ssl".
139 # If --openssldir was given and the value is an absolute
140 # path, OPENSSLDIR will get its value without change.
141 # If the value from --openssldir is a relative path,
142 # OPENSSLDIR will get $prefix with the --openssldir
143 # value appended as a subdirectory.
145 use File::Spec::Functions;
147 $config{openssldir} ?
148 (file_name_is_absolute($config{openssldir}) ?
150 : catdir($prefix, $config{openssldir}))
151 : catdir($prefix, "ssl");
154 # if $prefix/lib$target{multilib} is not an existing
155 # directory, then assume that it's not searched by linker
156 # automatically, in which case adding $target{multilib} suffix
157 # causes more grief than we're ready to tolerate, so don't...
159 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
160 our $libdir = $config{libdir} || "lib$multilib";
162 ENGINESDIR={- use File::Spec::Functions;
163 catdir($prefix,$libdir,"engines-$sover") -}
165 # Convenience variable for those who want to set the rpath in shared
166 # libraries and applications
167 LIBRPATH=$(INSTALLTOP)/$(LIBDIR)
169 MANDIR=$(INSTALLTOP)/share/man
170 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
171 HTMLDIR=$(DOCDIR)/html
173 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
174 # appended after the manpage file section number. "ssl" is popular,
175 # resulting in files such as config.5ssl rather than config.5.
181 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
182 CC= $(CROSS_COMPILE){- $target{cc} -}
183 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
184 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
185 CXX= $(CROSS_COMPILE){- $target{cxx} -}
186 CXXFLAGS={- our $cxxflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11
187 LDFLAGS= {- $target{lflags} -}
188 PLIB_LDFLAGS= {- $target{plib_lflags} -}
189 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
190 LIB_CFLAGS={- $target{shared_cflag} || "" -}
191 LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -}
192 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
193 DSO_CFLAGS={- $target{shared_cflag} || "" -}
194 DSO_CXXFLAGS={- $target{shared_cxxflag} || "" -}
195 DSO_LDFLAGS=$(LIB_LDFLAGS)
196 BIN_CFLAGS={- $target{bin_cflags} -}
197 BIN_CXXFLAGS={- $target{bin_cxxflag} || "" -}
199 PERL={- $config{perl} -}
201 ARFLAGS= {- $target{arflags} -}
202 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
203 RANLIB= {- $target{ranlib} -}
204 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
205 RCFLAGS={- $target{shared_rcflag} -}
206 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
209 TAR= {- $target{tar} || "tar" -}
210 TARFLAGS= {- $target{tarflags} -}
211 MAKEDEPEND={- $config{makedepprog} -}
214 NAME= $(BASENAME)-$(VERSION)
215 TARFILE= ../$(NAME).tar
217 # We let the C compiler driver to take care of .s files. This is done in
218 # order to be excused from maintaining a separate set of architecture
219 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
220 # gcc, then the driver will automatically translate it to -xarch=v8plus
221 # and pass it down to assembler.
224 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
226 # For x86 assembler: Set PROCESSOR to 386 if you want to support
228 PROCESSOR= {- $config{processor} -}
230 # We want error [and other] messages in English. Trouble is that make(1)
231 # doesn't pass macros down as environment variables unless there already
232 # was corresponding variable originally set. In other words we can only
233 # reassign environment variables, but not set new ones, not in portable
234 # manner that is. That's why we reassign several, just to be sure...
239 # The main targets ###################################################
241 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
242 {- dependmagic('build_libs'); -}: build_libs_nodep
243 {- dependmagic('build_engines'); -}: build_engines_nodep
244 {- dependmagic('build_programs'); -}: build_programs_nodep
246 build_generated: $(GENERATED_MANDATORY)
247 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
248 build_engines_nodep: $(ENGINES)
249 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
251 # Kept around for backward compatibility
252 build_apps build_tests: build_programs
255 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
256 @ : {- output_off() if $disabled{tests}; "" -}
258 SRCTOP=../$(SRCDIR) \
259 BLDTOP=../$(BLDDIR) \
261 EXE_EXT={- $exeext -} \
262 OPENSSL_ENGINES=../$(BLDDIR)/engines \
263 OPENSSL_DEBUG_MEMORY=on \
264 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
265 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
266 @echo "Tests are not supported with your chosen Configure options"
267 @ : {- output_on() if !$disabled{tests}; "" -}
270 @ : {- output_off() if $disabled{tests}; "" -}
271 @SRCTOP="$(SRCDIR)" \
272 $(PERL) $(SRCDIR)/test/run_tests.pl list
273 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
274 @echo "Tests are not supported with your chosen Configure options"
275 @ : {- output_on() if !$disabled{tests}; "" -}
277 install: install_sw install_ssldirs install_docs
279 uninstall: uninstall_docs uninstall_sw
282 @set -e; for s in $(SHLIB_INFO); do \
283 s1=`echo "$$s" | cut -f1 -d";"`; \
284 s2=`echo "$$s" | cut -f2 -d";"`; \
287 if [ "$$s1" != "$$s2" ]; then \
296 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
298 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
299 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
301 $(RM) tags TAGS doc-nits
303 $(RM) openssl.pc libcrypto.pc libssl.pc
304 -$(RM) `find . -type l -a \! -path "./.git/*"`
311 # We check if any depfile is newer than Makefile and decide to
312 # concatenate only if that is true.
314 @: {- output_off() if $disabled{makedepend}; "" -}
315 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
316 ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
317 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
319 for f in $(DEPS); do \
320 if [ -f $$f ]; then cat $$f; fi; \
321 done ) > Makefile.new; \
322 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
323 rm -f Makefile.new; \
325 mv -f Makefile.new Makefile; \
328 @: {- output_on() if $disabled{makedepend}; "" -}
330 # Install helper targets #############################################
332 install_sw: all install_dev install_engines install_runtime
334 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
336 install_docs: install_man_docs install_html_docs
338 uninstall_docs: uninstall_man_docs uninstall_html_docs
339 $(RM) -r -v $(DESTDIR)$(DOCDIR)
342 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
343 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
344 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
345 @set -e; for x in dummy $(MISC_SCRIPTS); do \
346 if [ "$$x" = "dummy" ]; then continue; fi; \
348 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
349 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
350 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
351 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
352 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
354 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
355 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
356 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
357 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
358 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
359 echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
360 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
361 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
363 @echo "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
364 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
365 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
366 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
367 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
368 echo "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
369 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
370 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
374 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
375 @echo "*** Installing development files"
376 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
377 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
378 @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
379 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
380 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
381 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
382 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
383 $(BLDDIR)/include/openssl/*.h; do \
385 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
386 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
387 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
389 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
390 @set -e; for l in $(INSTALL_LIBS); do \
392 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
393 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
394 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
395 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
396 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
397 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
399 @ : {- output_off() if $disabled{shared}; "" -}
400 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
401 s1=`echo "$$s" | cut -f1 -d";"`; \
402 s2=`echo "$$s" | cut -f2 -d";"`; \
403 fn1=`basename $$s1`; \
404 fn2=`basename $$s2`; \
405 : {- output_off() if windowsdll(); "" -}; \
406 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
407 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
408 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
409 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
410 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
411 if [ "$$fn1" != "$$fn2" ]; then \
412 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
413 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
415 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
416 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
417 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
418 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
419 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
420 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
421 : {- output_on() unless windowsdll(); "" -}; \
423 @ : {- output_on() if $disabled{shared}; "" -}
424 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
425 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
426 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
427 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
428 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
429 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
430 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
431 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
432 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
433 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
436 @echo "*** Uninstalling development files"
437 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
438 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
439 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
440 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
441 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
442 $(BLDDIR)/include/openssl/*.h; do \
444 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
445 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
447 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
448 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
449 @set -e; for l in $(INSTALL_LIBS); do \
451 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
452 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
454 @ : {- output_off() if $disabled{shared}; "" -}
455 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
456 s1=`echo "$$s" | cut -f1 -d";"`; \
457 s2=`echo "$$s" | cut -f2 -d";"`; \
458 fn1=`basename $$s1`; \
459 fn2=`basename $$s2`; \
460 : {- output_off() if windowsdll(); "" -}; \
461 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
462 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
463 if [ "$$fn1" != "$$fn2" ]; then \
464 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
465 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
467 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
468 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
469 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
470 : {- output_on() unless windowsdll(); "" -}; \
472 @ : {- output_on() if $disabled{shared}; "" -}
473 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
474 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
475 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
476 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
477 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
480 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
481 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
482 @echo "*** Installing engines"
483 @set -e; for e in dummy $(INSTALL_ENGINES); do \
484 if [ "$$e" = "dummy" ]; then continue; fi; \
486 echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
487 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
488 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
489 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
490 $(DESTDIR)$(ENGINESDIR)/$$fn; \
494 @echo "*** Uninstalling engines"
495 @set -e; for e in dummy $(INSTALL_ENGINES); do \
496 if [ "$$e" = "dummy" ]; then continue; fi; \
498 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
501 echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
502 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
504 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
507 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
508 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
509 @ : {- output_off() if windowsdll(); "" -}
510 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
511 @ : {- output_on() if windowsdll(); "" -}
512 @echo "*** Installing runtime files"
513 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
514 if [ "$$s" = "dummy" ]; then continue; fi; \
516 : {- output_off() unless windowsdll(); "" -}; \
517 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
518 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
519 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
520 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
521 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
522 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
523 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
524 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
525 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
526 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
527 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
528 : {- output_on() if windowsdll(); "" -}; \
530 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
531 if [ "$$x" = "dummy" ]; then continue; fi; \
533 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
534 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
535 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
536 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
537 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
539 @set -e; for x in dummy $(BIN_SCRIPTS); do \
540 if [ "$$x" = "dummy" ]; then continue; fi; \
542 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
543 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
544 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
545 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
546 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
550 @echo "*** Uninstalling runtime files"
551 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
553 if [ "$$x" = "dummy" ]; then continue; fi; \
555 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
556 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
558 @set -e; for x in dummy $(BIN_SCRIPTS); \
560 if [ "$$x" = "dummy" ]; then continue; fi; \
562 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
563 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
565 @ : {- output_off() unless windowsdll(); "" -}
566 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
567 if [ "$$s" = "dummy" ]; then continue; fi; \
569 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
570 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
572 @ : {- output_on() unless windowsdll(); "" -}
573 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
577 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
578 @echo "*** Installing manpages"
579 $(PERL) $(SRCDIR)/util/process_docs.pl \
580 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
583 @echo "*** Uninstalling manpages"
584 $(PERL) $(SRCDIR)/util/process_docs.pl \
585 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
589 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
590 @echo "*** Installing HTML manpages"
591 $(PERL) $(SRCDIR)/util/process_docs.pl \
592 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
595 @echo "*** Uninstalling manpages"
596 $(PERL) $(SRCDIR)/util/process_docs.pl \
597 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
600 # Developer targets (note: these are only available on Unix) #########
602 update: generate errors ordinals
604 generate: generate_apps generate_crypto_bn generate_crypto_objects \
605 generate_crypto_conf generate_crypto_asn1
608 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
609 if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi
611 # Test coverage is a good idea for the future
612 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
616 lint -DLINT $(INCLUDES) $(SRCS)
619 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
620 < apps/openssl.cnf > apps/openssl-vms.cnf )
623 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
625 generate_crypto_objects:
626 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
627 crypto/objects/objects.txt \
628 crypto/objects/obj_mac.num \
629 include/openssl/obj_mac.h )
630 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
631 include/openssl/obj_mac.h \
632 crypto/objects/obj_dat.h )
633 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
634 crypto/objects/obj_mac.num \
635 crypto/objects/obj_xref.txt \
636 > crypto/objects/obj_xref.h )
638 generate_crypto_conf:
639 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
640 > crypto/conf/conf_def.h )
642 generate_crypto_asn1:
643 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
644 > crypto/asn1/charmap.h )
646 # Set to -force to force a rebuild
649 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
650 ( cd $(SRCDIR); $(PERL) util/mkerr.pl $(ERROR_REBUILD) -internal )
651 ( cd $(SRCDIR)/engines; \
653 $(PERL) ../util/mkerr.pl $(ERROR_REBUILD) -static \
654 -conf $$E `basename $$E .ec`.c ; \
658 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
659 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
663 SRCTOP=../$(SRCDIR) \
664 BLDTOP=../$(BLDDIR) \
665 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
670 -etags `find . -name '*.[ch]' -o -name '*.pm'`
672 # Release targets (note: only available on Unix) #####################
674 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
677 TMPDIR=/var/tmp/openssl-copy.$$$$; \
679 mkdir -p $$TMPDIR/$$DISTDIR; \
681 git ls-tree -r --name-only --full-tree HEAD \
682 | grep -v '^fuzz/corpora' \
684 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
685 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
689 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
690 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
691 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
692 $(TAR_COMMAND) $$DISTDIR) \
693 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
695 cd $(SRCDIR); ls -l $(TARFILE).gz
698 @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar
700 # Helper targets #####################################################
702 link-utils: $(BLDDIR)/util/opensslwrap.sh
704 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
705 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
706 mkdir -p "$(BLDDIR)/util"; \
707 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
712 # Building targets ###################################################
714 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
716 @ ( echo 'prefix=$(INSTALLTOP)'; \
717 echo 'exec_prefix=$${prefix}'; \
718 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
719 echo 'includedir=$${prefix}/include'; \
720 echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
722 echo 'Name: OpenSSL-libcrypto'; \
723 echo 'Description: OpenSSL cryptography library'; \
724 echo 'Version: '$(VERSION); \
725 echo 'Libs: -L$${libdir} -lcrypto'; \
726 echo 'Libs.private: $(EX_LIBS)'; \
727 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
730 @ ( echo 'prefix=$(INSTALLTOP)'; \
731 echo 'exec_prefix=$${prefix}'; \
732 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
733 echo 'includedir=$${prefix}/include'; \
735 echo 'Name: OpenSSL-libssl'; \
736 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
737 echo 'Version: '$(VERSION); \
738 echo 'Requires.private: libcrypto'; \
739 echo 'Libs: -L$${libdir} -lssl'; \
740 echo 'Libs.private: $(EX_LIBS)'; \
741 echo 'Cflags: -I$${includedir}' ) > libssl.pc
744 @ ( echo 'prefix=$(INSTALLTOP)'; \
745 echo 'exec_prefix=$${prefix}'; \
746 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
747 echo 'includedir=$${prefix}/include'; \
749 echo 'Name: OpenSSL'; \
750 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
751 echo 'Version: '$(VERSION); \
752 echo 'Requires: libssl libcrypto' ) > openssl.pc
754 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
755 @echo "Detected changed: $?"
756 @echo "Reconfiguring..."
757 $(PERL) $(SRCDIR)/Configure reconf
758 @echo "**************************************************"
760 @echo "*** Please run the same make command again ***"
762 @echo "**************************************************"
767 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
769 # Helper function to figure out dependencies on libraries
770 # It takes a list of library names and outputs a list of dependencies
771 sub compute_lib_depends {
772 if ($disabled{shared}) {
773 return map { lib($_) } @_;
776 # Depending on shared libraries:
777 # On Windows POSIX layers, we depend on {libname}.dll.a
778 # On Unix platforms, we depend on {shlibname}.so
779 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_;
784 my $generator = join(" ", @{$args{generator}});
785 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
786 my $incs = join("", map { " -I".$_ } @{$args{incs}});
787 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
789 if ($args{src} !~ /\.[sS]$/) {
790 if ($args{generator}->[0] =~ m|^.*\.in$|) {
791 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
792 "util", "dofile.pl")),
793 rel2abs($config{builddir}));
795 $args{src}: $args{generator}->[0] $deps
796 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
797 "-o$target{build_file}" $generator > \$@
801 $args{src}: $args{generator}->[0] $deps
802 \$(PERL)$generator_incs $generator > \$@
806 if ($args{generator}->[0] =~ /\.pl$/) {
807 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
808 } elsif ($args{generator}->[0] =~ /\.m4$/) {
809 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
810 } elsif ($args{generator}->[0] =~ /\.S$/) {
813 die "Generator type for $args{src} unknown: $generator\n";
816 if (defined($generator)) {
817 # If the target is named foo.S in build.info, we want to
818 # end up generating foo.s in two steps.
819 if ($args{src} =~ /\.S$/) {
820 (my $target = $args{src}) =~ s|\.S$|.s|;
822 $target: $args{generator}->[0] $deps
823 ( trap "rm -f \$@.*" INT 0; \\
825 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
826 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
832 $args{src}: $args{generator}->[0] $deps
837 $args{src}: $args{generator}->[0] $deps
838 \$(CC) $incs \$(CFLAGS) -E \$< | \\
839 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
844 # Should one wonder about the end of the Perl snippet, it's because this
845 # second regexp eats up line endings as well, if the removed path is the
846 # last in the line. We may therefore need to put back a line ending.
849 my $obj = $args{obj};
850 my @srcs = map { if ($unified_info{generate}->{$_}) {
851 (my $x = $_) =~ s/\.S$/.s/; $x
855 } ( @{$args{srcs}} );
856 my $srcs = join(" ", @srcs);
857 my $deps = join(" ", @srcs, @{$args{deps}});
858 my $incs = join("", map { " -I".$_ } @{$args{incs}});
859 unless ($disabled{zlib}) {
860 if ($withargs{zlib_include}) {
861 $incs .= " -I".$withargs{zlib_include};
865 my $cflags = '$(CFLAGS)';
866 if (grep /\.(cc|cpp)$/, @srcs) {
868 $cflags = '$(CXXFLAGS)';
869 $cflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
870 dso => '$(DSO_CXXFLAGS)',
871 bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
873 $cflags .= ' ' . { lib => '$(LIB_CFLAGS)',
874 dso => '$(DSO_CFLAGS)',
875 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
877 my $makedepprog = $config{makedepprog};
878 my $recipe = <<"EOF";
881 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
883 $cc $incs $cflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
884 \@touch $obj$depext.tmp
885 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
886 rm -f $obj$depext.tmp; \\
888 mv $obj$depext.tmp $obj$depext; \\
893 $cc $incs $cflags -c -o \$\@ $srcs
895 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
897 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cflags -- $srcs \\
898 >$obj$depext.tmp 2>/dev/null
899 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
900 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
901 rm -f $obj$depext.tmp; \\
903 mv $obj$depext.tmp $obj$depext; \\
910 # On Unix, we build shlibs from static libs, so we're ignoring the
911 # object file array. We *know* this routine is only called when we've
912 # configure 'shared'.
915 my $lib = $args{lib};
916 my $shlib = $args{shlib};
917 my $libd = dirname($lib);
918 my $libn = basename($lib);
919 (my $libname = $libn) =~ s/^lib//;
920 my $linklibs = join("", map { my $d = dirname($_);
921 my $f = basename($_);
922 (my $l = $f) =~ s/^lib//;
923 " -L$d -l$l" } @{$args{deps}});
924 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
925 my $shlib_target = $target{shared_target};
926 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
927 my $target = shlib_simple($lib);
929 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
930 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
931 # With all other Unix platforms, we often build a shared library with the
932 # SO version built into the file name and a symlink without the SO version
933 # It's not necessary to have both as targets. The choice falls on the
934 # simplest, {libname}$shlibextimport for Windows POSIX layers and
935 # {libname}$shlibextsimple for the Unix platforms.
936 $target: $lib$libext $deps $ordinalsfile
937 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
938 PLATFORM=\$(PLATFORM) \\
939 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
940 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
941 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
942 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
943 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
944 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
945 LDFLAGS='\$(LDFLAGS)' \\
946 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
947 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
948 link_shlib.$shlib_target
950 . (windowsdll() ? <<"EOF" : "");
951 rm -f apps/$shlib$shlibext
952 rm -f test/$shlib$shlibext
953 cp -p $shlib$shlibext apps/
954 cp -p $shlib$shlibext test/
959 my $lib = $args{lib};
960 my $libd = dirname($lib);
961 my $libn = basename($lib);
962 (my $libname = $libn) =~ s/^lib//;
963 my $shlibdeps = join("", map { my $d = dirname($_);
964 my $f = basename($_);
965 (my $l = $f) =~ s/^lib//;
966 " -L$d -l$l" } @{$args{deps}});
967 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
968 my $shlib_target = $target{shared_target};
969 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
970 my $target = dso($lib);
973 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
974 PLATFORM=\$(PLATFORM) \\
975 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
976 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
977 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
978 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
979 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
982 link_dso.$shlib_target
987 (my $lib = $args{lib}) =~ s/\.a$//;
988 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
992 \$(RANLIB) \$\@ || echo Never mind.
997 my $bin = $args{bin};
998 my $bind = dirname($bin);
999 my $binn = basename($bin);
1000 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1001 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1002 my $linklibs = join("", map { if ($_ =~ /\.a$/) {
1005 my $d = dirname($_);
1006 my $f = basename($_);
1007 $d = "." if $d eq $f;
1008 (my $l = $f) =~ s/^lib//;
1012 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1014 my $cflags = '$(CFLAGS) $(BIN_CFLAGS)';
1015 if (grep /_cc$/, @{$args{objs}}) {
1017 $cflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)';
1020 $bin$exeext: $objs $deps
1022 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1023 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1024 APPNAME=$bin$exeext OBJECTS="$objs" \\
1025 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1026 CC='$cc' CFLAGS='$cflags' \\
1027 LDFLAGS='\$(LDFLAGS)' \\
1028 link_app.$shlib_target
1033 my $script = $args{script};
1034 my $sources = join(" ", @{$args{sources}});
1035 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1036 "util", "dofile.pl")),
1037 rel2abs($config{builddir}));
1040 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1041 "-o$target{build_file}" $sources > "$script"
1047 my $dir = $args{dir};
1048 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1050 my %extinfo = ( dso => $dsoext,
1054 foreach my $type (("dso", "lib", "bin", "script")) {
1055 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1056 # For lib object files, we could update the library. However, it
1057 # was decided that it's enough to build the directory local object
1058 # files, so we don't need to add any actions, and the dependencies
1059 # are already taken care of.
1060 if ($type ne "lib") {
1061 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1062 if (dirname($prod) eq $dir) {
1063 push @deps, $prod.$extinfo{$type};
1065 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1071 my $deps = join(" ", @deps);
1072 my $actions = join("\n", "", @actions);
1074 $args{dir} $args{dir}/: $deps$actions
1077 "" # Important! This becomes part of the template result.