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.
179 # For "optional" echo messages, to get "real" silence
182 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
183 CC= $(CROSS_COMPILE){- $target{cc} -}
184 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
185 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
186 CXX= $(CROSS_COMPILE){- $target{cxx} -}
187 CXXFLAGS={- our $cxxflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11
188 LDFLAGS= {- $target{lflags} -}
189 PLIB_LDFLAGS= {- $target{plib_lflags} -}
190 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
191 LIB_CFLAGS={- $target{shared_cflag} || "" -}
192 LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -}
193 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
194 DSO_CFLAGS={- $target{shared_cflag} || "" -}
195 DSO_CXXFLAGS={- $target{shared_cxxflag} || "" -}
196 DSO_LDFLAGS=$(LIB_LDFLAGS)
197 BIN_CFLAGS={- $target{bin_cflags} -}
198 BIN_CXXFLAGS={- $target{bin_cxxflag} || "" -}
200 PERL={- $config{perl} -}
202 ARFLAGS= {- $target{arflags} -}
203 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
204 RANLIB= {- $target{ranlib} -}
205 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
206 RCFLAGS={- $target{shared_rcflag} -}
207 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
210 TAR= {- $target{tar} || "tar" -}
211 TARFLAGS= {- $target{tarflags} -}
212 MAKEDEPEND={- $config{makedepprog} -}
215 NAME= $(BASENAME)-$(VERSION)
216 TARFILE= ../$(NAME).tar
218 # We let the C compiler driver to take care of .s files. This is done in
219 # order to be excused from maintaining a separate set of architecture
220 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
221 # gcc, then the driver will automatically translate it to -xarch=v8plus
222 # and pass it down to assembler.
225 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
227 # For x86 assembler: Set PROCESSOR to 386 if you want to support
229 PROCESSOR= {- $config{processor} -}
231 # We want error [and other] messages in English. Trouble is that make(1)
232 # doesn't pass macros down as environment variables unless there already
233 # was corresponding variable originally set. In other words we can only
234 # reassign environment variables, but not set new ones, not in portable
235 # manner that is. That's why we reassign several, just to be sure...
240 # The main targets ###################################################
242 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
243 {- dependmagic('build_libs'); -}: build_libs_nodep
244 {- dependmagic('build_engines'); -}: build_engines_nodep
245 {- dependmagic('build_programs'); -}: build_programs_nodep
247 build_generated: $(GENERATED_MANDATORY)
248 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
249 build_engines_nodep: $(ENGINES)
250 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
252 # Kept around for backward compatibility
253 build_apps build_tests: build_programs
255 # Convenience target to prebuild all generated files, not just the mandatory
257 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
260 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
261 @ : {- output_off() if $disabled{tests}; "" -}
263 SRCTOP=../$(SRCDIR) \
264 BLDTOP=../$(BLDDIR) \
266 EXE_EXT={- $exeext -} \
267 OPENSSL_ENGINES=../$(BLDDIR)/engines \
268 OPENSSL_DEBUG_MEMORY=on \
269 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
270 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
271 @echo "Tests are not supported with your chosen Configure options"
272 @ : {- output_on() if !$disabled{tests}; "" -}
275 @ : {- output_off() if $disabled{tests}; "" -}
276 @SRCTOP="$(SRCDIR)" \
277 $(PERL) $(SRCDIR)/test/run_tests.pl list
278 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
279 @echo "Tests are not supported with your chosen Configure options"
280 @ : {- output_on() if !$disabled{tests}; "" -}
282 install: install_sw install_ssldirs install_docs
284 uninstall: uninstall_docs uninstall_sw
287 @set -e; for s in $(SHLIB_INFO); do \
288 s1=`echo "$$s" | cut -f1 -d";"`; \
289 s2=`echo "$$s" | cut -f2 -d";"`; \
290 $(ECHO) $(RM) $$s1; \
292 if [ "$$s1" != "$$s2" ]; then \
293 $(ECHO) $(RM) $$s2; \
301 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
303 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
304 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
306 $(RM) tags TAGS doc-nits
308 $(RM) openssl.pc libcrypto.pc libssl.pc
309 -$(RM) `find . -type l -a \! -path "./.git/*"`
316 # We check if any depfile is newer than Makefile and decide to
317 # concatenate only if that is true.
319 @: {- output_off() if $disabled{makedepend}; "" -}
320 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
321 ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
322 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
324 for f in $(DEPS); do \
325 if [ -f $$f ]; then cat $$f; fi; \
326 done ) > Makefile.new; \
327 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
328 rm -f Makefile.new; \
330 mv -f Makefile.new Makefile; \
333 @: {- output_on() if $disabled{makedepend}; "" -}
335 # Install helper targets #############################################
337 install_sw: all install_dev install_engines install_runtime
339 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
341 install_docs: install_man_docs install_html_docs
343 uninstall_docs: uninstall_man_docs uninstall_html_docs
344 $(RM) -r -v $(DESTDIR)$(DOCDIR)
347 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
348 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
349 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
350 @set -e; for x in dummy $(MISC_SCRIPTS); do \
351 if [ "$$x" = "dummy" ]; then continue; fi; \
353 $(ECHO) "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
354 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
355 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
356 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
357 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
359 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
360 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
361 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
362 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
363 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
364 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
365 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
366 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
368 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
369 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
370 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
371 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
372 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
373 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
374 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
375 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
379 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
380 @$(ECHO) "*** Installing development files"
381 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
382 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
383 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
384 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
385 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
386 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
387 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
388 $(BLDDIR)/include/openssl/*.h; do \
390 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
391 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
392 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
394 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
395 @set -e; for l in $(INSTALL_LIBS); do \
397 $(ECHO) "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
398 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
399 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
400 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
401 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
402 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
404 @ : {- output_off() if $disabled{shared}; "" -}
405 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
406 s1=`echo "$$s" | cut -f1 -d";"`; \
407 s2=`echo "$$s" | cut -f2 -d";"`; \
408 fn1=`basename $$s1`; \
409 fn2=`basename $$s2`; \
410 : {- output_off() if windowsdll(); "" -}; \
411 $(ECHO) "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
412 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
413 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
414 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
415 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
416 if [ "$$fn1" != "$$fn2" ]; then \
417 $(ECHO) "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
418 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
420 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
421 $(ECHO) "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
422 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
423 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
424 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
425 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
426 : {- output_on() unless windowsdll(); "" -}; \
428 @ : {- output_on() if $disabled{shared}; "" -}
429 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
430 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
431 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
432 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
433 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
434 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
435 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
436 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
437 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
438 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
441 @$(ECHO) "*** Uninstalling development files"
442 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
443 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
444 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
445 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
446 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
447 $(BLDDIR)/include/openssl/*.h; do \
449 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
450 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
452 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
453 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
454 @set -e; for l in $(INSTALL_LIBS); do \
456 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
457 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
459 @ : {- output_off() if $disabled{shared}; "" -}
460 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
461 s1=`echo "$$s" | cut -f1 -d";"`; \
462 s2=`echo "$$s" | cut -f2 -d";"`; \
463 fn1=`basename $$s1`; \
464 fn2=`basename $$s2`; \
465 : {- output_off() if windowsdll(); "" -}; \
466 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
467 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
468 if [ "$$fn1" != "$$fn2" ]; then \
469 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
470 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
472 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
473 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
474 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
475 : {- output_on() unless windowsdll(); "" -}; \
477 @ : {- output_on() if $disabled{shared}; "" -}
478 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
479 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
480 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
481 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
482 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
485 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
486 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
487 @$(ECHO) "*** Installing engines"
488 @set -e; for e in dummy $(INSTALL_ENGINES); do \
489 if [ "$$e" = "dummy" ]; then continue; fi; \
491 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
492 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
493 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
494 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
495 $(DESTDIR)$(ENGINESDIR)/$$fn; \
499 @$(ECHO) "*** Uninstalling engines"
500 @set -e; for e in dummy $(INSTALL_ENGINES); do \
501 if [ "$$e" = "dummy" ]; then continue; fi; \
503 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
506 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
507 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
509 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
512 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
513 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
514 @ : {- output_off() if windowsdll(); "" -}
515 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
516 @ : {- output_on() if windowsdll(); "" -}
517 @$(ECHO) "*** Installing runtime files"
518 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
519 if [ "$$s" = "dummy" ]; then continue; fi; \
521 : {- output_off() unless windowsdll(); "" -}; \
522 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
523 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
524 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
525 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
526 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
527 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
528 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
529 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
530 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
531 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
532 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
533 : {- output_on() if windowsdll(); "" -}; \
535 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
536 if [ "$$x" = "dummy" ]; then continue; fi; \
538 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
539 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
540 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
541 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
542 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
544 @set -e; for x in dummy $(BIN_SCRIPTS); do \
545 if [ "$$x" = "dummy" ]; then continue; fi; \
547 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
548 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
549 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
550 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
551 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
555 @$(ECHO) "*** Uninstalling runtime files"
556 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
558 if [ "$$x" = "dummy" ]; then continue; fi; \
560 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
561 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
563 @set -e; for x in dummy $(BIN_SCRIPTS); \
565 if [ "$$x" = "dummy" ]; then continue; fi; \
567 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
568 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
570 @ : {- output_off() unless windowsdll(); "" -}
571 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
572 if [ "$$s" = "dummy" ]; then continue; fi; \
574 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
575 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
577 @ : {- output_on() unless windowsdll(); "" -}
578 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
582 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
583 @$(ECHO) "*** Installing manpages"
584 $(PERL) $(SRCDIR)/util/process_docs.pl \
585 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
588 @$(ECHO) "*** Uninstalling manpages"
589 $(PERL) $(SRCDIR)/util/process_docs.pl \
590 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
594 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
595 @$(ECHO) "*** Installing HTML manpages"
596 $(PERL) $(SRCDIR)/util/process_docs.pl \
597 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
600 @$(ECHO) "*** Uninstalling manpages"
601 $(PERL) $(SRCDIR)/util/process_docs.pl \
602 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
605 # Developer targets (note: these are only available on Unix) #########
607 update: generate errors ordinals
609 generate: generate_apps generate_crypto_bn generate_crypto_objects \
610 generate_crypto_conf generate_crypto_asn1
613 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
614 if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi
616 # Test coverage is a good idea for the future
617 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
621 lint -DLINT $(INCLUDES) $(SRCS)
624 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
625 < apps/openssl.cnf > apps/openssl-vms.cnf )
628 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
630 generate_crypto_objects:
631 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
632 crypto/objects/objects.txt \
633 crypto/objects/obj_mac.num \
634 include/openssl/obj_mac.h )
635 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
636 include/openssl/obj_mac.h \
637 crypto/objects/obj_dat.h )
638 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
639 crypto/objects/obj_mac.num \
640 crypto/objects/obj_xref.txt \
641 > crypto/objects/obj_xref.h )
643 generate_crypto_conf:
644 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
645 > crypto/conf/conf_def.h )
647 generate_crypto_asn1:
648 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
649 > crypto/asn1/charmap.h )
651 # Set to -force to force a rebuild
654 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
655 ( cd $(SRCDIR); $(PERL) util/mkerr.pl $(ERROR_REBUILD) -internal )
656 ( cd $(SRCDIR)/engines; \
658 $(PERL) ../util/mkerr.pl $(ERROR_REBUILD) -static \
659 -conf $$E `basename $$E .ec`.c ; \
663 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
664 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
668 SRCTOP=../$(SRCDIR) \
669 BLDTOP=../$(BLDDIR) \
670 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
675 -etags `find . -name '*.[ch]' -o -name '*.pm'`
677 # Release targets (note: only available on Unix) #####################
679 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
682 TMPDIR=/var/tmp/openssl-copy.$$$$; \
684 mkdir -p $$TMPDIR/$$DISTDIR; \
686 git ls-tree -r --name-only --full-tree HEAD \
687 | grep -v '^fuzz/corpora' \
689 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
690 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
694 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
695 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
696 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
697 $(TAR_COMMAND) $$DISTDIR) \
698 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
700 cd $(SRCDIR); ls -l $(TARFILE).gz
703 @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar
705 # Helper targets #####################################################
707 link-utils: $(BLDDIR)/util/opensslwrap.sh
709 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
710 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
711 mkdir -p "$(BLDDIR)/util"; \
712 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
717 # Building targets ###################################################
719 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
721 @ ( echo 'prefix=$(INSTALLTOP)'; \
722 echo 'exec_prefix=$${prefix}'; \
723 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
724 echo 'includedir=$${prefix}/include'; \
725 echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
727 echo 'Name: OpenSSL-libcrypto'; \
728 echo 'Description: OpenSSL cryptography library'; \
729 echo 'Version: '$(VERSION); \
730 echo 'Libs: -L$${libdir} -lcrypto'; \
731 echo 'Libs.private: $(EX_LIBS)'; \
732 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
735 @ ( echo 'prefix=$(INSTALLTOP)'; \
736 echo 'exec_prefix=$${prefix}'; \
737 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
738 echo 'includedir=$${prefix}/include'; \
740 echo 'Name: OpenSSL-libssl'; \
741 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
742 echo 'Version: '$(VERSION); \
743 echo 'Requires.private: libcrypto'; \
744 echo 'Libs: -L$${libdir} -lssl'; \
745 echo 'Libs.private: $(EX_LIBS)'; \
746 echo 'Cflags: -I$${includedir}' ) > libssl.pc
749 @ ( echo 'prefix=$(INSTALLTOP)'; \
750 echo 'exec_prefix=$${prefix}'; \
751 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
752 echo 'includedir=$${prefix}/include'; \
754 echo 'Name: OpenSSL'; \
755 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
756 echo 'Version: '$(VERSION); \
757 echo 'Requires: libssl libcrypto' ) > openssl.pc
759 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
760 @echo "Detected changed: $?"
761 @echo "Reconfiguring..."
762 $(PERL) $(SRCDIR)/Configure reconf
763 @echo "**************************************************"
765 @echo "*** Please run the same make command again ***"
767 @echo "**************************************************"
772 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
774 # Helper function to figure out dependencies on libraries
775 # It takes a list of library names and outputs a list of dependencies
776 sub compute_lib_depends {
777 if ($disabled{shared}) {
778 return map { lib($_) } @_;
781 # Depending on shared libraries:
782 # On Windows POSIX layers, we depend on {libname}.dll.a
783 # On Unix platforms, we depend on {shlibname}.so
784 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_;
789 my $generator = join(" ", @{$args{generator}});
790 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
791 my $incs = join("", map { " -I".$_ } @{$args{incs}});
792 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
794 if ($args{src} !~ /\.[sS]$/) {
795 if ($args{generator}->[0] =~ m|^.*\.in$|) {
796 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
797 "util", "dofile.pl")),
798 rel2abs($config{builddir}));
800 $args{src}: $args{generator}->[0] $deps
801 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
802 "-o$target{build_file}" $generator > \$@
806 $args{src}: $args{generator}->[0] $deps
807 \$(PERL)$generator_incs $generator > \$@
811 if ($args{generator}->[0] =~ /\.pl$/) {
812 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
813 } elsif ($args{generator}->[0] =~ /\.m4$/) {
814 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
815 } elsif ($args{generator}->[0] =~ /\.S$/) {
818 die "Generator type for $args{src} unknown: $generator\n";
821 if (defined($generator)) {
822 # If the target is named foo.S in build.info, we want to
823 # end up generating foo.s in two steps.
824 if ($args{src} =~ /\.S$/) {
825 (my $target = $args{src}) =~ s|\.S$|.s|;
827 $target: $args{generator}->[0] $deps
828 ( trap "rm -f \$@.*" INT 0; \\
830 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
831 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
837 $args{src}: $args{generator}->[0] $deps
842 $args{src}: $args{generator}->[0] $deps
843 \$(CC) $incs \$(CFLAGS) -E \$< | \\
844 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
849 # Should one wonder about the end of the Perl snippet, it's because this
850 # second regexp eats up line endings as well, if the removed path is the
851 # last in the line. We may therefore need to put back a line ending.
854 my $obj = $args{obj};
855 my @srcs = map { if ($unified_info{generate}->{$_}) {
856 (my $x = $_) =~ s/\.S$/.s/; $x
860 } ( @{$args{srcs}} );
861 my $srcs = join(" ", @srcs);
862 my $deps = join(" ", @srcs, @{$args{deps}});
863 my $incs = join("", map { " -I".$_ } @{$args{incs}});
864 unless ($disabled{zlib}) {
865 if ($withargs{zlib_include}) {
866 $incs .= " -I".$withargs{zlib_include};
870 my $cflags = '$(CFLAGS)';
871 if (grep /\.(cc|cpp)$/, @srcs) {
873 $cflags = '$(CXXFLAGS)';
874 $cflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
875 dso => '$(DSO_CXXFLAGS)',
876 bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
878 $cflags .= ' ' . { lib => '$(LIB_CFLAGS)',
879 dso => '$(DSO_CFLAGS)',
880 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
882 my $makedepprog = $config{makedepprog};
883 my $recipe = <<"EOF";
886 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
888 $cc $incs $cflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
889 \@touch $obj$depext.tmp
890 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
891 rm -f $obj$depext.tmp; \\
893 mv $obj$depext.tmp $obj$depext; \\
898 $cc $incs $cflags -c -o \$\@ $srcs
900 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
902 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cflags -- $srcs \\
903 >$obj$depext.tmp 2>/dev/null
904 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
905 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
906 rm -f $obj$depext.tmp; \\
908 mv $obj$depext.tmp $obj$depext; \\
915 # On Unix, we build shlibs from static libs, so we're ignoring the
916 # object file array. We *know* this routine is only called when we've
917 # configure 'shared'.
920 my $lib = $args{lib};
921 my $shlib = $args{shlib};
922 my $libd = dirname($lib);
923 my $libn = basename($lib);
924 (my $libname = $libn) =~ s/^lib//;
925 my $linklibs = join("", map { my $d = dirname($_);
926 my $f = basename($_);
927 (my $l = $f) =~ s/^lib//;
928 " -L$d -l$l" } @{$args{deps}});
929 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
930 my $shlib_target = $target{shared_target};
931 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
932 my $target = shlib_simple($lib);
933 my $target_full = shlib($lib);
935 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
936 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
937 # With all other Unix platforms, we often build a shared library with the
938 # SO version built into the file name and a symlink without the SO version
939 # It's not necessary to have both as targets. The choice falls on the
940 # simplest, {libname}$shlibextimport for Windows POSIX layers and
941 # {libname}$shlibextsimple for the Unix platforms.
942 $target: $lib$libext $deps $ordinalsfile
943 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
945 PLATFORM=\$(PLATFORM) \\
946 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
947 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
948 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
949 LIBNAME=$libname SHLIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
950 STLIBNAME=$lib$libext \\
951 SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\
952 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
953 LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\
954 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
955 link_shlib.$shlib_target
957 . (windowsdll() ? <<"EOF" : "");
958 rm -f apps/$shlib$shlibext
959 rm -f test/$shlib$shlibext
960 cp -p $shlib$shlibext apps/
961 cp -p $shlib$shlibext test/
966 my $dso = $args{lib};
967 my $dsod = dirname($dso);
968 my $dson = basename($dso);
969 my $shlibdeps = join("", map { my $d = dirname($_);
970 my $f = basename($_);
971 (my $l = $f) =~ s/^lib//;
972 " -L$d -l$l" } @{$args{deps}});
973 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
974 my $shlib_target = $target{shared_target};
975 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
976 my $target = dso($dso);
979 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
980 PLATFORM=\$(PLATFORM) \\
981 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\
982 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
983 SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\
984 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
985 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
987 link_dso.$shlib_target
992 (my $lib = $args{lib}) =~ s/\.a$//;
993 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
997 \$(RANLIB) \$\@ || echo Never mind.
1002 my $bin = $args{bin};
1003 my $bind = dirname($bin);
1004 my $binn = basename($bin);
1005 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1006 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1007 my $linklibs = join("", map { if ($_ =~ /\.a$/) {
1010 my $d = dirname($_);
1011 my $f = basename($_);
1012 $d = "." if $d eq $f;
1013 (my $l = $f) =~ s/^lib//;
1017 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1019 my $cflags = '$(CFLAGS) $(BIN_CFLAGS)';
1020 if (grep /_cc$/, @{$args{objs}}) {
1022 $cflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)';
1025 $bin$exeext: $objs $deps
1027 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1028 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1029 APPNAME=$bin$exeext OBJECTS="$objs" \\
1030 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1031 CC='$cc' CFLAGS='$cflags' \\
1032 LDFLAGS='\$(LDFLAGS)' \\
1033 link_app.$shlib_target
1038 my $script = $args{script};
1039 my $sources = join(" ", @{$args{sources}});
1040 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1041 "util", "dofile.pl")),
1042 rel2abs($config{builddir}));
1045 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1046 "-o$target{build_file}" $sources > "$script"
1052 my $dir = $args{dir};
1053 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1055 my %extinfo = ( dso => $dsoext,
1059 foreach my $type (("dso", "lib", "bin", "script")) {
1060 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1061 # For lib object files, we could update the library. However, it
1062 # was decided that it's enough to build the directory local object
1063 # files, so we don't need to add any actions, and the dependencies
1064 # are already taken care of.
1065 if ($type ne "lib") {
1066 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1067 if (dirname($prod) eq $dir) {
1068 push @deps, $prod.$extinfo{$type};
1070 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1076 my $deps = join(" ", @deps);
1077 my $actions = join("\n", "", @actions);
1079 $args{dir} $args{dir}/: $deps$actions
1082 "" # Important! This becomes part of the template result.