2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
8 # shlib and shlib_simple both take a static library name and figure
9 # out what the shlib name should be.
11 # When OpenSSL is configured "no-shared", these functions will just
12 # return empty lists, making them suitable to join().
14 # With Windows DLL producers, shlib($libname) will return the shared
15 # library name (which usually is different from the static library
16 # name) with the default shared extension appended to it, while
17 # shlib_simple($libname) will return the static library name with
18 # the shared extension followed by ".a" appended to it. The former
19 # result is used as the runtime shared library while the latter is
20 # used as the DLL import library.
22 # On all Unix systems, shlib($libname) will return the library name
23 # with the default shared extension, while shlib_simple($libname)
24 # will return the name from shlib($libname) with any SO version number
25 # removed. On some systems, they may therefore return the exact same
28 return () if $config{no_shared};
30 return $unified_info{sharednames}->{$lib} . '$(SHLIB_EXT)';
33 return () if $config{no_shared};
37 return $lib . '$(SHLIB_EXT_IMPORT)';
39 return $lib . '$(SHLIB_EXT_SIMPLE)';
42 # dso is a complement to shlib / shlib_simple that returns the
43 # given libname with the simple shared extension (possible SO version
44 # removed). This differs from shlib_simple() by being unconditional.
48 return $engine . '$(DSO_EXT)';
51 PLATFORM={- $config{target} -}
52 OPTIONS={- $config{options} -}
53 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
54 SRCDIR={- $config{sourcedir} -}
55 BLDDIR={- $config{builddir} -}
57 VERSION={- $config{version} -}
58 MAJOR={- $config{major} -}
59 MINOR={- $config{minor} -}
60 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
61 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
62 SHLIB_MAJOR={- $config{shlib_major} -}
63 SHLIB_MINOR={- $config{shlib_minor} -}
64 SHLIB_TARGET={- $target{shared_target} -}
66 EXE_EXT={- $target{exe_extension} || "" -}
67 LIB_EXT={- $target{lib_extension} || ".a" -}
68 SHLIB_EXT={- $target{shared_extension} || ".so" -}
69 SHLIB_EXT_SIMPLE={- $target{shared_extension_simple} || ".so" -}
70 SHLIB_EXT_IMPORT={- $target{shared_import_extension} || "" -}
71 DSO_EXT={- $target{dso_extension} || ".so" -}
72 OBJ_EXT={- $target{obj_extension} || ".o" -}
73 DEP_EXT={- $target{dep_extension} || ".d" -}
75 LIBS={- join(" ", map { $_."\$(LIB_EXT)" } @{$unified_info{libraries}}) -}
76 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
77 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
78 PROGRAMS={- join(" ", map { $_."\$(EXE_EXT)" } grep { !m|^test/| } @{$unified_info{programs}}) -}
79 TESTPROGS={- join(" ", map { $_."\$(EXE_EXT)" } grep { m|^test/| } @{$unified_info{programs}}) -}
80 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
81 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
82 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
83 keys %{$unified_info{sources}}); -}
85 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
86 MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \
87 $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \
88 $(BLDDIR)/apps/CA.pl $(SRCDIR)/apps/tsget
90 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
92 # DESTDIR is for package builders so that they can configure for, say,
93 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
94 # Normally it is left empty.
97 # Do not edit these manually. Use Configure with --prefix or --openssldir
98 # to change this! Short explanation in the top comment in Configure
99 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
101 our $prefix = $config{prefix} || "/usr/local";
104 # The logic here is that if no --openssldir was given,
105 # OPENSSLDIR will get the value from $prefix plus "/ssl".
106 # If --openssldir was given and the value is an absolute
107 # path, OPENSSLDIR will get its value without change.
108 # If the value from --openssldir is a relative path,
109 # OPENSSLDIR will get $prefix with the --openssldir
110 # value appended as a subdirectory.
112 use File::Spec::Functions;
114 $config{openssldir} ?
115 (file_name_is_absolute($config{openssldir}) ?
117 : catdir($prefix, $config{openssldir}))
118 : catdir($prefix, "ssl");
121 # if $prefix/lib$target{multilib} is not an existing
122 # directory, then assume that it's not searched by linker
123 # automatically, in which case adding $target{multilib} suffix
124 # causes more grief than we're ready to tolerate, so don't...
126 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
127 our $libdir = $config{libdir} || "lib$multilib";
129 ENGINESDIR={- use File::Spec::Functions;
130 catdir($prefix,$libdir,"engines") -}
132 MANDIR=$(INSTALLTOP)/share/man
133 DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
134 HTMLDIR=$(DOCDIR)/html
136 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
137 # appended after the manpage file section number. "ssl" is popular,
138 # resulting in files such as config.5ssl rather than config.5.
144 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
145 CC= $(CROSS_COMPILE){- $target{cc} -}
146 CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
147 CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
148 LDFLAGS= {- $config{lflags} -}
149 PLIB_LDFLAGS= {- $config{plib_lflags} -}
150 EX_LIBS= {- $config{ex_libs} -}
151 SHARED_CFLAGS={- $target{shared_cflag} || "" -}
152 SHARED_LDFLAGS={- $target{shared_ldflag}
153 # Unlike other OSes (like Solaris, Linux, Tru64,
154 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
155 # and FreeBSD) "demand" RPATH set on .so objects.
156 # Apparently application RPATH is not global and
157 # does not apply to .so linked with other .so.
158 # Problem manifests itself when libssl.so fails to
159 # load libcrypto.so. One can argue that we should
160 # engrave this into Makefile.shared rules or into
161 # BSD-* config lines above. Meanwhile let's try to
162 # be cautious and pass -rpath to linker only when
163 # $prefix is not /usr.
164 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
165 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
166 SHARED_RCFLAGS={- $target{shared_rcflag} -}
167 DSO_CFLAGS={- $target{shared_cflag} || "" -}
170 PERL={- $config{perl} -}
172 ARFLAGS= {- $target{arflags} -}
173 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
174 RANLIB= {- $target{ranlib} -}
175 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
178 TAR= {- $target{tar} || "tar" -}
179 TARFLAGS= {- $target{tarflags} -}
180 MAKEDEPEND=$(CROSS_COMPILE){- $config{makedepprog} -}
183 NAME= $(BASENAME)-$(VERSION)
184 TARFILE= ../$(NAME).tar
186 # We let the C compiler driver to take care of .s files. This is done in
187 # order to be excused from maintaining a separate set of architecture
188 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
189 # gcc, then the driver will automatically translate it to -xarch=v8plus
190 # and pass it down to assembler.
193 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
195 # For x86 assembler: Set PROCESSOR to 386 if you want to support
197 PROCESSOR= {- $config{processor} -}
199 # The main targets ###################################################
201 all: configdata.pm build_libs_nodep build_engines_nodep build_apps_nodep \
204 build_libs: configdata.pm build_libs_nodep depend
205 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
206 build_engines: configdata.pm build_engines_nodep depend
207 build_engines_nodep: $(ENGINES)
208 build_apps: configdata.pm build_apps_nodep depend
209 build_apps_nodep: $(PROGRAMS) $(SCRIPTS)
210 build_tests: configdata.pm build_tests_nodep depend
211 build_tests_nodep: $(TESTPROGS)
213 test tests: build_tests_nodep build_apps_nodep build_engines_nodep depend rehash
215 SRCTOP=../$(SRCDIR) \
216 BLDTOP=../$(BLDDIR) \
218 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
221 @TOP=$(SRCDIR) PERL=$(PERL) $(PERL) $(SRCDIR)/test/run_tests.pl list
224 @set -e; for s in $(SHLIB_INFO); do \
225 s1=`echo "$$s" | cut -f1 -d";"`; \
226 s2=`echo "$$s" | cut -f2 -d";"`; \
229 if [ "$$s1" != "$$s2" ]; then \
236 install: install_sw install_ssldirs install_docs
238 uninstall: uninstall_docs uninstall_sw
241 rm -f $(PROGRAMS) $(TESTPROGS)
242 rm -f `find $(BLDDIR) -name '*$(DEP_EXT)'`
243 rm -f `find $(BLDDIR) -name '*$(OBJ_EXT)'`
244 rm -f $(BLDDIR)/core $(BLDDIR)/rehash.time
245 rm -f $(BLDDIR)/tags $(BLDDIR)/TAGS
246 rm -f $(BLDDIR)/openssl.pc $(BLDDIR)/libcrypto.pc $(BLDDIR)/libssl.pc
247 -rm -f `find $(BLDDIR) -type l`
250 # This exists solely for those who still type 'make depend'
253 @( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \
254 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
256 for d in $(DEPS); do \
257 if [ -f $$d ]; then cat $$d; fi; \
258 done ) > Makefile.new
259 @if ! cmp Makefile.new Makefile >/dev/null 2>&1; then \
260 mv -f Makefile.new Makefile; \
262 rm -f Makefile.new; \
265 # Install helper targets #############################################
267 install_sw: all install_dev install_engines install_runtime
269 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
271 install_docs: install_man_docs install_html_docs
273 uninstall_docs: uninstall_man_docs uninstall_html_docs
274 $(RM) -r -v $(DESTDIR)$(DOCDIR)
277 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
278 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
281 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
282 @echo "*** Installing development files"
283 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
284 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
285 $(BLDDIR)/include/openssl/*.h; do \
287 echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
288 cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
289 chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
291 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
292 @set -e; for l in $(LIBS); do \
294 echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
295 cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
296 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
297 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
298 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
299 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
301 @ : {- output_off() if $config{no_shared}; "" -}
302 @set -e; for s in $(SHLIB_INFO); do \
303 s1=`echo "$$s" | cut -f1 -d";"`; \
304 s2=`echo "$$s" | cut -f2 -d";"`; \
305 fn1=`basename $$s1`; \
306 fn2=`basename $$s2`; \
307 : {- output_off() if windowsdll(); "" -}; \
308 echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
309 cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
310 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
311 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
312 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
313 if [ "$$fn1" != "$$fn2" ]; then \
314 echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
315 ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
317 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
318 echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
319 cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
320 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
321 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
322 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
323 : {- output_on() unless windowsdll(); "" -}; \
325 @ : {- output_on() if $config{no_shared}; "" -}
326 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
327 @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
328 @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
329 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
330 @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
331 @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
332 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
333 @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
334 @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
335 @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
338 @echo "*** Uninstalling development files"
339 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
340 $(BLDDIR)/include/openssl/*.h; do \
342 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
343 $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
345 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
346 -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
347 @set -e; for l in $(LIBS); do \
349 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
350 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
352 @ : {- output_off() if $config{no_shared}; "" -}
353 @set -e; for s in $(SHLIB_INFO); do \
354 s1=`echo "$$s" | cut -f1 -d";"`; \
355 s2=`echo "$$s" | cut -f2 -d";"`; \
356 fn1=`basename $$s1`; \
357 fn2=`basename $$s2`; \
358 : {- output_off() if windowsdll(); "" -}; \
359 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
360 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
361 if [ "$$fn1" != "$$fn2" ]; then \
362 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
363 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
365 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
366 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
367 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
368 : {- output_on() unless windowsdll(); "" -}; \
370 @ : {- output_on() if $config{no_shared}; "" -}
371 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
372 @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
373 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
374 @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
375 @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
376 @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
377 @echo $(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
378 -@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
379 @echo $(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
380 -@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
383 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
384 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/
385 @echo "*** Installing engines"
386 @set -e; for e in $(ENGINES); do \
388 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
391 echo "install $$e -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \
392 cp $$e $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
393 chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
394 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new \
395 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
399 @echo "*** Uninstalling engines"
400 @set -e; for e in $(ENGINES); do \
402 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
405 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \
406 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
408 @echo "$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines"
409 -@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines
412 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
413 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
414 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
415 @echo "*** Installing runtime files"
416 : {- output_off() unless windowsdll(); "" -};
417 @set -e; for s in $(SHLIBS); do \
419 echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
420 cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
421 chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
422 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
423 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
425 : {- output_on() unless windowsdll(); "" -};
426 @set -e; for x in $(PROGRAMS); do \
428 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
429 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
430 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
431 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
432 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
434 @set -e; for x in $(BIN_SCRIPTS); do \
436 echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
437 cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
438 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
439 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
440 $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
442 @set -e; for x in $(MISC_SCRIPTS); do \
444 echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
445 cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
446 chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
447 mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
448 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
450 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"
451 @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
452 @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
453 @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
456 @echo "*** Uninstalling runtime files"
457 @set -e; for x in $(PROGRAMS); \
460 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
461 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
463 @set -e; for x in $(BIN_SCRIPTS); \
466 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
467 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
469 @set -e; for x in $(MISC_SCRIPTS); \
472 echo "$(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
473 $(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
475 : {- output_off() unless windowsdll(); "" -};
476 @set -e; for s in $(SHLIBS); do \
478 echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
479 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
481 : {- output_on() unless windowsdll(); "" -};
482 $(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
483 @echo "$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin"
484 -@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
485 @echo "$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc"
486 -@$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc
488 # A method to extract all names from a .pod file
489 # The first sed extracts everything between "=head1 NAME" and the next =head1
490 # The second sed joins all the lines into one
491 # The third sed removes the description and turns all commas into spaces
492 # Voilà , you have a space separated list of names!
493 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
494 sed -e ':a;{N;s/\n/ /;ba}' | \
495 sed -e 's/ - .*$$//;s/,/ /g'
498 here=`cd $(SRCDIR); pwd`; \
499 point=$$here/util/point.sh; \
500 for ds in apps:1 crypto:3 ssl:3; do \
501 defdir=`echo $$ds | cut -f1 -d:`; \
502 defsec=`echo $$ds | cut -f2 -d:`; \
503 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
504 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
505 [ -z "$$SEC" ] && SEC=$$defsec; \
506 fn=`basename $$p .pod`; \
507 NAME=`echo $$fn | tr [a-z] [A-Z]`; \
508 suf=`eval "echo $$OUTSUFFIX"`; \
509 top=`eval "echo $$OUTTOP"`; \
510 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
511 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
512 cat $$p | eval "$$GENERATE" \
513 > $$top/man$$SEC/$$fn$$suf; \
514 names=`cat $$p | $(EXTRACT_NAMES)`; \
515 ( cd $$top/man$$SEC; \
516 for n in $$names; do \
519 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
520 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
521 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
524 if [ "$$comp_n" != "$$comp_fn" ]; then \
525 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
526 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
533 here=`cd $(SRCDIR); pwd`; \
534 for ds in apps:1 crypto:3 ssl:3; do \
535 defdir=`echo $$ds | cut -f1 -d:`; \
536 defsec=`echo $$ds | cut -f2 -d:`; \
537 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
538 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
539 [ -z "$$SEC" ] && SEC=$$defsec; \
540 fn=`basename $$p .pod`; \
541 suf=`eval "echo $$OUTSUFFIX"`; \
542 top=`eval "echo $$OUTTOP"`; \
543 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
544 $(RM) $$top/man$$SEC/$$fn$$suf; \
545 names=`cat $$p | $(EXTRACT_NAMES)`; \
546 for n in $$names; do \
549 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
550 comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \
551 comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \
554 if [ "$$comp_n" != "$$comp_fn" ]; then \
555 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
556 $(RM) $$top/man$$SEC/$$n$$suf; \
559 ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
564 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
565 @echo "*** Installing manpages"
567 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
568 OUTTOP="$(DESTDIR)$(MANDIR)"; \
569 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
573 @echo "*** Uninstalling manpages"
575 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
576 OUTTOP="$(DESTDIR)$(MANDIR)"; \
580 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
581 @echo "*** Installing HTML manpages"
583 OUTSUFFIX='.$(HTMLSUFFIX)'; \
584 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
585 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
586 --podpath=apps:crypto:ssl \
587 | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \
591 @echo "*** Uninstalling manpages"
593 OUTSUFFIX='.$(HTMLSUFFIX)'; \
594 OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
598 # Developer targets (note: these are only available on Unix) #########
600 update: generate errors ordinals
602 generate: generate_apps generate_crypto_bn generate_crypto_objects
604 # Test coverage is a good idea for the future
605 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
608 # Currently disabled, util/selftest.pl needs a rewrite
610 # SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl
613 lint -DLINT $(INCLUDES) $(SRCS)
615 generate_apps: $(SRCDIR)/apps/openssl-vms.cnf $(SRCDIR)/apps/progs.h
617 generate_crypto_bn: $(SRCDIR)/crypto/bn/bn_prime.h
619 generate_crypto_objects: $(SRCDIR)/crypto/objects/obj_dat.h \
620 $(SRCDIR)/include/openssl/obj_mac.h \
621 $(SRCDIR)/crypto/objects/obj_xref.h
624 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
625 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
626 ( cd $(SRCDIR)/engines; \
628 $(PERL) ../util/mkerr.pl -conf $$e \
629 -nostatic -staticloader -write *.c; \
631 ( cd $(SRCDIR)/crypto/ct; \
632 $(PERL) ../../util/mkerr.pl -conf ct.ec -hprefix internal/ -write *.c )
635 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
636 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
640 SRCTOP=../$(SRCDIR) \
641 BLDTOP=../$(BLDDIR) \
642 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
647 -etags `find . -name '*.[ch]' -o -name '*.pm'`
649 # Release targets (note: only available on Unix) #####################
652 TMPDIR=/var/tmp/openssl-copy.$$$$; \
653 DISTDIR=openssl-$(VERSION); \
654 mkdir -p $$TMPDIR/$$DISTDIR; \
656 git ls-tree -r --name-only --full-tree HEAD \
658 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
659 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
662 [ -n "$(PREPARE_CMD)" ] && $(PREPARE_CMD); \
663 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
664 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
665 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
666 $(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - $$DISTDIR) \
667 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
669 cd $(SRCDIR); ls -l $(TARFILE).gz
672 @$(MAKE) PREPARE_CMD='./Configure dist' tar
674 # Helper targets #####################################################
676 rehash: link-utils copy-certs build_apps_nodep
677 @if [ -z "$(CROSS_COMPILE)" ]; then \
678 (OPENSSL="$(BLDDIR)/util/shlib_wrap.sh apps/openssl"; \
679 [ -x "$(BLDDIR)/openssl.exe" ] && OPENSSL="$(BLDDIR)/openssl.exe" || :; \
680 OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \
681 export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \
682 $$OPENSSL rehash certs/demo \
683 || $(PERL) tools/c_rehash certs/demo) && \
687 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
689 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
690 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
691 mkdir -p "$(BLDDIR)/util"; \
692 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
694 $(BLDDIR)/util/shlib_wrap.sh: configdata.pm
695 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
696 mkdir -p "$(BLDDIR)/util"; \
697 ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
701 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
702 cp -R "$(SRCDIR)/certs" "$(BLDDIR)/"; \
705 $(SRCDIR)/apps/openssl-vms.cnf: $(SRCDIR)/apps/openssl.cnf
706 $(PERL) $(SRCDIR)/VMS/VMSify-conf.pl \
707 < $(SRCDIR)/apps/openssl.cnf > $(SRCDIR)/apps/openssl-vms.cnf
709 {- # because the program apps/openssl has object files as sources, and
710 # they then have the corresponding C files as source, we need to chain
711 # the lookups in %unified_info
712 my $apps_openssl = catfile("apps","openssl");
713 our @openssl_source = map { @{$unified_info{sources}->{$_}} }
714 @{$unified_info{sources}->{$apps_openssl}};
716 $(SRCDIR)/apps/progs.h:
718 $(PERL) $(SRCDIR)/apps/progs.pl {- join(" ", @openssl_source) -} > $@
720 $(SRCDIR)/crypto/bn/bn_prime.h: $(SRCDIR)/crypto/bn/bn_prime.pl
721 $(PERL) $(SRCDIR)/crypto/bn/bn_prime.pl > $(SRCDIR)/crypto/bn/bn_prime.h
723 $(SRCDIR)/crypto/objects/obj_dat.h: $(SRCDIR)/crypto/objects/obj_dat.pl \
724 $(SRCDIR)/include/openssl/obj_mac.h
725 $(PERL) $(SRCDIR)/crypto/objects/obj_dat.pl \
726 $(SRCDIR)/include/openssl/obj_mac.h \
727 $(SRCDIR)/crypto/objects/obj_dat.h
729 # objects.pl both reads and writes obj_mac.num
730 $(SRCDIR)/include/openssl/obj_mac.h: $(SRCDIR)/crypto/objects/objects.pl \
731 $(SRCDIR)/crypto/objects/objects.txt \
732 $(SRCDIR)/crypto/objects/obj_mac.num
733 $(PERL) $(SRCDIR)/crypto/objects/objects.pl \
734 $(SRCDIR)/crypto/objects/objects.txt \
735 $(SRCDIR)/crypto/objects/obj_mac.num \
736 $(SRCDIR)/include/openssl/obj_mac.h
737 @sleep 1; touch $(SRCDIR)/include/openssl/obj_mac.h; sleep 1
739 $(SRCDIR)/crypto/objects/obj_xref.h: $(SRCDIR)/crypto/objects/objxref.pl \
740 $(SRCDIR)/crypto/objects/obj_xref.txt \
741 $(SRCDIR)/crypto/objects/obj_mac.num
742 $(PERL) $(SRCDIR)/crypto/objects/objxref.pl \
743 $(SRCDIR)/crypto/objects/obj_mac.num \
744 $(SRCDIR)/crypto/objects/obj_xref.txt \
745 > $(SRCDIR)/crypto/objects/obj_xref.h
746 @sleep 1; touch $(SRCDIR)/crypto/objects/obj_xref.h; sleep 1
750 # Building targets ###################################################
752 libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS)
754 @ ( echo 'prefix=$(INSTALLTOP)'; \
755 echo 'exec_prefix=$${prefix}'; \
756 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
757 echo 'includedir=$${prefix}/include'; \
759 echo 'Name: OpenSSL-libcrypto'; \
760 echo 'Description: OpenSSL cryptography library'; \
761 echo 'Version: '$(VERSION); \
762 echo 'Libs: -L$${libdir} -lcrypto'; \
763 echo 'Libs.private: $(EX_LIBS)'; \
764 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
767 @ ( echo 'prefix=$(INSTALLTOP)'; \
768 echo 'exec_prefix=$${prefix}'; \
769 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
770 echo 'includedir=$${prefix}/include'; \
772 echo 'Name: OpenSSL-libssl'; \
773 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
774 echo 'Version: '$(VERSION); \
775 echo 'Requires.private: libcrypto'; \
776 echo 'Libs: -L$${libdir} -lssl'; \
777 echo 'Libs.private: $(EX_LIBS)'; \
778 echo 'Cflags: -I$${includedir}' ) > libssl.pc
781 @ ( echo 'prefix=$(INSTALLTOP)'; \
782 echo 'exec_prefix=$${prefix}'; \
783 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
784 echo 'includedir=$${prefix}/include'; \
786 echo 'Name: OpenSSL'; \
787 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
788 echo 'Version: '$(VERSION); \
789 echo 'Requires: libssl libcrypto' ) > openssl.pc
791 # Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which
792 # wasn't passed down automatically. It's quite safe to use it like we do
793 # below; if it doesn't exist, the result will be empty and 'make' will pick
794 # up $(MAKEFLAGS) which is passed down as an environment variable.
795 configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/config
796 @echo "Detected changed: $?"
797 @echo "Reconfiguring..."
798 $(SRCDIR)/Configure reconf
799 @echo "**************************************************"
801 @echo "*** Please run the same make command again ***"
803 @echo "**************************************************"
808 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
810 # Helper function to figure out dependencies on libraries
811 # It takes a list of library names and outputs a list of dependencies
812 sub compute_lib_depends {
813 if ($config{no_shared}) {
814 return map { $_."\$(LIB_EXT)" } @_;
817 # Depending on shared libraries:
818 # On Windows POSIX layers, we depend on {libname}.dll.a
819 # On Unix platforms, we depend on {shlibname}.so
820 return map { shlib_simple($_) } @_;
825 my $obj = $args{obj};
826 my $srcs = join(" ", @{$args{srcs}});
827 my $deps = join(" ", @{$args{srcs}}, @{$args{deps}});
828 my $incs = join("", map { " -I".$_ } @{$args{incs}});
829 my $ecflags = { lib => '$(SHARED_CFLAGS)',
830 dso => '$(DSO_CFLAGS)',
831 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
832 my $makedepprog = $config{makedepprog};
833 if ($makedepprog eq "makedepend") {
835 $obj\$(DEP_EXT): $deps
836 rm -f \$\@.tmp; touch \$\@.tmp
837 \$(MAKEDEPEND) -f\$\@.tmp -o"|$obj" -- \$(CFLAGS) $ecflags$incs -- $srcs \\
839 sed -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp > \$\@
841 $obj\$(OBJ_EXT): $obj\$(DEP_EXT)
842 \$(CC) \$(CFLAGS) $ecflags$incs -c -o \$\@ $srcs
846 $obj\$(DEP_EXT): $deps
847 \$(CC) \$(CFLAGS) $ecflags$incs -MM -MF \$\@ -MQ $obj $srcs
848 $obj\$(OBJ_EXT): $obj\$(DEP_EXT)
849 \$(CC) \$(CFLAGS) $ecflags$incs -c -o \$\@ $srcs
852 # On Unix, we build shlibs from static libs, so we're ignoring the
853 # object file array. We *know* this routine is only called when we've
854 # configure 'shared'.
857 my $lib = $args{lib};
858 my $shlib = $args{shlib};
859 my $libd = dirname($lib);
860 my $libn = basename($lib);
861 (my $libname = $libn) =~ s/^lib//;
862 my $linklibs = join("", map { my $d = dirname($_);
863 my $f = basename($_);
864 (my $l = $f) =~ s/^lib//;
865 " -L$d -l$l" } @{$args{deps}});
866 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
867 my $shlib_target = $target{shared_target};
868 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
869 my $target = shlib_simple($lib);
871 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
872 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
873 # With all other Unix platforms, we often build a shared library with the
874 # SO version built into the file name and a symlink without the SO version
875 # It's not necessary to have both as targets. The choice falls on the
876 # simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
877 # {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
878 $target : $lib\$(LIB_EXT) $deps $ordinalsfile
879 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
880 PLATFORM=\$(PLATFORM) \\
881 PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
882 INSTALLTOP="\$(INSTALLTOP)" LIBDIR="\$(LIBDIR)" \\
883 LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\
884 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
885 LIBCOMPATVERSIONS=";\$(SHLIB_VERSION_HISTORY)" \\
886 CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
887 CROSS_COMPILE="\$(CROSS_COMPILE)" \\
888 SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=\$(SHLIB_EXT) \\
889 SHARED_RCFLAGS="\$(SHARED_RCFLAGS)" \\
890 link_shlib.$shlib_target
892 . (windowsdll() ? <<"EOF" : "");
893 rm -f apps/$shlib\$(SHLIB_EXT)
894 rm -f test/$shlib\$(SHLIB_EXT)
895 cp -p $shlib\$(SHLIB_EXT) apps/
896 cp -p $shlib\$(SHLIB_EXT) test/
901 my $lib = $args{lib};
902 my $libd = dirname($lib);
903 my $libn = basename($lib);
904 (my $libname = $libn) =~ s/^lib//;
905 my $shlibdeps = join("", map { my $d = dirname($_);
906 my $f = basename($_);
907 (my $l = $f) =~ s/^lib//;
908 " -L$d -l$l" } @{$args{deps}});
909 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
910 my $shlib_target = $target{shared_target};
911 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
912 my $target = dso($lib);
915 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
916 PLATFORM=\$(PLATFORM) \\
917 PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
918 LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\
919 LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\
920 CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\
921 SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\
922 SHLIB_EXT=\$(DSO_EXT) \\
924 link_dso.$shlib_target
929 my $lib = $args{lib};
930 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
932 $lib\$(LIB_EXT): $objs
934 \$(RANLIB) \$\@ || echo Never mind.
939 my $bin = $args{bin};
940 my $bind = dirname($bin);
941 my $binn = basename($bin);
942 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
943 my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
944 my $linklibs = join("", map { my $d = dirname($_);
945 my $f = basename($_);
946 $d = "." if $d eq $f;
947 (my $l = $f) =~ s/^lib//;
948 " -L$d -l$l" } @{$args{deps}});
949 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
951 $bin\$(EXE_EXT): $objs $deps
952 \$(RM) $bin\$(EXE_EXT)
953 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
954 PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
955 APPNAME=$bin\$(EXE_EXT) OBJECTS="$objs" \\
956 LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\
957 CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
958 LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
959 link_app.$shlib_target
964 my $script = $args{script};
965 my $sources = join(" ", @{$args{sources}});
966 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
967 "util", "dofile.pl")),
968 rel2abs($config{builddir}));
971 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
972 "-o$target{build_file}" $sources > "$script"
976 "" # Important! This becomes part of the template result.