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
254 # Convenience target to prebuild all generated files, not just the mandatory
256 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
259 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
260 @ : {- output_off() if $disabled{tests}; "" -}
262 SRCTOP=../$(SRCDIR) \
263 BLDTOP=../$(BLDDIR) \
265 EXE_EXT={- $exeext -} \
266 OPENSSL_ENGINES=../$(BLDDIR)/engines \
267 OPENSSL_DEBUG_MEMORY=on \
268 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
269 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
270 @echo "Tests are not supported with your chosen Configure options"
271 @ : {- output_on() if !$disabled{tests}; "" -}
274 @ : {- output_off() if $disabled{tests}; "" -}
275 @SRCTOP="$(SRCDIR)" \
276 $(PERL) $(SRCDIR)/test/run_tests.pl list
277 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
278 @echo "Tests are not supported with your chosen Configure options"
279 @ : {- output_on() if !$disabled{tests}; "" -}
281 install: install_sw install_ssldirs install_docs
283 uninstall: uninstall_docs uninstall_sw
286 @set -e; for s in $(SHLIB_INFO); do \
287 s1=`echo "$$s" | cut -f1 -d";"`; \
288 s2=`echo "$$s" | cut -f2 -d";"`; \
291 if [ "$$s1" != "$$s2" ]; then \
300 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
302 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
303 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
305 $(RM) tags TAGS doc-nits
307 $(RM) openssl.pc libcrypto.pc libssl.pc
308 -$(RM) `find . -type l -a \! -path "./.git/*"`
315 # We check if any depfile is newer than Makefile and decide to
316 # concatenate only if that is true.
318 @: {- output_off() if $disabled{makedepend}; "" -}
319 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
320 ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
321 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
323 for f in $(DEPS); do \
324 if [ -f $$f ]; then cat $$f; fi; \
325 done ) > Makefile.new; \
326 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
327 rm -f Makefile.new; \
329 mv -f Makefile.new Makefile; \
332 @: {- output_on() if $disabled{makedepend}; "" -}
334 # Install helper targets #############################################
336 install_sw: all install_dev install_engines install_runtime
338 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
340 install_docs: install_man_docs install_html_docs
342 uninstall_docs: uninstall_man_docs uninstall_html_docs
343 $(RM) -r -v $(DESTDIR)$(DOCDIR)
346 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
347 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
348 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
349 @set -e; for x in dummy $(MISC_SCRIPTS); do \
350 if [ "$$x" = "dummy" ]; then continue; fi; \
352 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
353 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
354 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
355 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
356 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
358 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
359 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
360 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
361 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
362 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
363 echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
364 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
365 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
367 @echo "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
368 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
369 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
370 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
371 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
372 echo "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
373 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
374 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
378 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
379 @echo "*** Installing development files"
380 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
381 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
382 @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
383 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
384 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
385 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
386 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
387 $(BLDDIR)/include/openssl/*.h; do \
389 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
390 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
391 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
393 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
394 @set -e; for l in $(INSTALL_LIBS); do \
396 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
397 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
398 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
399 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
400 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
401 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
403 @ : {- output_off() if $disabled{shared}; "" -}
404 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
405 s1=`echo "$$s" | cut -f1 -d";"`; \
406 s2=`echo "$$s" | cut -f2 -d";"`; \
407 fn1=`basename $$s1`; \
408 fn2=`basename $$s2`; \
409 : {- output_off() if windowsdll(); "" -}; \
410 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
411 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
412 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
413 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
414 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
415 if [ "$$fn1" != "$$fn2" ]; then \
416 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
417 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
419 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
420 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
421 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
422 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
423 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
424 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
425 : {- output_on() unless windowsdll(); "" -}; \
427 @ : {- output_on() if $disabled{shared}; "" -}
428 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
429 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
430 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
431 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
432 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
433 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
434 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
435 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
436 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
437 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
440 @echo "*** Uninstalling development files"
441 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
442 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
443 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
444 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
445 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
446 $(BLDDIR)/include/openssl/*.h; do \
448 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
449 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
451 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
452 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
453 @set -e; for l in $(INSTALL_LIBS); do \
455 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
456 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
458 @ : {- output_off() if $disabled{shared}; "" -}
459 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
460 s1=`echo "$$s" | cut -f1 -d";"`; \
461 s2=`echo "$$s" | cut -f2 -d";"`; \
462 fn1=`basename $$s1`; \
463 fn2=`basename $$s2`; \
464 : {- output_off() if windowsdll(); "" -}; \
465 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
466 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
467 if [ "$$fn1" != "$$fn2" ]; then \
468 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
469 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
471 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
472 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
473 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
474 : {- output_on() unless windowsdll(); "" -}; \
476 @ : {- output_on() if $disabled{shared}; "" -}
477 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
478 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
479 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
480 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
481 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
484 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
485 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
486 @echo "*** Installing engines"
487 @set -e; for e in dummy $(INSTALL_ENGINES); do \
488 if [ "$$e" = "dummy" ]; then continue; fi; \
490 echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
491 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
492 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
493 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
494 $(DESTDIR)$(ENGINESDIR)/$$fn; \
498 @echo "*** Uninstalling engines"
499 @set -e; for e in dummy $(INSTALL_ENGINES); do \
500 if [ "$$e" = "dummy" ]; then continue; fi; \
502 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
505 echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
506 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
508 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
511 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
512 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
513 @ : {- output_off() if windowsdll(); "" -}
514 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
515 @ : {- output_on() if windowsdll(); "" -}
516 @echo "*** Installing runtime files"
517 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
518 if [ "$$s" = "dummy" ]; then continue; fi; \
520 : {- output_off() unless windowsdll(); "" -}; \
521 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
522 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
523 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
524 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
525 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
526 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
527 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
528 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
529 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
530 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
531 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
532 : {- output_on() if windowsdll(); "" -}; \
534 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
535 if [ "$$x" = "dummy" ]; then continue; fi; \
537 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
538 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
539 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
540 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
541 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
543 @set -e; for x in dummy $(BIN_SCRIPTS); do \
544 if [ "$$x" = "dummy" ]; then continue; fi; \
546 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
547 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
548 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
549 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
550 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
554 @echo "*** Uninstalling runtime files"
555 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
557 if [ "$$x" = "dummy" ]; then continue; fi; \
559 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
560 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
562 @set -e; for x in dummy $(BIN_SCRIPTS); \
564 if [ "$$x" = "dummy" ]; then continue; fi; \
566 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
567 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
569 @ : {- output_off() unless windowsdll(); "" -}
570 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
571 if [ "$$s" = "dummy" ]; then continue; fi; \
573 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
574 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
576 @ : {- output_on() unless windowsdll(); "" -}
577 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
581 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
582 @echo "*** Installing manpages"
583 $(PERL) $(SRCDIR)/util/process_docs.pl \
584 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
587 @echo "*** Uninstalling manpages"
588 $(PERL) $(SRCDIR)/util/process_docs.pl \
589 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
593 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
594 @echo "*** Installing HTML manpages"
595 $(PERL) $(SRCDIR)/util/process_docs.pl \
596 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
599 @echo "*** Uninstalling manpages"
600 $(PERL) $(SRCDIR)/util/process_docs.pl \
601 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
604 # Developer targets (note: these are only available on Unix) #########
606 update: generate errors ordinals
608 generate: generate_apps generate_crypto_bn generate_crypto_objects \
609 generate_crypto_conf generate_crypto_asn1
612 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
613 if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi
615 # Test coverage is a good idea for the future
616 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
620 lint -DLINT $(INCLUDES) $(SRCS)
623 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
624 < apps/openssl.cnf > apps/openssl-vms.cnf )
627 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
629 generate_crypto_objects:
630 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
631 crypto/objects/objects.txt \
632 crypto/objects/obj_mac.num \
633 include/openssl/obj_mac.h )
634 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
635 include/openssl/obj_mac.h \
636 crypto/objects/obj_dat.h )
637 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
638 crypto/objects/obj_mac.num \
639 crypto/objects/obj_xref.txt \
640 > crypto/objects/obj_xref.h )
642 generate_crypto_conf:
643 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
644 > crypto/conf/conf_def.h )
646 generate_crypto_asn1:
647 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
648 > crypto/asn1/charmap.h )
650 # Set to -force to force a rebuild
653 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
654 ( cd $(SRCDIR); $(PERL) util/mkerr.pl $(ERROR_REBUILD) -internal )
655 ( cd $(SRCDIR)/engines; \
657 $(PERL) ../util/mkerr.pl $(ERROR_REBUILD) -static \
658 -conf $$E `basename $$E .ec`.c ; \
662 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
663 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
667 SRCTOP=../$(SRCDIR) \
668 BLDTOP=../$(BLDDIR) \
669 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
674 -etags `find . -name '*.[ch]' -o -name '*.pm'`
676 # Release targets (note: only available on Unix) #####################
678 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
681 TMPDIR=/var/tmp/openssl-copy.$$$$; \
683 mkdir -p $$TMPDIR/$$DISTDIR; \
685 git ls-tree -r --name-only --full-tree HEAD \
686 | grep -v '^fuzz/corpora' \
688 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
689 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
693 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
694 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
695 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
696 $(TAR_COMMAND) $$DISTDIR) \
697 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
699 cd $(SRCDIR); ls -l $(TARFILE).gz
702 @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar
704 # Helper targets #####################################################
706 link-utils: $(BLDDIR)/util/opensslwrap.sh
708 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
709 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
710 mkdir -p "$(BLDDIR)/util"; \
711 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
716 # Building targets ###################################################
718 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
720 @ ( echo 'prefix=$(INSTALLTOP)'; \
721 echo 'exec_prefix=$${prefix}'; \
722 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
723 echo 'includedir=$${prefix}/include'; \
724 echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
726 echo 'Name: OpenSSL-libcrypto'; \
727 echo 'Description: OpenSSL cryptography library'; \
728 echo 'Version: '$(VERSION); \
729 echo 'Libs: -L$${libdir} -lcrypto'; \
730 echo 'Libs.private: $(EX_LIBS)'; \
731 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
734 @ ( echo 'prefix=$(INSTALLTOP)'; \
735 echo 'exec_prefix=$${prefix}'; \
736 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
737 echo 'includedir=$${prefix}/include'; \
739 echo 'Name: OpenSSL-libssl'; \
740 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
741 echo 'Version: '$(VERSION); \
742 echo 'Requires.private: libcrypto'; \
743 echo 'Libs: -L$${libdir} -lssl'; \
744 echo 'Libs.private: $(EX_LIBS)'; \
745 echo 'Cflags: -I$${includedir}' ) > libssl.pc
748 @ ( echo 'prefix=$(INSTALLTOP)'; \
749 echo 'exec_prefix=$${prefix}'; \
750 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
751 echo 'includedir=$${prefix}/include'; \
753 echo 'Name: OpenSSL'; \
754 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
755 echo 'Version: '$(VERSION); \
756 echo 'Requires: libssl libcrypto' ) > openssl.pc
758 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
759 @echo "Detected changed: $?"
760 @echo "Reconfiguring..."
761 $(PERL) $(SRCDIR)/Configure reconf
762 @echo "**************************************************"
764 @echo "*** Please run the same make command again ***"
766 @echo "**************************************************"
771 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
773 # Helper function to figure out dependencies on libraries
774 # It takes a list of library names and outputs a list of dependencies
775 sub compute_lib_depends {
776 if ($disabled{shared}) {
777 return map { lib($_) } @_;
780 # Depending on shared libraries:
781 # On Windows POSIX layers, we depend on {libname}.dll.a
782 # On Unix platforms, we depend on {shlibname}.so
783 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_;
788 my $generator = join(" ", @{$args{generator}});
789 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
790 my $incs = join("", map { " -I".$_ } @{$args{incs}});
791 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
793 if ($args{src} !~ /\.[sS]$/) {
794 if ($args{generator}->[0] =~ m|^.*\.in$|) {
795 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
796 "util", "dofile.pl")),
797 rel2abs($config{builddir}));
799 $args{src}: $args{generator}->[0] $deps
800 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
801 "-o$target{build_file}" $generator > \$@
805 $args{src}: $args{generator}->[0] $deps
806 \$(PERL)$generator_incs $generator > \$@
810 if ($args{generator}->[0] =~ /\.pl$/) {
811 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
812 } elsif ($args{generator}->[0] =~ /\.m4$/) {
813 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
814 } elsif ($args{generator}->[0] =~ /\.S$/) {
817 die "Generator type for $args{src} unknown: $generator\n";
820 if (defined($generator)) {
821 # If the target is named foo.S in build.info, we want to
822 # end up generating foo.s in two steps.
823 if ($args{src} =~ /\.S$/) {
824 (my $target = $args{src}) =~ s|\.S$|.s|;
826 $target: $args{generator}->[0] $deps
827 ( trap "rm -f \$@.*" INT 0; \\
829 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
830 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
836 $args{src}: $args{generator}->[0] $deps
841 $args{src}: $args{generator}->[0] $deps
842 \$(CC) $incs \$(CFLAGS) -E \$< | \\
843 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
848 # Should one wonder about the end of the Perl snippet, it's because this
849 # second regexp eats up line endings as well, if the removed path is the
850 # last in the line. We may therefore need to put back a line ending.
853 my $obj = $args{obj};
854 my @srcs = map { if ($unified_info{generate}->{$_}) {
855 (my $x = $_) =~ s/\.S$/.s/; $x
859 } ( @{$args{srcs}} );
860 my $srcs = join(" ", @srcs);
861 my $deps = join(" ", @srcs, @{$args{deps}});
862 my $incs = join("", map { " -I".$_ } @{$args{incs}});
863 unless ($disabled{zlib}) {
864 if ($withargs{zlib_include}) {
865 $incs .= " -I".$withargs{zlib_include};
869 my $cflags = '$(CFLAGS)';
870 if (grep /\.(cc|cpp)$/, @srcs) {
872 $cflags = '$(CXXFLAGS)';
873 $cflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
874 dso => '$(DSO_CXXFLAGS)',
875 bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
877 $cflags .= ' ' . { lib => '$(LIB_CFLAGS)',
878 dso => '$(DSO_CFLAGS)',
879 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
881 my $makedepprog = $config{makedepprog};
882 my $recipe = <<"EOF";
885 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
887 $cc $incs $cflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
888 \@touch $obj$depext.tmp
889 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
890 rm -f $obj$depext.tmp; \\
892 mv $obj$depext.tmp $obj$depext; \\
897 $cc $incs $cflags -c -o \$\@ $srcs
899 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
901 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cflags -- $srcs \\
902 >$obj$depext.tmp 2>/dev/null
903 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
904 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
905 rm -f $obj$depext.tmp; \\
907 mv $obj$depext.tmp $obj$depext; \\
914 # On Unix, we build shlibs from static libs, so we're ignoring the
915 # object file array. We *know* this routine is only called when we've
916 # configure 'shared'.
919 my $lib = $args{lib};
920 my $shlib = $args{shlib};
921 my $libd = dirname($lib);
922 my $libn = basename($lib);
923 (my $libname = $libn) =~ s/^lib//;
924 my $linklibs = join("", map { my $d = dirname($_);
925 my $f = basename($_);
926 (my $l = $f) =~ s/^lib//;
927 " -L$d -l$l" } @{$args{deps}});
928 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
929 my $shlib_target = $target{shared_target};
930 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
931 my $target = shlib_simple($lib);
933 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
934 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
935 # With all other Unix platforms, we often build a shared library with the
936 # SO version built into the file name and a symlink without the SO version
937 # It's not necessary to have both as targets. The choice falls on the
938 # simplest, {libname}$shlibextimport for Windows POSIX layers and
939 # {libname}$shlibextsimple for the Unix platforms.
940 $target: $lib$libext $deps $ordinalsfile
941 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
942 PLATFORM=\$(PLATFORM) \\
943 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
944 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
945 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
946 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
947 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
948 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
949 LDFLAGS='\$(LDFLAGS)' \\
950 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
951 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
952 link_shlib.$shlib_target
954 . (windowsdll() ? <<"EOF" : "");
955 rm -f apps/$shlib$shlibext
956 rm -f test/$shlib$shlibext
957 cp -p $shlib$shlibext apps/
958 cp -p $shlib$shlibext test/
963 my $lib = $args{lib};
964 my $libd = dirname($lib);
965 my $libn = basename($lib);
966 (my $libname = $libn) =~ s/^lib//;
967 my $shlibdeps = join("", map { my $d = dirname($_);
968 my $f = basename($_);
969 (my $l = $f) =~ s/^lib//;
970 " -L$d -l$l" } @{$args{deps}});
971 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
972 my $shlib_target = $target{shared_target};
973 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
974 my $target = dso($lib);
977 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
978 PLATFORM=\$(PLATFORM) \\
979 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
980 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
981 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
982 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
983 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
986 link_dso.$shlib_target
991 (my $lib = $args{lib}) =~ s/\.a$//;
992 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
996 \$(RANLIB) \$\@ || echo Never mind.
1001 my $bin = $args{bin};
1002 my $bind = dirname($bin);
1003 my $binn = basename($bin);
1004 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1005 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1006 my $linklibs = join("", map { if ($_ =~ /\.a$/) {
1009 my $d = dirname($_);
1010 my $f = basename($_);
1011 $d = "." if $d eq $f;
1012 (my $l = $f) =~ s/^lib//;
1016 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1018 my $cflags = '$(CFLAGS) $(BIN_CFLAGS)';
1019 if (grep /_cc$/, @{$args{objs}}) {
1021 $cflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)';
1024 $bin$exeext: $objs $deps
1026 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1027 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1028 APPNAME=$bin$exeext OBJECTS="$objs" \\
1029 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1030 CC='$cc' CFLAGS='$cflags' \\
1031 LDFLAGS='\$(LDFLAGS)' \\
1032 link_app.$shlib_target
1037 my $script = $args{script};
1038 my $sources = join(" ", @{$args{sources}});
1039 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1040 "util", "dofile.pl")),
1041 rel2abs($config{builddir}));
1044 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1045 "-o$target{build_file}" $sources > "$script"
1051 my $dir = $args{dir};
1052 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1054 my %extinfo = ( dso => $dsoext,
1058 foreach my $type (("dso", "lib", "bin", "script")) {
1059 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1060 # For lib object files, we could update the library. However, it
1061 # was decided that it's enough to build the directory local object
1062 # files, so we don't need to add any actions, and the dependencies
1063 # are already taken care of.
1064 if ($type ne "lib") {
1065 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1066 if (dirname($prod) eq $dir) {
1067 push @deps, $prod.$extinfo{$type};
1069 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1075 my $deps = join(" ", @deps);
1076 my $actions = join("\n", "", @actions);
1078 $args{dir} $args{dir}/: $deps$actions
1081 "" # Important! This becomes part of the template result.