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 # shlib and shlib_simple both take a static library name and figure
18 # out what the shlib name should be.
20 # When OpenSSL is configured "no-shared", these functions will just
21 # return empty lists, making them suitable to join().
23 # With Windows DLL producers, shlib($libname) will return the shared
24 # library name (which usually is different from the static library
25 # name) with the default shared extension appended to it, while
26 # shlib_simple($libname) will return the static library name with
27 # the shared extension followed by ".a" appended to it. The former
28 # result is used as the runtime shared library while the latter is
29 # used as the DLL import library.
31 # On all Unix systems, shlib($libname) will return the library name
32 # with the default shared extension, while shlib_simple($libname)
33 # will return the name from shlib($libname) with any SO version number
34 # removed. On some systems, they may therefore return the exact same
37 return () if $disabled{shared};
39 return $unified_info{sharednames}->{$lib} . $shlibext;
42 return () if $disabled{shared};
46 return $lib . $shlibextimport;
48 return $lib . $shlibextsimple;
51 # dso is a complement to shlib / shlib_simple that returns the
52 # given libname with the simple shared extension (possible SO version
53 # removed). This differs from shlib_simple() by being unconditional.
57 return $engine . $dsoext;
61 PLATFORM={- $config{target} -}
62 OPTIONS={- $config{options} -}
63 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
64 SRCDIR={- $config{sourcedir} -}
65 BLDDIR={- $config{builddir} -}
67 VERSION={- $config{version} -}
68 MAJOR={- $config{major} -}
69 MINOR={- $config{minor} -}
70 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
71 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
72 SHLIB_MAJOR={- $config{shlib_major} -}
73 SHLIB_MINOR={- $config{shlib_minor} -}
74 SHLIB_TARGET={- $target{shared_target} -}
76 LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -}
77 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
78 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
79 PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test/| } @{$unified_info{programs}}) -}
80 TESTPROGS={- join(" ", map { $_.$exeext } grep { m|^test/| } @{$unified_info{programs}}) -}
81 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
82 {- output_off() if $disabled{makedepend}; "" -}
83 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
84 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
85 keys %{$unified_info{sources}}); -}
86 {- output_on() if $disabled{makedepend}; "" -}
87 GENERATED={- join(" ", map { (my $x = $_) =~ s|\.S$|\.s|; $x } keys %{$unified_info{generate}}) -}
89 {- output_off() if $disabled{apps}; "" -}
90 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
91 MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \
92 $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \
93 $(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
94 {- output_on() if $disabled{apps}; "" -}
96 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
98 # DESTDIR is for package builders so that they can configure for, say,
99 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
100 # Normally it is left empty.
103 # Do not edit these manually. Use Configure with --prefix or --openssldir
104 # to change this! Short explanation in the top comment in Configure
105 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
107 our $prefix = $config{prefix} || "/usr/local";
110 # The logic here is that if no --openssldir was given,
111 # OPENSSLDIR will get the value from $prefix plus "/ssl".
112 # If --openssldir was given and the value is an absolute
113 # path, OPENSSLDIR will get its value without change.
114 # If the value from --openssldir is a relative path,
115 # OPENSSLDIR will get $prefix with the --openssldir
116 # value appended as a subdirectory.
118 use File::Spec::Functions;
120 $config{openssldir} ?
121 (file_name_is_absolute($config{openssldir}) ?
123 : catdir($prefix, $config{openssldir}))
124 : catdir($prefix, "ssl");
127 # if $prefix/lib$target{multilib} is not an existing
128 # directory, then assume that it's not searched by linker
129 # automatically, in which case adding $target{multilib} suffix
130 # causes more grief than we're ready to tolerate, so don't...
132 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
133 our $libdir = $config{libdir} || "lib$multilib";
135 ENGINESDIR={- use File::Spec::Functions;
136 catdir($prefix,$libdir,"engines") -}
138 MANDIR=$(INSTALLTOP)/share/man
139 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
140 HTMLDIR=$(DOCDIR)/html
142 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
143 # appended after the manpage file section number. "ssl" is popular,
144 # resulting in files such as config.5ssl rather than config.5.
150 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
151 CC= $(CROSS_COMPILE){- $target{cc} -}
152 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
153 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
154 LDFLAGS= {- $target{lflags} -}
155 PLIB_LDFLAGS= {- $target{plib_lflags} -}
156 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
157 LIB_CFLAGS={- $target{shared_cflag} || "" -}
158 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
159 # Unlike other OSes (like Solaris, Linux, Tru64,
160 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
161 # and FreeBSD) "demand" RPATH set on .so objects.
162 # Apparently application RPATH is not global and
163 # does not apply to .so linked with other .so.
164 # Problem manifests itself when libssl.so fails to
165 # load libcrypto.so. One can argue that we should
166 # engrave this into Makefile.shared rules or into
167 # BSD-* config lines above. Meanwhile let's try to
168 # be cautious and pass -rpath to linker only when
169 # $prefix is not /usr.
170 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
171 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
172 RCFLAGS={- $target{shared_rcflag} -}
173 DSO_CFLAGS={- $target{shared_cflag} || "" -}
174 DSO_LDFLAGS=$(LIB_LDFLAGS)
175 BIN_CFLAGS={- $target{bin_cflags} -}
177 PERL={- $config{perl} -}
179 ARFLAGS= {- $target{arflags} -}
180 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
181 RANLIB= {- $target{ranlib} -}
182 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
185 TAR= {- $target{tar} || "tar" -}
186 TARFLAGS= {- $target{tarflags} -}
187 MAKEDEPEND={- $config{makedepprog} -}
190 NAME= $(BASENAME)-$(VERSION)
191 TARFILE= ../$(NAME).tar
193 # We let the C compiler driver to take care of .s files. This is done in
194 # order to be excused from maintaining a separate set of architecture
195 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
196 # gcc, then the driver will automatically translate it to -xarch=v8plus
197 # and pass it down to assembler.
200 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
202 # For x86 assembler: Set PROCESSOR to 386 if you want to support
204 PROCESSOR= {- $config{processor} -}
206 # The main targets ###################################################
208 all: configdata.pm build_libs_nodep build_engines_nodep build_apps_nodep \
211 build_libs: configdata.pm build_libs_nodep depend
212 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
213 build_engines: configdata.pm build_engines_nodep depend
214 build_engines_nodep: $(ENGINES)
215 build_apps: configdata.pm build_apps_nodep depend
216 build_apps_nodep: $(PROGRAMS) $(SCRIPTS)
217 build_tests: configdata.pm build_tests_nodep depend
218 build_tests_nodep: $(TESTPROGS)
221 tests: build_tests_nodep build_apps_nodep build_engines_nodep \
223 @ : {- output_off() if $disabled{tests}; "" -}
225 SRCTOP=../$(SRCDIR) \
226 BLDTOP=../$(BLDDIR) \
227 EXE_EXT={- $exeext -} \
228 OPENSSL_ENGINES=../$(BLDDIR)/engines \
229 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
230 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
231 @echo "Tests are not supported with your chosen Configure options"
232 @ : {- output_on() if !$disabled{tests}; "" -}
235 @TOP=$(SRCDIR) PERL=$(PERL) $(PERL) $(SRCDIR)/test/run_tests.pl list
238 @set -e; for s in $(SHLIB_INFO); do \
239 s1=`echo "$$s" | cut -f1 -d";"`; \
240 s2=`echo "$$s" | cut -f2 -d";"`; \
243 if [ "$$s1" != "$$s2" ]; then \
250 install: install_sw install_ssldirs install_docs
252 uninstall: uninstall_docs uninstall_sw
255 rm -f $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
257 -rm -f `find . -name '*{- $depext -}'`
258 -rm -f `find . -name '*{- $objext -}'`
261 rm -f openssl.pc libcrypto.pc libssl.pc
262 -rm -f `find . -type l`
265 # This exists solely for those who still type 'make depend'
267 # We check if any depfile is newer than Makefile and decide to
268 # concatenate only if that is true.
270 @: {- output_off() if $disabled{makedepend}; "" -}
271 @if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \
272 ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \
273 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
275 for f in $(DEPS); do \
276 if [ -f $$f ]; then cat $$f; fi; \
277 done ) > Makefile.new; \
278 if cmp Makefile.new Makefile >/dev/null 2>&1; then \
279 rm -f Makefile.new; \
281 mv -f Makefile.new Makefile; \
284 @: {- output_on() if $disabled{makedepend}; "" -}
286 # Install helper targets #############################################
288 install_sw: all install_dev install_engines install_runtime
290 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
292 install_docs: install_man_docs install_html_docs
294 uninstall_docs: uninstall_man_docs uninstall_html_docs
295 $(RM) -r -v $(DESTDIR)$(DOCDIR)
298 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
299 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
302 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
303 @echo "*** Installing development files"
304 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
305 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
306 $(BLDDIR)/include/openssl/*.h; do \
308 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
309 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
310 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
312 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
313 @set -e; for l in $(LIBS); do \
315 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
316 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
317 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
318 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
319 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
320 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
322 @ : {- output_off() if $disabled{shared}; "" -}
323 @set -e; for s in $(SHLIB_INFO); do \
324 s1=`echo "$$s" | cut -f1 -d";"`; \
325 s2=`echo "$$s" | cut -f2 -d";"`; \
326 fn1=`basename $$s1`; \
327 fn2=`basename $$s2`; \
328 : {- output_off() if windowsdll(); "" -}; \
329 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
330 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
331 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
332 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
333 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
334 if [ "$$fn1" != "$$fn2" ]; then \
335 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
336 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
338 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
339 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
340 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
341 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
342 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
343 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
344 : {- output_on() unless windowsdll(); "" -}; \
346 @ : {- output_on() if $disabled{shared}; "" -}
347 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
348 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
349 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
350 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
351 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
352 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
353 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
354 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
355 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
356 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
359 @echo "*** Uninstalling development files"
360 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
361 $(BLDDIR)/include/openssl/*.h; do \
363 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
364 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
366 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
367 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
368 @set -e; for l in $(LIBS); do \
370 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
371 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
373 @ : {- output_off() if $disabled{shared}; "" -}
374 @set -e; for s in $(SHLIB_INFO); do \
375 s1=`echo "$$s" | cut -f1 -d";"`; \
376 s2=`echo "$$s" | cut -f2 -d";"`; \
377 fn1=`basename $$s1`; \
378 fn2=`basename $$s2`; \
379 : {- output_off() if windowsdll(); "" -}; \
380 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
381 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
382 if [ "$$fn1" != "$$fn2" ]; then \
383 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
384 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
386 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
387 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
388 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
389 : {- output_on() unless windowsdll(); "" -}; \
391 @ : {- output_on() if $disabled{shared}; "" -}
392 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
393 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
394 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
395 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
396 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
399 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
400 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/
401 @echo "*** Installing engines"
402 @set -e; for e in dummy $(ENGINES); do \
403 if [ "$$e" = "dummy" ]; then continue; fi; \
405 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
408 echo "install $$e -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \
409 cp $$e $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
410 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
411 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new \
412 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
416 @echo "*** Uninstalling engines"
417 @set -e; for e in dummy $(ENGINES); do \
418 if [ "$$e" = "dummy" ]; then continue; fi; \
420 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
423 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \
424 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
426 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines
429 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
430 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
431 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
432 @echo "*** Installing runtime files"
433 : {- output_off() unless windowsdll(); "" -};
434 @set -e; for s in dummy $(SHLIBS); do \
435 if [ "$$s" = "dummy" ]; then continue; fi; \
437 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
438 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
439 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
440 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
441 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
443 : {- output_on() unless windowsdll(); "" -};
444 @set -e; for x in dummy $(PROGRAMS); do \
445 if [ "$$x" = "dummy" ]; then continue; fi; \
447 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
448 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
449 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
450 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
451 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
453 @set -e; for x in dummy $(BIN_SCRIPTS); do \
454 if [ "$$x" = "dummy" ]; then continue; fi; \
456 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
457 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
458 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
459 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
460 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
462 @set -e; for x in dummy $(MISC_SCRIPTS); do \
463 if [ "$$x" = "dummy" ]; then continue; fi; \
465 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
466 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
467 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
468 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
469 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
471 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"
472 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
473 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
474 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
477 @echo "*** Uninstalling runtime files"
478 @set -e; for x in dummy $(PROGRAMS); \
480 if [ "$$x" = "dummy" ]; then continue; fi; \
482 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
483 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
485 @set -e; for x in dummy $(BIN_SCRIPTS); \
487 if [ "$$x" = "dummy" ]; then continue; fi; \
489 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
490 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
492 @set -e; for x in dummy $(MISC_SCRIPTS); \
494 if [ "$$x" = "dummy" ]; then continue; fi; \
496 echo "$(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
497 $(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
499 : {- output_off() unless windowsdll(); "" -};
500 @set -e; for s in dummy $(SHLIBS); do \
501 if [ "$$s" = "dummy" ]; then continue; fi; \
503 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
504 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
506 : {- output_on() unless windowsdll(); "" -};
507 $(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
508 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
509 -$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc
511 # A method to extract all names from a .pod file
512 # The first sed extracts everything between "=head1 NAME" and the next =head1
513 # The perl command joins all the lines into one
514 # The second sed removes the description and turns all commas into spaces
515 # Voilà , you have a space separated list of names!
516 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
517 $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \
518 sed -e 's/ - .*$$//;s/,/ /g'
521 here=`cd $(SRCDIR); pwd`; \
522 point=$$here/util/point.sh; \
523 for ds in apps:1 crypto:3 ssl:3; do \
524 defdir=`echo $$ds | cut -f1 -d:`; \
525 defsec=`echo $$ds | cut -f2 -d:`; \
526 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
527 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
528 [ -z "$$SEC" ] && SEC=$$defsec; \
529 fn=`basename $$p .pod`; \
530 NAME=`echo $$fn | tr [a-z] [A-Z]`; \
531 suf=`eval "echo $$OUTSUFFIX"`; \
532 top=`eval "echo $$OUTTOP"`; \
533 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
534 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
535 cat $$p | eval "$$GENERATE" \
536 > $$top/man$$SEC/$$fn$$suf; \
537 names=`cat $$p | $(EXTRACT_NAMES)`; \
538 ( cd $$top/man$$SEC; \
539 for n in $$names; do \
542 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
543 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
544 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
547 if [ "$$comp_n" != "$$comp_fn" ]; then \
548 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
549 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
556 here=`cd $(SRCDIR); pwd`; \
557 for ds in apps:1 crypto:3 ssl:3; do \
558 defdir=`echo $$ds | cut -f1 -d:`; \
559 defsec=`echo $$ds | cut -f2 -d:`; \
560 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
561 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
562 [ -z "$$SEC" ] && SEC=$$defsec; \
563 fn=`basename $$p .pod`; \
564 suf=`eval "echo $$OUTSUFFIX"`; \
565 top=`eval "echo $$OUTTOP"`; \
566 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
567 $(RM) $$top/man$$SEC/$$fn$$suf; \
568 names=`cat $$p | $(EXTRACT_NAMES)`; \
569 for n in $$names; do \
572 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
573 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
574 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
577 if [ "$$comp_n" != "$$comp_fn" ]; then \
578 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
579 $(RM) $$top/man$$SEC/$$n$$suf; \
582 ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
587 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
588 @echo "*** Installing manpages"
590 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
591 OUTTOP="$(DESTDIR)$(MANDIR)"; \
592 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
596 @echo "*** Uninstalling manpages"
598 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
599 OUTTOP="$(DESTDIR)$(MANDIR)"; \
603 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
604 @echo "*** Installing HTML manpages"
606 OUTSUFFIX='.$(HTMLSUFFIX)'; \
607 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
608 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
609 --podpath=apps:crypto:ssl \
610 | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \
614 @echo "*** Uninstalling manpages"
616 OUTSUFFIX='.$(HTMLSUFFIX)'; \
617 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
621 # Developer targets (note: these are only available on Unix) #########
623 update: generate errors ordinals
625 generate: generate_apps generate_crypto_bn generate_crypto_objects \
626 generate_crypto_conf generate_crypto_asn1
628 # Test coverage is a good idea for the future
629 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
632 # Currently disabled, util/selftest.pl needs a rewrite
634 # SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl
637 lint -DLINT $(INCLUDES) $(SRCS)
639 {- # because the program apps/openssl has object files as sources, and
640 # they then have the corresponding C files as source, we need to chain
641 # the lookups in %unified_info
642 my $apps_openssl = catfile("apps","openssl");
643 our @openssl_source = map { @{$unified_info{sources}->{$_}} }
644 @{$unified_info{sources}->{$apps_openssl}};
647 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
648 < apps/openssl.cnf > apps/openssl-vms.cnf )
649 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \
650 {- join(" ", @openssl_source) -} \
654 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
656 generate_crypto_objects:
657 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
658 crypto/objects/objects.txt \
659 crypto/objects/obj_mac.num \
660 include/openssl/obj_mac.h )
661 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
662 include/openssl/obj_mac.h \
663 crypto/objects/obj_dat.h )
664 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
665 crypto/objects/obj_mac.num \
666 crypto/objects/obj_xref.txt \
667 > crypto/objects/obj_xref.h )
669 generate_crypto_conf:
670 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
671 > crypto/conf/conf_def.h )
673 generate_crypto_asn1:
674 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
675 > crypto/asn1/charmap.h )
678 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
679 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
680 ( cd $(SRCDIR)/engines; \
682 $(PERL) ../util/mkerr.pl -conf $$e \
683 -nostatic -staticloader -write *.c; \
687 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
688 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
692 SRCTOP=../$(SRCDIR) \
693 BLDTOP=../$(BLDDIR) \
694 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
699 -etags `find . -name '*.[ch]' -o -name '*.pm'`
701 # Release targets (note: only available on Unix) #####################
703 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
706 TMPDIR=/var/tmp/openssl-copy.$$$$; \
708 mkdir -p $$TMPDIR/$$DISTDIR; \
710 git ls-tree -r --name-only --full-tree HEAD \
712 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
713 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
717 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
718 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
719 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
720 $(TAR_COMMAND) $$DISTDIR) \
721 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
723 cd $(SRCDIR); ls -l $(TARFILE).gz
726 @$(MAKE) PREPARE_CMD='./Configure dist' tar
728 # Helper targets #####################################################
730 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
732 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
733 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
734 mkdir -p "$(BLDDIR)/util"; \
735 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
737 $(BLDDIR)/util/shlib_wrap.sh: configdata.pm
738 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
739 mkdir -p "$(BLDDIR)/util"; \
740 ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
744 # Building targets ###################################################
746 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS)
748 @ ( echo 'prefix=$(INSTALLTOP)'; \
749 echo 'exec_prefix=$${prefix}'; \
750 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
751 echo 'includedir=$${prefix}/include'; \
753 echo 'Name: OpenSSL-libcrypto'; \
754 echo 'Description: OpenSSL cryptography library'; \
755 echo 'Version: '$(VERSION); \
756 echo 'Libs: -L$${libdir} -lcrypto'; \
757 echo 'Libs.private: $(EX_LIBS)'; \
758 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
761 @ ( echo 'prefix=$(INSTALLTOP)'; \
762 echo 'exec_prefix=$${prefix}'; \
763 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
764 echo 'includedir=$${prefix}/include'; \
766 echo 'Name: OpenSSL-libssl'; \
767 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
768 echo 'Version: '$(VERSION); \
769 echo 'Requires.private: libcrypto'; \
770 echo 'Libs: -L$${libdir} -lssl'; \
771 echo 'Libs.private: $(EX_LIBS)'; \
772 echo 'Cflags: -I$${includedir}' ) > libssl.pc
775 @ ( echo 'prefix=$(INSTALLTOP)'; \
776 echo 'exec_prefix=$${prefix}'; \
777 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
778 echo 'includedir=$${prefix}/include'; \
780 echo 'Name: OpenSSL'; \
781 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
782 echo 'Version: '$(VERSION); \
783 echo 'Requires: libssl libcrypto' ) > openssl.pc
785 # Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which
786 # wasn't passed down automatically. It's quite safe to use it like we do
787 # below; if it doesn't exist, the result will be empty and 'make' will pick
788 # up $(MAKEFLAGS) which is passed down as an environment variable.
789 configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -}
790 @echo "Detected changed: $?"
791 @echo "Reconfiguring..."
792 $(SRCDIR)/Configure reconf
793 @echo "**************************************************"
795 @echo "*** Please run the same make command again ***"
797 @echo "**************************************************"
802 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
804 # Helper function to figure out dependencies on libraries
805 # It takes a list of library names and outputs a list of dependencies
806 sub compute_lib_depends {
807 if ($disabled{shared}) {
808 return map { $_.$libext } @_;
811 # Depending on shared libraries:
812 # On Windows POSIX layers, we depend on {libname}.dll.a
813 # On Unix platforms, we depend on {shlibname}.so
814 return map { shlib_simple($_) } @_;
819 my $generator = join(" ", @{$args{generator}});
820 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
821 my $incs = join("", map { " -I".$_ } @{$args{incs}});
822 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
824 if ($args{src} !~ /\.[sS]$/) {
826 $args{src}: $args{generator}->[0] $deps
827 \$(PERL)$generator_incs $generator > \$@
830 if ($args{generator}->[0] =~ /\.pl$/) {
831 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
832 } elsif ($args{generator}->[0] =~ /\.m4$/) {
833 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
834 } elsif ($args{generator}->[0] =~ /\.S$/) {
837 die "Generator type for $args{src} unknown: $generator\n";
840 if (defined($generator)) {
841 # If the target is named foo.S in build.info, we want to
842 # end up generating foo.s in two steps.
843 if ($args{src} =~ /\.S$/) {
844 (my $target = $args{src}) =~ s|\.S$|.s|;
846 $target: $args{generator}->[0] $deps
847 ( trap "rm -f \$@.*" INT 0; \\
849 \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@.i && mv -f \$@.i \$@ )
854 $args{src}: $args{generator}->[0] $deps
859 $args{src}: $args{generator}->[0] $deps
860 \$(CC) \$(CFLAGS) $incs -E -P \$< > \$@
865 # Should one wonder about the end of the Perl snippet, it's because this
866 # second regexp eats up line endings as well, if the removed path is the
867 # last in the line. We may therefore need to put back a line ending.
870 my $obj = $args{obj};
871 my @srcs = map { if ($unified_info{generate}->{$_}) {
872 (my $x = $_) =~ s/\.S$/.s/; $x
876 } ( @{$args{srcs}} );
877 my $srcs = join(" ", @srcs);
878 my $deps = join(" ", @srcs, @{$args{deps}});
879 my $incs = join("", map { " -I".$_ } @{$args{incs}});
880 unless ($disabled{zlib}) {
881 if ($withargs{zlib_include}) {
882 $incs .= " -I".$withargs{zlib_include};
885 my $ecflags = { lib => '$(LIB_CFLAGS)',
886 dso => '$(DSO_CFLAGS)',
887 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
888 my $makedepprog = $config{makedepprog};
890 if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
893 -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- \$(CFLAGS) $ecflags$incs -- $srcs \\
894 >\$\@.tmp 2>/dev/null
895 -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp
896 \@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\
902 $deps = $obj.$depext;
904 if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) {
907 \$(CC) \$(CFLAGS) $ecflags$incs -c -o \$\@ $srcs
910 if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
913 \$(CC) \$(CFLAGS) $ecflags$incs -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
914 \@touch $obj$depext.tmp
915 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
916 rm -f $obj$depext.tmp; \\
918 mv $obj$depext.tmp $obj$depext; \\
924 # On Unix, we build shlibs from static libs, so we're ignoring the
925 # object file array. We *know* this routine is only called when we've
926 # configure 'shared'.
929 my $lib = $args{lib};
930 my $shlib = $args{shlib};
931 my $libd = dirname($lib);
932 my $libn = basename($lib);
933 (my $libname = $libn) =~ s/^lib//;
934 my $linklibs = join("", map { my $d = dirname($_);
935 my $f = basename($_);
936 (my $l = $f) =~ s/^lib//;
937 " -L$d -l$l" } @{$args{deps}});
938 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
939 my $shlib_target = $target{shared_target};
940 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
941 my $target = shlib_simple($lib);
943 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
944 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
945 # With all other Unix platforms, we often build a shared library with the
946 # SO version built into the file name and a symlink without the SO version
947 # It's not necessary to have both as targets. The choice falls on the
948 # simplest, {libname}$shlibextimport for Windows POSIX layers and
949 # {libname}$shlibextsimple for the Unix platforms.
950 $target: $lib$libext $deps $ordinalsfile
951 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
952 PLATFORM=\$(PLATFORM) \\
953 PERL=\$(PERL) SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
954 INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
955 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
956 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
957 LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
958 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
959 CROSS_COMPILE='\$(CROSS_COMPILE)' LDFLAGS='\$(LDFLAGS)' \\
960 SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
961 SHARED_RCFLAGS='\$(RCFLAGS)' \\
962 link_shlib.$shlib_target
964 . (windowsdll() ? <<"EOF" : "");
965 rm -f apps/$shlib$shlibext
966 rm -f test/$shlib$shlibext
967 cp -p $shlib$shlibext apps/
968 cp -p $shlib$shlibext test/
973 my $lib = $args{lib};
974 my $libd = dirname($lib);
975 my $libn = basename($lib);
976 (my $libname = $libn) =~ s/^lib//;
977 my $shlibdeps = join("", map { my $d = dirname($_);
978 my $f = basename($_);
979 (my $l = $f) =~ s/^lib//;
980 " -L$d -l$l" } @{$args{deps}});
981 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
982 my $shlib_target = $target{shared_target};
983 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
984 my $target = dso($lib);
987 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
988 PLATFORM=\$(PLATFORM) \\
989 PERL=\$(PERL) SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
990 LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
991 LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
992 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
993 SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
996 link_dso.$shlib_target
1001 my $lib = $args{lib};
1002 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1006 \$(RANLIB) \$\@ || echo Never mind.
1011 my $bin = $args{bin};
1012 my $bind = dirname($bin);
1013 my $binn = basename($bin);
1014 my $objs = join(" ", map { $_.$objext } @{$args{objs}});
1015 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
1016 my $linklibs = join("", map { my $d = dirname($_);
1017 my $f = basename($_);
1018 $d = "." if $d eq $f;
1019 (my $l = $f) =~ s/^lib//;
1020 " -L$d -l$l" } @{$args{deps}});
1021 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1023 $bin$exeext: $objs $deps
1025 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
1026 PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
1027 APPNAME=$bin$exeext OBJECTS="$objs" \\
1028 LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
1029 CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
1030 LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\
1031 link_app.$shlib_target
1036 my $script = $args{script};
1037 my $sources = join(" ", @{$args{sources}});
1038 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1039 "util", "dofile.pl")),
1040 rel2abs($config{builddir}));
1043 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
1044 "-o$target{build_file}" $sources > "$script"
1048 "" # Important! This becomes part of the template result.