2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
7 sub shlib_ext { $target{shared_extension} || ".so" }
8 sub shlib_ext_simple { (my $x = $target{shared_extension})
9 =~ s/\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)//;
12 PLATFORM={- $config{target} -}
13 OPTIONS={- $config{options} -}
14 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
15 SRCDIR={- $config{sourcedir} -}
16 BLDDIR={- $config{builddir} -}
18 VERSION={- $config{version} -}
19 MAJOR={- $config{major} -}
20 MINOR={- $config{minor} -}
21 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
22 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
23 SHLIB_MAJOR={- $config{shlib_major} -}
24 SHLIB_MINOR={- $config{shlib_minor} -}
25 SHLIB_TARGET={- $target{shared_target} -}
27 EXE_EXT={- $target{exe_extension} || "" -}
28 LIB_EXT={- $target{lib_extension} || ".a" -}
29 SHLIB_EXT={- shlib_ext() -}
30 SHLIB_EXT_SIMPLE={- shlib_ext_simple() -}
31 OBJ_EXT={- $target{obj_extension} || ".o" -}
32 DEP_EXT={- $target{dep_extension} || ".d" -}
34 LIBS={- join(" ", map { $_."\$(LIB_EXT)" } @{$unified_info{libraries}}) -}
35 SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
36 ENGINES={- join(" ", map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$unified_info{engines}}) -}
37 PROGRAMS={- join(" ", map { $_."\$(EXE_EXT)" } grep { !m|^test/| } @{$unified_info{programs}}) -}
38 TESTPROGS={- join(" ", map { $_."\$(EXE_EXT)" } grep { m|^test/| } @{$unified_info{programs}}) -}
39 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
40 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
41 MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \
42 $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \
43 $(BLDDIR)/apps/CA.pl $(SRCDIR)/apps/tsget
45 # INSTALL_PREFIX is for package builders so that they can configure
46 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
47 # Normally it is left empty.
48 INSTALL_PREFIX={- $config{install_prefix} -}
50 # Do not edit these manually. Use Configure with --prefix or --openssldir
51 # to change this! Short explanation in the top comment in Configure
52 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
54 our $prefix = $config{prefix} || "/usr/local";
57 # The logic here is that if no --openssldir was given,
58 # OPENSSLDIR will get the value from $prefix plus "/ssl".
59 # If --openssldir was given and the value is an absolute
60 # path, OPENSSLDIR will get its value without change.
61 # If the value from --openssldir is a relative path,
62 # OPENSSLDIR will get $prefix with the --openssldir
63 # value appended as a subdirectory.
65 use File::Spec::Functions;
68 (file_name_is_absolute($config{openssldir}) ?
70 : catdir($prefix, $config{openssldir}))
71 : catdir($prefix, "ssl");
74 # if $prefix/lib$target{multilib} is not an existing
75 # directory, then assume that it's not searched by linker
76 # automatically, in which case adding $target{multilib} suffix
77 # causes more grief than we're ready to tolerate, so don't...
79 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
80 our $libdir = $config{libdir} || "lib$multilib";
82 ENGINESDIR={- use File::Spec::Functions;
83 catdir($prefix,$libdir,"engines") -}
85 MANDIR=$(OPENSSLDIR)/man
86 HTMLDIR=$(OPENSSLDIR)/html
93 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
94 CC= $(CROSS_COMPILE){- $target{cc} -}
95 CFLAGS={- join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
96 DEPFLAGS= {- join(" ",map { "-D".$_} @{$config{depdefines}}) -}
97 LDFLAGS= {- $config{lflags} -}
98 PLIB_LDFLAGS= {- $config{plib_lflags} -}
99 EX_LIBS= {- $config{ex_libs} -}
100 SHARED_LDFLAGS={- $target{shared_ldflag}
101 # Unlike other OSes (like Solaris, Linux, Tru64,
102 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
103 # and FreeBSD) "demand" RPATH set on .so objects.
104 # Apparently application RPATH is not global and
105 # does not apply to .so linked with other .so.
106 # Problem manifests itself when libssl.so fails to
107 # load libcrypto.so. One can argue that we should
108 # engrave this into Makefile.shared rules or into
109 # BSD-* config lines above. Meanwhile let's try to
110 # be cautious and pass -rpath to linker only when
111 # $prefix is not /usr.
112 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
113 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
115 PERL={- $config{perl} -}
117 ARFLAGS= {- $target{arflags} -}
118 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
119 RANLIB= {- $target{ranlib} -}
120 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
122 TAR= {- $target{tar} || "tar" -}
123 TARFLAGS= {- $target{tarflags} -}
126 NAME= $(BASENAME)-$(VERSION)
127 TARFILE= ../$(NAME).tar
129 # We let the C compiler driver to take care of .s files. This is done in
130 # order to be excused from maintaining a separate set of architecture
131 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
132 # gcc, then the driver will automatically translate it to -xarch=v8plus
133 # and pass it down to assembler.
136 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
138 # For x86 assembler: Set PROCESSOR to 386 if you want to support
140 PROCESSOR= {- $config{processor} -}
142 # The main targets ###################################################
144 all: Makefile libcrypto.pc libssl.pc openssl.pc $(ENGINES) $(PROGRAMS) $(SCRIPTS) $(TESTPROGS)
146 test tests: $(TESTPROGS) rehash
148 SRCTOP=../$(SRCDIR) \
149 BLDTOP=../$(BLDDIR) \
150 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
153 @TOP=$(SRCDIR) PERL=$(PERL) $(PERL) $(SRCDIR)/test/run_tests.pl list
156 -rm -f `find $(BLDDIR) -name '*$(LIB_EXT)' -o -name '*$(SHLIB_EXT)'`
158 install: install_sw install_docs
160 uninstall: uninstall_docs uninstall_sw
163 rm -f $(PROGRAMS) $(TESTPROGS)
164 rm -f `find $(BLDDIR) -name '*$(DEP_EXT)'`
165 rm -f `find $(BLDDIR) -name '*$(OBJ_EXT)'`
166 rm -f $(BLDDIR)/core $(BLDDIR)/rehash.time
167 rm -f $(BLDDIR)/tags $(BLDDIR)/TAGS
168 rm -f $(BLDDIR)/openssl.pc $(BLDDIR)/libcrypto.pc $(BLDDIR)/libssl.pc
169 -rm -f `find $(BLDDIR) -type l`
172 DCLEAN_CMD=sed -e '/^DO NOT DELETE.*/,$$d'
174 $(DCLEAN_CMD) < Makefile >Makefile.new
175 mv -f Makefile.new Makefile
177 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
178 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
179 keys %{$unified_info{sources}}); -}
181 ( $(DCLEAN_CMD) < Makefile; \
182 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
184 cat `find . -name '*$(DEP_EXT)'` ) > Makefile.new
185 mv -f Makefile.new Makefile
187 # Install helper targets #############################################
189 install_sw: all install_dev install_engines install_runtime
191 uninstall_sw: uninstall_dev uninstall_engines uninstall_runtime
193 install_docs: install_man_docs install_html_docs
195 uninstall_docs: uninstall_man_docs uninstall_html_docs
198 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
199 @echo "*** Installing development files"
200 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl
201 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
202 $(BLDDIR)/include/openssl/*.h; do \
204 echo "install $$i -> $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn"; \
205 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn; \
206 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn; \
208 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)
209 @set -e; for l in $(LIBS); do \
211 echo "install $$l -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
212 cp $$l $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
213 $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
214 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
215 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
216 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
218 @ : {- output_off() if $config{no_shared}; "" -}
219 @set -e; for s in $(SHLIBS); do \
221 echo "install $$s -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
222 cp $$s $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
223 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
224 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
225 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
226 if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \
227 echo "link $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
228 fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \
229 ln -sf $$fn $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
232 @ : {- output_on() -}
233 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
234 @echo "install libcrypto.pc -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
235 @cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
236 @chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
237 @echo "install libssl.pc -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
238 @cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
239 @chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
240 @echo "install openssl.pc -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
241 @cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
242 @chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
245 @echo "*** Uninstalling development files"
246 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
247 $(BLDDIR)/include/openssl/*.h; do \
249 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn"; \
250 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn; \
252 @set -e; for l in $(LIBS); do \
254 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
255 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
257 @set -e; for s in $(SHLIBS); do \
259 if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \
260 fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \
261 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
262 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
264 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
265 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
267 @echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
268 @$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
269 @echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
270 @$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
271 @echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
272 @$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
275 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
276 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/
277 @echo "*** Installing engines"
278 @set -e; for e in $(ENGINES); do \
280 echo "install $$e -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
281 cp $$e $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
282 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
283 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new \
284 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
288 @echo "*** Uninstalling engines"
289 @set -e; for e in $(ENGINES); do \
291 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
292 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
296 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
297 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin
298 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(OPENSSLDIR)/misc
299 @echo "*** Installing runtime files"
300 @set -e; for x in $(PROGRAMS); do \
302 echo "install $$x -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
303 cp $$x $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
304 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
305 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new \
306 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
308 @set -e; for x in $(BIN_SCRIPTS); do \
310 echo "install $$x -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
311 cp $$x $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
312 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
313 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new \
314 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
316 @set -e; for x in $(MISC_SCRIPTS); do \
318 echo "install $$x -> $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn"; \
319 cp $$x $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn.new; \
320 chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn.new; \
321 mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn.new \
322 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn; \
324 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf"
325 @cp $(SRCDIR)/apps/openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new
326 @chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new
327 @mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
330 @echo "*** Uninstalling runtime files"
331 @set -e; for x in $(PROGRAMS); \
334 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
335 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
337 @set -e; for x in $(BIN_SCRIPTS); \
340 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
341 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
343 @set -e; for x in $(MISC_SCRIPTS); \
346 echo "$(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn"; \
347 $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn; \
349 $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
351 # A method to extract all names from a .pod file
352 # The first sed extracts everything between "=head1 NAME" and the next =head1
353 # The second sed joins all the lines into one
354 # The third sed removes the description and turns all commas into spaces
355 # Voilà , you have a space separated list of names!
356 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
357 sed -e ':a;{N;s/\n/ /;ba}' | \
358 sed -e 's/ - .*$$//;s/,/ /g'
361 here=`cd $(SRCDIR); pwd`; \
362 point=$$here/util/point.sh; \
363 for ds in apps:1 crypto:3 ssl:3; do \
364 defdir=`echo $$ds | cut -f1 -d:`; \
365 defsec=`echo $$ds | cut -f2 -d:`; \
366 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
367 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
368 [ -z "$$SEC" ] && SEC=$$defsec; \
369 fn=`basename $$p .pod`; \
370 NAME=`echo $$fn | tr [a-z] [A-Z]`; \
371 suf=`eval "echo $$OUTSUFFIX"`; \
372 top=`eval "echo $$OUTTOP"`; \
373 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
374 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
375 cat $$p | eval "$$GENERATE" \
376 > $$top/man$$SEC/$$fn$$suf; \
377 names=`cat $$p | $(EXTRACT_NAMES)`; \
378 ( cd $$top/man$$SEC; \
379 for n in $$names; do \
380 if [ "$$n" != "$$fn" ]; then \
381 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
382 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
389 here=`cd $(SRCDIR); pwd`; \
390 for ds in apps:1 crypto:3 ssl:3; do \
391 defdir=`echo $$ds | cut -f1 -d:`; \
392 defsec=`echo $$ds | cut -f2 -d:`; \
393 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
394 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
395 [ -z "$$SEC" ] && SEC=$$defsec; \
396 fn=`basename $$p .pod`; \
397 suf=`eval "echo $$OUTSUFFIX"`; \
398 top=`eval "echo $$OUTTOP"`; \
399 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
400 $(RM) $$top/man$$SEC/$$fn$$suf; \
401 names=`cat $$p | $(EXTRACT_NAMES)`; \
402 for n in $$names; do \
403 if [ "$$n" != "$$fn" ]; then \
404 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
405 $(RM) $$top/man$$SEC/$$n$$suf; \
412 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
413 @echo "*** Installing manpages"
415 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
416 OUTTOP="$(INSTALL_PREFIX)$(MANDIR)"; \
417 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
421 @echo "*** Uninstalling manpages"
423 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
424 OUTTOP="$(INSTALL_PREFIX)$(MANDIR)"; \
428 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
429 @echo "*** Installing HTML manpages"
431 OUTSUFFIX='.$(HTMLSUFFIX)'; \
432 OUTTOP="$(INSTALL_PREFIX)$(HTMLDIR)"; \
433 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
434 --podpath=apps:crypto:ssl \
435 | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \
439 @echo "*** Uninstalling manpages"
441 OUTSUFFIX='.$(HTMLSUFFIX)'; \
442 OUTTOP="$(INSTALL_PREFIX)$(HTMLDIR)"; \
446 # Developer targets (note: these are only available on Unix) #########
448 update: errors ordinals tags test_ordinals
450 # Test coverage is a good idea for the future
451 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
454 # Currently disabled, util/selftest.pl needs a rewrite
456 # SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl
459 lint -DLINT $(INCLUDES) $(SRCS)
462 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
463 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
464 ( cd $(SRCDIR)/engines; \
466 $(PERL) ../util/mkerr.pl -conf $$e \
467 -nostatic -staticloader -write *.c; \
469 ( cd $(SRCDIR)/crypto/ct; \
470 $(PERL) ../../util/mkerr.pl -conf ct.ec -hprefix internal/ -write *.c )
473 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
474 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
478 SRCTOP=../$(SRCDIR) \
479 BLDTOP=../$(BLDDIR) \
480 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
485 -etags `find . -name '*.[ch]' -o -name '*.pm'`
487 # Release targets (note: only available on Unix) #####################
490 TMPDIR=/var/tmp/openssl-copy.$$$$; \
491 DISTDIR=openssl-$(VERSION); \
492 mkdir -p $$TMPDIR/$$DISTDIR; \
494 git ls-tree -r --name-only --full-tree HEAD \
496 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
497 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
500 [ -n "$(PREPARE_CMD)" ] && $(PREPARE_CMD); \
501 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
502 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
503 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
504 $(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - $$DISTDIR) \
505 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
507 cd $(SRCDIR); ls -l $(TARFILE).gz
510 @$(MAKE) PREPARE_CMD='./Configure dist' tar
512 # Helper targets #####################################################
514 rehash: link-utils copy-certs
515 @if [ -z "$(CROSS_COMPILE)" ]; then \
516 (OPENSSL="$(BLDDIR)/util/shlib_wrap.sh apps/openssl"; \
517 [ -x "$(BLDDIR)/openssl.exe" ] && OPENSSL="$(BLDDIR)/openssl.exe" || :; \
518 OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \
519 export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \
520 $$OPENSSL rehash certs/demo \
521 || $(PERL) tools/c_rehash certs/demo) && \
525 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
527 $(BLDDIR)/util/opensslwrap.sh: Makefile
528 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
529 mkdir -p "$(BLDDIR)/util"; \
530 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
532 $(BLDDIR)/util/shlib_wrap.sh: Makefile
533 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
534 mkdir -p "$(BLDDIR)/util"; \
535 ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
539 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
540 cp -R "$(SRCDIR)/certs" "$(BLDDIR)/"; \
545 # Building targets ###################################################
547 libcrypto.pc libssl.pc openssl.pc: Makefile $(LIBS)
549 @ ( echo 'prefix=$(INSTALLTOP)'; \
550 echo 'exec_prefix=$${prefix}'; \
551 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
552 echo 'includedir=$${prefix}/include'; \
554 echo 'Name: OpenSSL-libcrypto'; \
555 echo 'Description: OpenSSL cryptography library'; \
556 echo 'Version: '$(VERSION); \
557 echo 'Libs: -L$${libdir} -lcrypto'; \
558 echo 'Libs.private: $(EX_LIBS)'; \
559 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
562 @ ( echo 'prefix=$(INSTALLTOP)'; \
563 echo 'exec_prefix=$${prefix}'; \
564 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
565 echo 'includedir=$${prefix}/include'; \
567 echo 'Name: OpenSSL-libssl'; \
568 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
569 echo 'Version: '$(VERSION); \
570 echo 'Requires.private: libcrypto'; \
571 echo 'Libs: -L$${libdir} -lssl'; \
572 echo 'Libs.private: $(EX_LIBS)'; \
573 echo 'Cflags: -I$${includedir}' ) > libssl.pc
576 @ ( echo 'prefix=$(INSTALLTOP)'; \
577 echo 'exec_prefix=$${prefix}'; \
578 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
579 echo 'includedir=$${prefix}/include'; \
581 echo 'Name: OpenSSL'; \
582 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
583 echo 'Version: '$(VERSION); \
584 echo 'Requires: libssl libcrypto' ) > openssl.pc
586 # Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which
587 # wasn't passed down automatically. It's quite safe to use it like we do
588 # below; if it doesn't exist, the result will be empty and 'make' will pick
589 # up $(MAKEFLAGS) which is passed down as an environment variable.
590 Makefile: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/config
591 @echo "Makefile is older than {- $config{build_file_template} -}, $(SRCDIR)/Configure or $(SRCDIR)/config."
592 @echo "Reconfiguring..."
593 $(SRCDIR)/Configure reconf
594 @echo "**************************************************"
596 @echo "*** Please run the same make command again ***"
598 @echo "**************************************************"
603 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
606 my $dep = $args{obj}.'$(DEP_EXT)';
607 my $obj = $args{obj}.'$(OBJ_EXT)';
608 my $srcs = join(" ", @{$args{srcs}});
609 my $incs = join(" ", map { " -I".$_ } @{$args{incs}});
610 my $makedepprog = $config{makedepprog};
611 if ($makedepprog eq "makedepend") {
614 rm -f \$\@.tmp; touch \$\@.tmp
615 \$(MAKEDEPEND) -f\$\@.tmp -o"|$obj"\
616 -- -DOPENSSL_DOING_MAKEDEPEND \$(DEPFLAGS)$incs \
618 sed -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$/d' -e '/^\\(#.*\\| *\\)\$/d' \$\@.tmp > \$\@
623 $dep : $srcs Makefile
624 \$(CC) -DOPENSSL_DOING_MAKEDEPEND \$(DEPFLAGS)$incs -MM -MF \$\@ -MQ $obj $srcs
629 my $obj = $args{obj}.'$(OBJ_EXT)';
630 my $srcs = join(" ", @{$args{srcs}});
631 my $deps = join(" ", @{$args{srcs}}, @{$args{deps}});
632 my $incs = join(" ", map { " -I".$_ } @{$args{incs}});
635 \$(CC) \$(CFLAGS)$incs -c -o \$\@ $srcs
638 # On Unix, we build shlibs from static libs, so we're ignoring the
639 # object file array. We *know* this routine is only called when we've
640 # configure 'shared'.
643 my $lib = $args{lib};
644 my $shlib = $args{shlib};
645 my $libd = dirname($lib);
646 my $libn = basename($lib);
647 (my $libname = $libn) =~ s/^lib//;
648 my $shlibdeps = join("", map { my $d = dirname($_);
649 my $f = basename($_);
650 (my $l = $f) =~ s/^lib//;
651 " -L$d -l$l" } @{$args{deps}});
652 my $deps = join(" ",map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$args{deps}});
653 my $shlib_target = $target{shared_target};
654 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
656 "$shlib".shlib_ext() .
657 (shlib_ext() ne shlib_ext_simple()
658 ? " $shlib".shlib_ext_simple() : "");
660 $targets : $lib\$(LIB_EXT) $deps $ordinalsfile
661 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
662 PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
663 INSTALLTOP="\$(INSTALLTOP)" LIBDIR="\$(LIBDIR)" \\
664 LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\
665 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
666 LIBCOMPATVERSIONS=";\$(SHLIB_VERSION_HISTORY)" \\
667 CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
668 SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=\$(SHLIB_EXT) \\
674 my $lib = $args{lib};
675 my $libd = dirname($lib);
676 my $libn = basename($lib);
677 (my $libname = $libn) =~ s/^lib//;
678 my $shlibdeps = join("", map { my $d = dirname($_);
679 my $f = basename($_);
680 (my $l = $f) =~ s/^lib//;
681 " -L$d -l$l" } @{$args{deps}});
682 my $deps = join(" ",map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$args{deps}});
683 my $shlib_target = $target{shared_target};
684 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
686 $lib\$(SHLIB_EXT_SIMPLE): $objs $deps
687 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
688 PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
689 LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\
690 LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\
691 CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\
692 SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\
693 SHLIB_EXT=\$(SHLIB_EXT_SIMPLE) \\
700 my $lib = $args{lib};
701 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
703 $lib\$(LIB_EXT) : $objs
705 \$(RANLIB) \$\@ || echo Never mind.
710 my $bin = $args{bin};
711 my $bind = dirname($bin);
712 my $binn = basename($bin);
713 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
715 (map { $_."\$(OBJ_EXT)" } @{$args{objs}}),
716 (map { $_.($config{no_shared} ? "\$(LIB_EXT)" : "\$(SHLIB_EXT)" ) }
718 my $libdeps = join("", map { my $d = dirname($_);
719 my $f = basename($_);
720 $d = "." if $d eq $f;
721 (my $l = $f) =~ s/^lib//;
722 " -L$d -l$l" } @{$args{deps}});
723 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
725 $bin\$(EXE_EXT) : $deps
726 \$(RM) $bin\$(EXE_EXT)
727 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
728 PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
729 APPNAME=$bin OBJECTS="$objs" \\
730 LIBDEPS="\$(PLIB_LDFLAGS) \$(LDFLAGS) $libdeps \$(EX_LIBS)" \\
731 CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
732 LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
733 link_app.$shlib_target
738 my $script = $args{script};
739 my $sources = join(" ", @{$args{sources}});
740 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
741 "util", "dofile.pl")),
742 rel2abs($config{builddir}));
745 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" $sources > "$script"
749 "" # Important! This becomes part of the template result.