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; \
231 : {- output_off() unless windowsdll(); "" -}; \
232 echo "install $$s.a -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \
233 cp $$s.a $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \
234 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \
235 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new \
236 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \
237 : {- output_on() -}; \
239 @ : {- output_on() -}
240 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
241 @echo "install libcrypto.pc -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
242 @cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
243 @chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
244 @echo "install libssl.pc -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
245 @cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
246 @chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
247 @echo "install openssl.pc -> $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
248 @cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
249 @chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
252 @echo "*** Uninstalling development files"
253 @set -e; for i in $(SRCDIR)/include/openssl/*.h \
254 $(BLDDIR)/include/openssl/*.h; do \
256 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn"; \
257 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$fn; \
259 @set -e; for l in $(LIBS); do \
261 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
262 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
264 @set -e; for s in $(SHLIBS); do \
266 if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \
267 fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \
268 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
269 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
271 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
272 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
273 : {- output_off() unless windowsdll(); "" -}; \
274 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \
275 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \
276 : {- output_on() -}; \
278 @echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
279 @$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
280 @echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
281 @$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
282 @echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
283 @$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
286 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
287 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/
288 @echo "*** Installing engines"
289 @set -e; for e in $(ENGINES); do \
291 echo "install $$e -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
292 cp $$e $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
293 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \
294 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new \
295 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
299 @echo "*** Uninstalling engines"
300 @set -e; for e in $(ENGINES); do \
302 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
303 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
307 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
308 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin
309 @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(INSTALL_PREFIX)$(OPENSSLDIR)/misc
310 @echo "*** Installing runtime files"
311 : {- output_off() unless windowsdll(); "" -};
312 @set -e; for s in $(SHLIBS); do \
314 echo "install $$s -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
315 cp $$s $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
316 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
317 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new \
318 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
321 @set -e; for x in $(PROGRAMS); do \
323 echo "install $$x -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
324 cp $$x $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
325 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
326 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new \
327 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
329 @set -e; for x in $(BIN_SCRIPTS); do \
331 echo "install $$x -> $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
332 cp $$x $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
333 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new; \
334 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn.new \
335 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
337 @set -e; for x in $(MISC_SCRIPTS); do \
339 echo "install $$x -> $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn"; \
340 cp $$x $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn.new; \
341 chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn.new; \
342 mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn.new \
343 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn; \
345 @echo "install $(SRCDIR)/apps/openssl.cnf -> $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf"
346 @cp $(SRCDIR)/apps/openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new
347 @chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new
348 @mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
351 @echo "*** Uninstalling runtime files"
352 @set -e; for x in $(PROGRAMS); \
355 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
356 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
358 @set -e; for x in $(BIN_SCRIPTS); \
361 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
362 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
364 @set -e; for x in $(MISC_SCRIPTS); \
367 echo "$(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn"; \
368 $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$fn; \
370 : {- output_off() unless windowsdll(); "" -};
371 @set -e; for s in $(SHLIBS); do \
373 echo "$(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn"; \
374 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$fn; \
377 $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
379 # A method to extract all names from a .pod file
380 # The first sed extracts everything between "=head1 NAME" and the next =head1
381 # The second sed joins all the lines into one
382 # The third sed removes the description and turns all commas into spaces
383 # Voilà , you have a space separated list of names!
384 EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \
385 sed -e ':a;{N;s/\n/ /;ba}' | \
386 sed -e 's/ - .*$$//;s/,/ /g'
389 here=`cd $(SRCDIR); pwd`; \
390 point=$$here/util/point.sh; \
391 for ds in apps:1 crypto:3 ssl:3; do \
392 defdir=`echo $$ds | cut -f1 -d:`; \
393 defsec=`echo $$ds | cut -f2 -d:`; \
394 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
395 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
396 [ -z "$$SEC" ] && SEC=$$defsec; \
397 fn=`basename $$p .pod`; \
398 NAME=`echo $$fn | tr [a-z] [A-Z]`; \
399 suf=`eval "echo $$OUTSUFFIX"`; \
400 top=`eval "echo $$OUTTOP"`; \
401 $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
402 echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
403 cat $$p | eval "$$GENERATE" \
404 > $$top/man$$SEC/$$fn$$suf; \
405 names=`cat $$p | $(EXTRACT_NAMES)`; \
406 ( cd $$top/man$$SEC; \
407 for n in $$names; do \
408 if [ "$$n" != "$$fn" ]; then \
409 echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
410 PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
417 here=`cd $(SRCDIR); pwd`; \
418 for ds in apps:1 crypto:3 ssl:3; do \
419 defdir=`echo $$ds | cut -f1 -d:`; \
420 defsec=`echo $$ds | cut -f2 -d:`; \
421 for p in $(SRCDIR)/doc/$$defdir/*.pod; do \
422 SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \
423 [ -z "$$SEC" ] && SEC=$$defsec; \
424 fn=`basename $$p .pod`; \
425 suf=`eval "echo $$OUTSUFFIX"`; \
426 top=`eval "echo $$OUTTOP"`; \
427 echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
428 $(RM) $$top/man$$SEC/$$fn$$suf; \
429 names=`cat $$p | $(EXTRACT_NAMES)`; \
430 for n in $$names; do \
431 if [ "$$n" != "$$fn" ]; then \
432 echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
433 $(RM) $$top/man$$SEC/$$n$$suf; \
440 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
441 @echo "*** Installing manpages"
443 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
444 OUTTOP="$(INSTALL_PREFIX)$(MANDIR)"; \
445 GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
449 @echo "*** Uninstalling manpages"
451 OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
452 OUTTOP="$(INSTALL_PREFIX)$(MANDIR)"; \
456 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
457 @echo "*** Installing HTML manpages"
459 OUTSUFFIX='.$(HTMLSUFFIX)'; \
460 OUTTOP="$(INSTALL_PREFIX)$(HTMLDIR)"; \
461 GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
462 --podpath=apps:crypto:ssl \
463 | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \
467 @echo "*** Uninstalling manpages"
469 OUTSUFFIX='.$(HTMLSUFFIX)'; \
470 OUTTOP="$(INSTALL_PREFIX)$(HTMLDIR)"; \
474 # Developer targets (note: these are only available on Unix) #########
476 update: errors ordinals tags test_ordinals
478 # Test coverage is a good idea for the future
479 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
482 # Currently disabled, util/selftest.pl needs a rewrite
484 # SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl
487 lint -DLINT $(INCLUDES) $(SRCS)
490 ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
491 ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
492 ( cd $(SRCDIR)/engines; \
494 $(PERL) ../util/mkerr.pl -conf $$e \
495 -nostatic -staticloader -write *.c; \
497 ( cd $(SRCDIR)/crypto/ct; \
498 $(PERL) ../../util/mkerr.pl -conf ct.ec -hprefix internal/ -write *.c )
501 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
502 ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
506 SRCTOP=../$(SRCDIR) \
507 BLDTOP=../$(BLDDIR) \
508 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
513 -etags `find . -name '*.[ch]' -o -name '*.pm'`
515 # Release targets (note: only available on Unix) #####################
518 TMPDIR=/var/tmp/openssl-copy.$$$$; \
519 DISTDIR=openssl-$(VERSION); \
520 mkdir -p $$TMPDIR/$$DISTDIR; \
522 git ls-tree -r --name-only --full-tree HEAD \
524 mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
525 cp $$F $$TMPDIR/$$DISTDIR/$$F; \
528 [ -n "$(PREPARE_CMD)" ] && $(PREPARE_CMD); \
529 find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
530 find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
531 find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
532 $(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - $$DISTDIR) \
533 | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
535 cd $(SRCDIR); ls -l $(TARFILE).gz
538 @$(MAKE) PREPARE_CMD='./Configure dist' tar
540 # Helper targets #####################################################
542 rehash: link-utils copy-certs
543 @if [ -z "$(CROSS_COMPILE)" ]; then \
544 (OPENSSL="$(BLDDIR)/util/shlib_wrap.sh apps/openssl"; \
545 [ -x "$(BLDDIR)/openssl.exe" ] && OPENSSL="$(BLDDIR)/openssl.exe" || :; \
546 OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \
547 export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \
548 $$OPENSSL rehash certs/demo \
549 || $(PERL) tools/c_rehash certs/demo) && \
553 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
555 $(BLDDIR)/util/opensslwrap.sh: Makefile
556 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
557 mkdir -p "$(BLDDIR)/util"; \
558 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
560 $(BLDDIR)/util/shlib_wrap.sh: Makefile
561 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
562 mkdir -p "$(BLDDIR)/util"; \
563 ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
567 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
568 cp -R "$(SRCDIR)/certs" "$(BLDDIR)/"; \
573 # Building targets ###################################################
575 libcrypto.pc libssl.pc openssl.pc: Makefile $(LIBS)
577 @ ( echo 'prefix=$(INSTALLTOP)'; \
578 echo 'exec_prefix=$${prefix}'; \
579 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
580 echo 'includedir=$${prefix}/include'; \
582 echo 'Name: OpenSSL-libcrypto'; \
583 echo 'Description: OpenSSL cryptography library'; \
584 echo 'Version: '$(VERSION); \
585 echo 'Libs: -L$${libdir} -lcrypto'; \
586 echo 'Libs.private: $(EX_LIBS)'; \
587 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
590 @ ( echo 'prefix=$(INSTALLTOP)'; \
591 echo 'exec_prefix=$${prefix}'; \
592 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
593 echo 'includedir=$${prefix}/include'; \
595 echo 'Name: OpenSSL-libssl'; \
596 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
597 echo 'Version: '$(VERSION); \
598 echo 'Requires.private: libcrypto'; \
599 echo 'Libs: -L$${libdir} -lssl'; \
600 echo 'Libs.private: $(EX_LIBS)'; \
601 echo 'Cflags: -I$${includedir}' ) > libssl.pc
604 @ ( echo 'prefix=$(INSTALLTOP)'; \
605 echo 'exec_prefix=$${prefix}'; \
606 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
607 echo 'includedir=$${prefix}/include'; \
609 echo 'Name: OpenSSL'; \
610 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
611 echo 'Version: '$(VERSION); \
612 echo 'Requires: libssl libcrypto' ) > openssl.pc
614 # Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which
615 # wasn't passed down automatically. It's quite safe to use it like we do
616 # below; if it doesn't exist, the result will be empty and 'make' will pick
617 # up $(MAKEFLAGS) which is passed down as an environment variable.
618 Makefile: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/config
619 @echo "Makefile is older than {- $config{build_file_template} -}, $(SRCDIR)/Configure or $(SRCDIR)/config."
620 @echo "Reconfiguring..."
621 $(SRCDIR)/Configure reconf
622 @echo "**************************************************"
624 @echo "*** Please run the same make command again ***"
626 @echo "**************************************************"
631 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
634 my $dep = $args{obj}.'$(DEP_EXT)';
635 my $obj = $args{obj}.'$(OBJ_EXT)';
636 my $srcs = join(" ", @{$args{srcs}});
637 my $incs = join(" ", map { " -I".$_ } @{$args{incs}});
638 my $makedepprog = $config{makedepprog};
639 if ($makedepprog eq "makedepend") {
642 rm -f \$\@.tmp; touch \$\@.tmp
643 \$(MAKEDEPEND) -f\$\@.tmp -o"|$obj"\
644 -- -DOPENSSL_DOING_MAKEDEPEND \$(DEPFLAGS)$incs \
646 sed -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$/d' -e '/^\\(#.*\\| *\\)\$/d' \$\@.tmp > \$\@
651 $dep : $srcs Makefile
652 \$(CC) -DOPENSSL_DOING_MAKEDEPEND \$(DEPFLAGS)$incs -MM -MF \$\@ -MQ $obj $srcs
657 my $obj = $args{obj}.'$(OBJ_EXT)';
658 my $srcs = join(" ", @{$args{srcs}});
659 my $deps = join(" ", @{$args{srcs}}, @{$args{deps}});
660 my $incs = join(" ", map { " -I".$_ } @{$args{incs}});
663 \$(CC) \$(CFLAGS)$incs -c -o \$\@ $srcs
666 # On Unix, we build shlibs from static libs, so we're ignoring the
667 # object file array. We *know* this routine is only called when we've
668 # configure 'shared'.
671 my $lib = $args{lib};
672 my $shlib = $args{shlib};
673 my $libd = dirname($lib);
674 my $libn = basename($lib);
675 (my $libname = $libn) =~ s/^lib//;
676 my $shlibdeps = join("", map { my $d = dirname($_);
677 my $f = basename($_);
678 (my $l = $f) =~ s/^lib//;
679 " -L$d -l$l" } @{$args{deps}});
680 my $deps = join(" ",map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$args{deps}});
681 my $shlib_target = $target{shared_target};
682 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
684 "$shlib".shlib_ext() .
685 (shlib_ext() ne shlib_ext_simple()
686 ? " $shlib".shlib_ext_simple() : "");
688 $targets : $lib\$(LIB_EXT) $deps $ordinalsfile
689 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
690 PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
691 INSTALLTOP="\$(INSTALLTOP)" LIBDIR="\$(LIBDIR)" \\
692 LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\
693 LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
694 LIBCOMPATVERSIONS=";\$(SHLIB_VERSION_HISTORY)" \\
695 CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
696 SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=\$(SHLIB_EXT) \\
699 . (windowsdll() ? <<"EOF" : "");
700 rm -f apps/$shlib\$(SHLIB_EXT)
701 rm -f test/$shlib\$(SHLIB_EXT)
702 cp -p $shlib\$(SHLIB_EXT) apps/
703 cp -p $shlib\$(SHLIB_EXT) test/
708 my $lib = $args{lib};
709 my $libd = dirname($lib);
710 my $libn = basename($lib);
711 (my $libname = $libn) =~ s/^lib//;
712 my $shlibdeps = join("", map { my $d = dirname($_);
713 my $f = basename($_);
714 (my $l = $f) =~ s/^lib//;
715 " -L$d -l$l" } @{$args{deps}});
716 my $deps = join(" ",map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$args{deps}});
717 my $shlib_target = $target{shared_target};
718 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
720 $lib\$(SHLIB_EXT_SIMPLE): $objs $deps
721 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
722 PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
723 LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\
724 LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\
725 CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\
726 SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\
727 SHLIB_EXT=\$(SHLIB_EXT_SIMPLE) \\
734 my $lib = $args{lib};
735 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
737 $lib\$(LIB_EXT) : $objs
739 \$(RANLIB) \$\@ || echo Never mind.
744 my $bin = $args{bin};
745 my $bind = dirname($bin);
746 my $binn = basename($bin);
747 my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
749 (map { $_."\$(OBJ_EXT)" } @{$args{objs}}),
750 (map { $_.($config{no_shared} ? "\$(LIB_EXT)" : "\$(SHLIB_EXT)" ) }
752 my $libdeps = join("", map { my $d = dirname($_);
753 my $f = basename($_);
754 $d = "." if $d eq $f;
755 (my $l = $f) =~ s/^lib//;
756 " -L$d -l$l" } @{$args{deps}});
757 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
759 $bin\$(EXE_EXT) : $deps
760 \$(RM) $bin\$(EXE_EXT)
761 \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
762 PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
763 APPNAME=$bin OBJECTS="$objs" \\
764 LIBDEPS="\$(PLIB_LDFLAGS) \$(LDFLAGS) $libdeps \$(EX_LIBS)" \\
765 CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
766 LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
767 link_app.$shlib_target
772 my $script = $args{script};
773 my $sources = join(" ", @{$args{sources}});
774 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
775 "util", "dofile.pl")),
776 rel2abs($config{builddir}));
779 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" $sources > "$script"
783 "" # Important! This becomes part of the template result.