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 $shlibvariant = $target{shlib_variant} || "";
12 our $shlibextsimple = $target{shared_extension_simple} || ".so";
13 our $shlibextimport = $target{shared_import_extension} || "";
14 our $dsoext = $target{dso_extension} || ".so";
16 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
18 our $sover_dirname = $config{shlib_version_number};
19 $sover_dirname =~ s|\.|_|g
20 if $config{target} =~ /^mingw/;
22 # shlib and shlib_simple both take a static library name and figure
23 # out what the shlib name should be.
25 # When OpenSSL is configured "no-shared", these functions will just
26 # return empty lists, making them suitable to join().
28 # With Windows DLL producers, shlib($libname) will return the shared
29 # library name (which usually is different from the static library
30 # name) with the default shared extension appended to it, while
31 # shlib_simple($libname) will return the static library name with
32 # the shared extension followed by ".a" appended to it. The former
33 # result is used as the runtime shared library while the latter is
34 # used as the DLL import library.
36 # On all Unix systems, shlib($libname) will return the library name
37 # with the default shared extension, while shlib_simple($libname)
38 # will return the name from shlib($libname) with any SO version number
39 # removed. On some systems, they may therefore return the exact same
43 return () if $disabled{shared} || $lib =~ /\.a$/;
44 return $unified_info{sharednames}->{$lib}. $shlibvariant. '$(SHLIB_EXT)';
48 return () if $disabled{shared} || $lib =~ /\.a$/;
51 return $lib . '$(SHLIB_EXT_IMPORT)';
53 return $lib . '$(SHLIB_EXT_SIMPLE)';
56 # Easy fixing of static library names
58 (my $lib = shift) =~ s/\.a$//;
59 return $lib . $libext;
62 # dso is a complement to shlib / shlib_simple that returns the
63 # given libname with the simple shared extension (possible SO version
64 # removed). This differs from shlib_simple() by being unconditional.
68 return $engine . $dsoext;
70 # This makes sure things get built in the order they need
75 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
79 PLATFORM={- $config{target} -}
80 OPTIONS={- $config{options} -}
81 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
82 SRCDIR={- $config{sourcedir} -}
83 BLDDIR={- $config{builddir} -}
85 VERSION={- $config{version} -}
86 MAJOR={- $config{major} -}
87 MINOR={- $config{minor} -}
88 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
89 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
90 SHLIB_MAJOR={- $config{shlib_major} -}
91 SHLIB_MINOR={- $config{shlib_minor} -}
92 SHLIB_TARGET={- $target{shared_target} -}
93 SHLIB_EXT={- $shlibext -}
94 SHLIB_EXT_SIMPLE={- $shlibextsimple -}
95 SHLIB_EXT_IMPORT={- $shlibextimport -}
97 LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -}
98 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
99 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
100 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
101 PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
102 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
103 {- output_off() if $disabled{makedepend}; "" -}
104 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
105 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
106 keys %{$unified_info{sources}}); -}
107 {- output_on() if $disabled{makedepend}; "" -}
108 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
109 GENERATED={- join(" ",
110 ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
111 grep { defined $unified_info{generate}->{$_} }
112 map { @{$unified_info{sources}->{$_}} }
113 grep { /\.o$/ } keys %{$unified_info{sources}} ),
114 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
116 INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -}
117 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
118 INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -}
119 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
120 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -}
121 {- output_off() if $disabled{apps}; "" -}
122 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
123 MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
124 {- output_on() if $disabled{apps}; "" -}
126 APPS_OPENSSL={- use File::Spec::Functions;
127 catfile("apps","openssl") -}
129 # DESTDIR is for package builders so that they can configure for, say,
130 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
131 # Normally it is left empty.
134 # Do not edit these manually. Use Configure with --prefix or --openssldir
135 # to change this! Short explanation in the top comment in Configure
136 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
138 our $prefix = $config{prefix} || "/usr/local";
141 # The logic here is that if no --openssldir was given,
142 # OPENSSLDIR will get the value from $prefix plus "/ssl".
143 # If --openssldir was given and the value is an absolute
144 # path, OPENSSLDIR will get its value without change.
145 # If the value from --openssldir is a relative path,
146 # OPENSSLDIR will get $prefix with the --openssldir
147 # value appended as a subdirectory.
149 use File::Spec::Functions;
151 $config{openssldir} ?
152 (file_name_is_absolute($config{openssldir}) ?
154 : catdir($prefix, $config{openssldir}))
155 : catdir($prefix, "ssl");
158 # if $prefix/lib$target{multilib} is not an existing
159 # directory, then assume that it's not searched by linker
160 # automatically, in which case adding $target{multilib} suffix
161 # causes more grief than we're ready to tolerate, so don't...
163 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
164 our $libdir = $config{libdir} || "lib$multilib";
166 ENGINESDIR={- use File::Spec::Functions;
167 catdir($prefix,$libdir,"engines-$sover_dirname") -}
169 # Convenience variable for those who want to set the rpath in shared
170 # libraries and applications
171 LIBRPATH=$(INSTALLTOP)/$(LIBDIR)
173 MANDIR=$(INSTALLTOP)/share/man
174 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
175 HTMLDIR=$(DOCDIR)/html
177 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
178 # appended after the manpage file section number. "ssl" is popular,
179 # resulting in files such as config.5ssl rather than config.5.
183 # For "optional" echo messages, to get "real" silence
186 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
187 CC= $(CROSS_COMPILE){- $target{cc} -}
188 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
189 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
190 CXX= $(CROSS_COMPILE){- $target{cxx} -}
191 CXXFLAGS={- our $cxxflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11
192 LDFLAGS= {- $target{lflags} -}
193 PLIB_LDFLAGS= {- $target{plib_lflags} -}
194 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
195 LIB_CFLAGS={- $target{shared_cflag} || "" -}
196 LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -}
197 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
198 DSO_CFLAGS={- $target{shared_cflag} || "" -}
199 DSO_CXXFLAGS={- $target{shared_cxxflag} || "" -}
200 DSO_LDFLAGS=$(LIB_LDFLAGS)
201 BIN_CFLAGS={- $target{bin_cflags} -}
202 BIN_CXXFLAGS={- $target{bin_cxxflag} || "" -}
204 PERL={- $config{perl} -}
206 ARFLAGS= {- $target{arflags} -}
207 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
208 RANLIB= {- $target{ranlib} -}
209 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
210 RCFLAGS={- $target{shared_rcflag} -}
211 RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
214 TAR= {- $target{tar} || "tar" -}
215 TARFLAGS= {- $target{tarflags} -}
216 MAKEDEPEND={- $config{makedepprog} -}
219 NAME= $(BASENAME)-$(VERSION)
220 TARFILE= ../$(NAME).tar
222 # We let the C compiler driver to take care of .s files. This is done in
223 # order to be excused from maintaining a separate set of architecture
224 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
225 # gcc, then the driver will automatically translate it to -xarch=v8plus
226 # and pass it down to assembler.
229 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
231 # For x86 assembler: Set PROCESSOR to 386 if you want to support
233 PROCESSOR= {- $config{processor} -}
235 # We want error [and other] messages in English. Trouble is that make(1)
236 # doesn't pass macros down as environment variables unless there already
237 # was corresponding variable originally set. In other words we can only
238 # reassign environment variables, but not set new ones, not in portable
239 # manner that is. That's why we reassign several, just to be sure...
244 # The main targets ###################################################
246 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
247 {- dependmagic('build_libs'); -}: build_libs_nodep
248 {- dependmagic('build_engines'); -}: build_engines_nodep
249 {- dependmagic('build_programs'); -}: build_programs_nodep
251 build_generated: $(GENERATED_MANDATORY)
252 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
253 build_engines_nodep: $(ENGINES)
254 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
256 # Kept around for backward compatibility
257 build_apps build_tests: build_programs
259 # Convenience target to prebuild all generated files, not just the mandatory
261 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
264 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
265 @ : {- output_off() if $disabled{tests}; "" -}
267 mkdir -p test-runs; \
268 SRCTOP=../$(SRCDIR) \
269 BLDTOP=../$(BLDDIR) \
272 EXE_EXT={- $exeext -} \
273 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines; pwd` \
274 OPENSSL_DEBUG_MEMORY=on \
275 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
276 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
277 @echo "Tests are not supported with your chosen Configure options"
278 @ : {- output_on() if !$disabled{tests}; "" -}
281 @ : {- output_off() if $disabled{tests}; "" -}
282 @SRCTOP="$(SRCDIR)" \
283 $(PERL) $(SRCDIR)/test/run_tests.pl list
284 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
285 @echo "Tests are not supported with your chosen Configure options"
286 @ : {- output_on() if !$disabled{tests}; "" -}
288 install: install_sw install_ssldirs install_docs
290 uninstall: uninstall_docs uninstall_sw
293 @set -e; for s in $(SHLIB_INFO); do \
294 s1=`echo "$$s" | cut -f1 -d";"`; \
295 s2=`echo "$$s" | cut -f2 -d";"`; \
296 $(ECHO) $(RM) $$s1; \
298 if [ "$$s1" != "$$s2" ]; then \
299 $(ECHO) $(RM) $$s2; \
307 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
309 -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
310 -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
312 $(RM) tags TAGS doc-nits
314 $(RM) openssl.pc libcrypto.pc libssl.pc
315 -$(RM) `find . -type l -a \! -path "./.git/*"`
322 # We check if any depfile is newer than Makefile and decide to
323 # concatenate only if that is true.
325 @: {- output_off() if $disabled{makedepend}; "" -}
326 @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
327 ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
328 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
330 for f in $(DEPS); do \
331 if [ -f $$f ]; then cat $$f; fi; \
332 done ) > Makefile.new; \
333 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
334 rm -f Makefile.new; \
336 mv -f Makefile.new Makefile; \
339 @: {- output_on() if $disabled{makedepend}; "" -}
341 # Install helper targets #############################################
343 install_sw: all install_dev install_engines install_runtime
345 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
347 install_docs: install_man_docs install_html_docs
349 uninstall_docs: uninstall_man_docs uninstall_html_docs
350 $(RM) -r -v $(DESTDIR)$(DOCDIR)
353 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
354 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
355 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
356 @set -e; for x in dummy $(MISC_SCRIPTS); do \
357 if [ "$$x" = "dummy" ]; then continue; fi; \
359 $(ECHO) "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
360 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
361 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
362 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
363 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
365 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
366 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
367 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
368 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
369 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
370 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
371 cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
372 chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
374 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
375 @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
376 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
377 @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
378 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
379 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
380 cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
381 chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
385 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
386 @$(ECHO) "*** Installing development files"
387 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
388 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
389 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
390 @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
391 @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
392 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
393 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
394 $(BLDDIR)/include/openssl/*.h; do \
396 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
397 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
398 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
400 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
401 @set -e; for l in $(INSTALL_LIBS); do \
403 $(ECHO) "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
404 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
405 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
406 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
407 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
408 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
410 @ : {- output_off() if $disabled{shared}; "" -}
411 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
412 s1=`echo "$$s" | cut -f1 -d";"`; \
413 s2=`echo "$$s" | cut -f2 -d";"`; \
414 fn1=`basename $$s1`; \
415 fn2=`basename $$s2`; \
416 : {- output_off() if windowsdll(); "" -}; \
417 $(ECHO) "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
418 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
419 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
420 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
421 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
422 if [ "$$fn1" != "$$fn2" ]; then \
423 $(ECHO) "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
424 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
426 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
427 $(ECHO) "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
428 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
429 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
430 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
431 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
432 : {- output_on() unless windowsdll(); "" -}; \
434 @ : {- output_on() if $disabled{shared}; "" -}
435 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
436 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
437 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
438 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
439 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
440 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
441 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
442 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
443 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
444 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
447 @$(ECHO) "*** Uninstalling development files"
448 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
449 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
450 @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
451 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
452 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
453 $(BLDDIR)/include/openssl/*.h; do \
455 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
456 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
458 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
459 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
460 @set -e; for l in $(INSTALL_LIBS); do \
462 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
463 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
465 @ : {- output_off() if $disabled{shared}; "" -}
466 @set -e; for s in $(INSTALL_SHLIB_INFO); do \
467 s1=`echo "$$s" | cut -f1 -d";"`; \
468 s2=`echo "$$s" | cut -f2 -d";"`; \
469 fn1=`basename $$s1`; \
470 fn2=`basename $$s2`; \
471 : {- output_off() if windowsdll(); "" -}; \
472 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
473 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
474 if [ "$$fn1" != "$$fn2" ]; then \
475 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
476 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
478 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
479 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
480 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
481 : {- output_on() unless windowsdll(); "" -}; \
483 @ : {- output_on() if $disabled{shared}; "" -}
484 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
485 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
486 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
487 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
488 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
491 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
492 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
493 @$(ECHO) "*** Installing engines"
494 @set -e; for e in dummy $(INSTALL_ENGINES); do \
495 if [ "$$e" = "dummy" ]; then continue; fi; \
497 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
498 cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
499 chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
500 mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
501 $(DESTDIR)$(ENGINESDIR)/$$fn; \
505 @$(ECHO) "*** Uninstalling engines"
506 @set -e; for e in dummy $(INSTALL_ENGINES); do \
507 if [ "$$e" = "dummy" ]; then continue; fi; \
509 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
512 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
513 $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
515 -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
518 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
519 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
520 @ : {- output_off() if windowsdll(); "" -}
521 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
522 @ : {- output_on() if windowsdll(); "" -}
523 @$(ECHO) "*** Installing runtime files"
524 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
525 if [ "$$s" = "dummy" ]; then continue; fi; \
527 : {- output_off() unless windowsdll(); "" -}; \
528 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
529 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
530 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
531 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
532 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
533 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
534 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
535 cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
536 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
537 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
538 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
539 : {- output_on() if windowsdll(); "" -}; \
541 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
542 if [ "$$x" = "dummy" ]; then continue; fi; \
544 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
545 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
546 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
547 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
548 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
550 @set -e; for x in dummy $(BIN_SCRIPTS); do \
551 if [ "$$x" = "dummy" ]; then continue; fi; \
553 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
554 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
555 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
556 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
557 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
561 @$(ECHO) "*** Uninstalling runtime files"
562 @set -e; for x in dummy $(INSTALL_PROGRAMS); \
564 if [ "$$x" = "dummy" ]; then continue; fi; \
566 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
567 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
569 @set -e; for x in dummy $(BIN_SCRIPTS); \
571 if [ "$$x" = "dummy" ]; then continue; fi; \
573 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
574 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
576 @ : {- output_off() unless windowsdll(); "" -}
577 @set -e; for s in dummy $(INSTALL_SHLIBS); do \
578 if [ "$$s" = "dummy" ]; then continue; fi; \
580 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
581 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
583 @ : {- output_on() unless windowsdll(); "" -}
584 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
588 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
589 @$(ECHO) "*** Installing manpages"
590 $(PERL) $(SRCDIR)/util/process_docs.pl \
591 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
594 @$(ECHO) "*** Uninstalling manpages"
595 $(PERL) $(SRCDIR)/util/process_docs.pl \
596 --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
600 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
601 @$(ECHO) "*** Installing HTML manpages"
602 $(PERL) $(SRCDIR)/util/process_docs.pl \
603 --destdir=$(DESTDIR)$(HTMLDIR) --type=html
606 @$(ECHO) "*** Uninstalling manpages"
607 $(PERL) $(SRCDIR)/util/process_docs.pl \
608 --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
611 # Developer targets (note: these are only available on Unix) #########
613 update: generate errors ordinals
615 generate: generate_apps generate_crypto_bn generate_crypto_objects \
616 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
619 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
620 if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi
622 # Test coverage is a good idea for the future
623 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
627 lint -DLINT $(INCLUDES) $(SRCS)
630 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
631 < apps/openssl.cnf > apps/openssl-vms.cnf )
634 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
636 generate_crypto_objects:
637 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
638 crypto/objects/objects.txt \
639 crypto/objects/obj_mac.num \
640 include/openssl/obj_mac.h )
641 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
642 include/openssl/obj_mac.h \
643 crypto/objects/obj_dat.h )
644 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
645 crypto/objects/obj_mac.num \
646 crypto/objects/obj_xref.txt \
647 > crypto/objects/obj_xref.h )
649 generate_crypto_conf:
650 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
651 > crypto/conf/conf_def.h )
653 generate_crypto_asn1:
654 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
655 > crypto/asn1/charmap.h )
658 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
659 crypto/objects/obj_dat.h \
662 # Set to -force to force a rebuild
665 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
666 ( cd $(SRCDIR); $(PERL) util/mkerr.pl $(ERROR_REBUILD) -internal )
667 ( cd $(SRCDIR)/engines; \
669 $(PERL) ../util/mkerr.pl $(ERROR_REBUILD) -static \
670 -conf $$E `basename $$E .ec`.c ; \
674 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
675 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
679 SRCTOP=../$(SRCDIR) \
680 BLDTOP=../$(BLDDIR) \
681 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
686 -etags `find . -name '*.[ch]' -o -name '*.pm'`
688 # Release targets (note: only available on Unix) #####################
690 # If your tar command doesn't support --owner and --group, make sure to
691 # use one that does, for example GNU tar
692 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
696 TMPDIR=/var/tmp/openssl-copy.$$$$; \
698 mkdir -p $$TMPDIR/$$DISTDIR; \
700 excl_re=`git submodule status | sed -e 's/^.//' | cut -d' ' -f2`; \
701 excl_re="^(fuzz/corpora|`echo $$excl_re | sed -e 's/ /$$|/g'`\$$)"; \
703 git ls-tree -r --name-only --full-tree HEAD \
704 | egrep -v "$$excl_re" \
706 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
707 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
709 (cd $$TMPDIR/$$DISTDIR; \
711 find . -type d -print | xargs chmod 755; \
712 find . -type f -print | xargs chmod a+r; \
713 find . -type f -perm -0100 -print | xargs chmod a+x); \
714 (cd $$TMPDIR; $(TAR_COMMAND) $$DISTDIR) \
715 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
717 cd $(SRCDIR); ls -l $(TARFILE).gz
720 @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' TARFILE="$(TARFILE)" NAME="$(NAME)" tar
722 # Helper targets #####################################################
724 link-utils: $(BLDDIR)/util/opensslwrap.sh
726 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
727 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
728 mkdir -p "$(BLDDIR)/util"; \
729 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
734 # Building targets ###################################################
736 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
738 @ ( echo 'prefix=$(INSTALLTOP)'; \
739 echo 'exec_prefix=$${prefix}'; \
740 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
741 echo 'includedir=$${prefix}/include'; \
742 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
744 echo 'Name: OpenSSL-libcrypto'; \
745 echo 'Description: OpenSSL cryptography library'; \
746 echo 'Version: '$(VERSION); \
747 echo 'Libs: -L$${libdir} -lcrypto'; \
748 echo 'Libs.private: $(EX_LIBS)'; \
749 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
752 @ ( echo 'prefix=$(INSTALLTOP)'; \
753 echo 'exec_prefix=$${prefix}'; \
754 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
755 echo 'includedir=$${prefix}/include'; \
757 echo 'Name: OpenSSL-libssl'; \
758 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
759 echo 'Version: '$(VERSION); \
760 echo 'Requires.private: libcrypto'; \
761 echo 'Libs: -L$${libdir} -lssl'; \
762 echo 'Libs.private: $(EX_LIBS)'; \
763 echo 'Cflags: -I$${includedir}' ) > libssl.pc
766 @ ( echo 'prefix=$(INSTALLTOP)'; \
767 echo 'exec_prefix=$${prefix}'; \
768 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
769 echo 'includedir=$${prefix}/include'; \
771 echo 'Name: OpenSSL'; \
772 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
773 echo 'Version: '$(VERSION); \
774 echo 'Requires: libssl libcrypto' ) > openssl.pc
776 configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
777 @echo "Detected changed: $?"
778 @echo "Reconfiguring..."
779 $(PERL) $(SRCDIR)/Configure reconf
780 @echo "**************************************************"
782 @echo "*** Please run the same make command again ***"
784 @echo "**************************************************"
789 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
791 # Helper function to figure out dependencies on libraries
792 # It takes a list of library names and outputs a list of dependencies
793 sub compute_lib_depends {
794 if ($disabled{shared}) {
795 return map { lib($_) } @_;
798 # Depending on shared libraries:
799 # On Windows POSIX layers, we depend on {libname}.dll.a
800 # On Unix platforms, we depend on {shlibname}.so
801 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_;
806 my $generator = join(" ", @{$args{generator}});
807 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
808 my $incs = join("", map { " -I".$_ } @{$args{incs}});
809 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
811 if ($args{src} !~ /\.[sS]$/) {
812 if ($args{generator}->[0] =~ m|^.*\.in$|) {
813 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
814 "util", "dofile.pl")),
815 rel2abs($config{builddir}));
817 $args{src}: $args{generator}->[0] $deps
818 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
819 "-o$target{build_file}" $generator > \$@
823 $args{src}: $args{generator}->[0] $deps
824 \$(PERL)$generator_incs $generator > \$@
828 if ($args{generator}->[0] =~ /\.pl$/) {
829 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
830 } elsif ($args{generator}->[0] =~ /\.m4$/) {
831 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
832 } elsif ($args{generator}->[0] =~ /\.S$/) {
835 die "Generator type for $args{src} unknown: $generator\n";
838 if (defined($generator)) {
839 # If the target is named foo.S in build.info, we want to
840 # end up generating foo.s in two steps.
841 if ($args{src} =~ /\.S$/) {
842 (my $target = $args{src}) =~ s|\.S$|.s|;
844 $target: $args{generator}->[0] $deps
845 ( trap "rm -f \$@.*" INT 0; \\
847 \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
848 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
854 $args{src}: $args{generator}->[0] $deps
859 $args{src}: $args{generator}->[0] $deps
860 \$(CC) $incs \$(CFLAGS) -E $args{generator}->[0] | \\
861 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
866 # Should one wonder about the end of the Perl snippet, it's because this
867 # second regexp eats up line endings as well, if the removed path is the
868 # last in the line. We may therefore need to put back a line ending.
871 my $obj = $args{obj};
872 my @srcs = map { if ($unified_info{generate}->{$_}) {
873 (my $x = $_) =~ s/\.S$/.s/; $x
877 } ( @{$args{srcs}} );
878 my $srcs = join(" ", @srcs);
879 my $deps = join(" ", @srcs, @{$args{deps}});
880 my $incs = join("", map { " -I".$_ } @{$args{incs}});
881 unless ($disabled{zlib}) {
882 if ($withargs{zlib_include}) {
883 $incs .= " -I".$withargs{zlib_include};
887 my $cflags = '$(CFLAGS)';
888 if (grep /\.(cc|cpp)$/, @srcs) {
890 $cflags = '$(CXXFLAGS)';
891 $cflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
892 dso => '$(DSO_CXXFLAGS)',
893 bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
895 $cflags .= ' ' . { lib => '$(LIB_CFLAGS)',
896 dso => '$(DSO_CFLAGS)',
897 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
899 my $makedepprog = $config{makedepprog};
900 my $recipe = <<"EOF";
903 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
905 $cc $incs $cflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
906 \@touch $obj$depext.tmp
907 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
908 rm -f $obj$depext.tmp; \\
910 mv $obj$depext.tmp $obj$depext; \\
915 $cc $incs $cflags -c -o \$\@ $srcs
917 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
919 -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cflags -- $srcs \\
920 >$obj$depext.tmp 2>/dev/null
921 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
922 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
923 rm -f $obj$depext.tmp; \\
925 mv $obj$depext.tmp $obj$depext; \\
932 # On Unix, we build shlibs from static libs, so we're ignoring the
933 # object file array. We *know* this routine is only called when we've
934 # configure 'shared'.
937 my $lib = $args{lib};
938 my $shlib = $args{shlib};
939 my $libd = dirname($lib);
940 my $libn = basename($lib);
941 (my $libname = $libn) =~ s/^lib//;
942 my $linklibs = join("", map { my $d = dirname($_);
943 my $f = basename($_);
944 (my $l = $f) =~ s/^lib//;
945 " -L$d -l$l" } @{$args{deps}});
946 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
947 my $shlib_target = $target{shared_target};
948 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
949 my $target = shlib_simple($lib);
950 my $target_full = shlib($lib);
952 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
953 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
954 # With all other Unix platforms, we often build a shared library with the
955 # SO version built into the file name and a symlink without the SO version
956 # It's not necessary to have both as targets. The choice falls on the
957 # simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
958 # {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
959 $target: $lib$libext $deps $ordinalsfile
960 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
962 PLATFORM=\$(PLATFORM) \\
963 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
964 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
965 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
966 LIBNAME=$libname SHLIBVERSION=\$(SHLIB_VERSION_NUMBER) \\
967 STLIBNAME=$lib$libext \\
968 SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\
969 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
970 LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\
971 RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
972 link_shlib.$shlib_target
974 . (windowsdll() ? <<"EOF" : "");
975 rm -f apps/$shlib'\$(SHLIB_EXT)'
976 rm -f test/$shlib'\$(SHLIB_EXT)'
977 cp -p $shlib'\$(SHLIB_EXT)' apps/
978 cp -p $shlib'\$(SHLIB_EXT)' test/
983 my $dso = $args{lib};
984 my $dsod = dirname($dso);
985 my $dson = basename($dso);
986 my $shlibdeps = join("", map { my $d = dirname($_);
987 my $f = basename($_);
988 (my $l = $f) =~ s/^lib//;
989 " -L$d -l$l" } @{$args{deps}});
990 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
991 my $shlib_target = $target{shared_target};
992 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
993 my $target = dso($dso);
996 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
997 PLATFORM=\$(PLATFORM) \\
998 PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\
999 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
1000 SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\
1001 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
1002 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
1003 LIBEXTRAS="$objs" \\
1004 link_dso.$shlib_target
1009 (my $lib = $args{lib}) =~ s/\.a$//;
1010 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1014 \$(RANLIB) \$\@ || echo Never mind.
1019 my $bin = $args{bin};
1020 my $bind = dirname($bin);
1021 my $binn = basename($bin);
1022 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1023 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1024 my $linklibs = join("", map { if ($_ =~ /\.a$/) {
1027 my $d = dirname($_);
1028 my $f = basename($_);
1029 $d = "." if $d eq $f;
1030 (my $l = $f) =~ s/^lib//;
1034 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1036 my $cflags = '$(CFLAGS) $(BIN_CFLAGS)';
1037 if (grep /_cc$/, @{$args{objs}}) {
1039 $cflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)';
1042 $bin$exeext: $objs $deps
1044 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1045 PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
1046 APPNAME=$bin$exeext OBJECTS="$objs" \\
1047 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1048 CC='$cc' CFLAGS='$cflags' \\
1049 LDFLAGS='\$(LDFLAGS)' \\
1050 link_app.$shlib_target
1055 my $script = $args{script};
1056 my $sources = join(" ", @{$args{sources}});
1057 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1058 "util", "dofile.pl")),
1059 rel2abs($config{builddir}));
1062 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1063 "-o$target{build_file}" $sources > "$script"
1069 my $dir = $args{dir};
1070 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
1072 my %extinfo = ( dso => $dsoext,
1076 foreach my $type (("dso", "lib", "bin", "script")) {
1077 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
1078 # For lib object files, we could update the library. However, it
1079 # was decided that it's enough to build the directory local object
1080 # files, so we don't need to add any actions, and the dependencies
1081 # are already taken care of.
1082 if ($type ne "lib") {
1083 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
1084 if (dirname($prod) eq $dir) {
1085 push @deps, $prod.$extinfo{$type};
1087 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
1093 my $deps = join(" ", @deps);
1094 my $actions = join("\n", "", @actions);
1096 $args{dir} $args{dir}/: $deps$actions
1099 "" # Important! This becomes part of the template result.