]> git.ipfire.org Git - thirdparty/openssl.git/blob - Makefile.in
Let Configure figure out the diverse shared library and DSO extensions
[thirdparty/openssl.git] / Makefile.in
1 ##
2 ## Makefile for OpenSSL
3 ##
4 ## {- join("\n## ", @autowarntext) -}
5
6 VERSION={- $config{version} -}
7 MAJOR={- $config{major} -}
8 MINOR={- $config{minor} -}
9 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
10 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
11 SHLIB_MAJOR={- $config{shlib_major} -}
12 SHLIB_MINOR={- $config{shlib_minor} -}
13 SHLIB_EXT={- $target{shared_extension} || ".so" -}
14 SHLIB_EXT_SIMPLE={- $target{shared_extension_simple} || ".so" -}
15 SHLIB_EXT_IMPORT={- $target{shared_import_extension} || "" -}
16 DSO_EXT={- $target{dso_extension} || ".so" -}
17 PLATFORM={- $config{target} -}
18 OPTIONS={- $config{options} -}
19 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
20 SHLIB_TARGET={- $target{shared_target} -}
21
22 # HERE indicates where this Makefile lives. This can be used to indicate
23 # where sub-Makefiles are expected to be. Currently has very limited usage,
24 # and should probably not be bothered with at all.
25 HERE=.
26
27 # DESTDIR is for package builders so that they can configure
28 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
29 # Normally it is left empty.
30 DESTDIR=
31
32 # Do not edit these manually. Use Configure with --prefix or --openssldir
33 # to change this! Short explanation in the top comment in Configure
34 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
35 #
36 our $prefix = $config{prefix} || "/usr/local";
37 $prefix -}
38 OPENSSLDIR={- #
39 # The logic here is that if no --openssldir was given,
40 # OPENSSLDIR will get the value from $prefix plus "/ssl".
41 # If --openssldir was given and the value is an absolute
42 # path, OPENSSLDIR will get its value without change.
43 # If the value from --openssldir is a relative path,
44 # OPENSSLDIR will get $prefix with the --openssldir
45 # value appended as a subdirectory.
46 #
47 use File::Spec::Functions;
48 our $openssldir =
49 $config{openssldir} ?
50 (file_name_is_absolute($config{openssldir}) ?
51 $config{openssldir}
52 : catdir($prefix, $config{openssldir}))
53 : catdir($prefix, "ssl");
54 $openssldir -}
55 LIBDIR={- #
56 # if $prefix/lib$target{multilib} is not an existing
57 # directory, then assume that it's not searched by linker
58 # automatically, in which case adding $target{multilib} suffix
59 # causes more grief than we're ready to tolerate, so don't...
60 our $multilib =
61 -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
62 our $libdir = $config{libdir} || "lib$multilib";
63 $libdir -}
64 ENGINESDIR={- use File::Spec::Functions;
65 catdir($prefix,$libdir,"engines") -}
66
67 # NO_IDEA - Define to build without the IDEA algorithm
68 # NO_RC4 - Define to build without the RC4 algorithm
69 # NO_RC2 - Define to build without the RC2 algorithm
70 # THREADS - Define when building with threads, you will probably also need any
71 # system defines as well, i.e. _REENTRANT for Solaris 2.[34]
72 # TERMIO - Define the termio terminal subsystem, needed if sgtty is missing.
73 # TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
74 # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
75 # DEVRANDOM - Give this the value of the 'random device' if your OS supports
76 # one. 32 bytes will be read from this when the random
77 # number generator is initalised.
78 # SSL_FORBID_ENULL - define if you want the server to be not able to use the
79 # NULL encryption ciphers.
80 #
81 # LOCK_DEBUG - turns on lots of lock debug output :-)
82 # REF_DEBUG - turn on some xyz_free() assertions.
83 # REF_PRINT - prints some stuff on structure free.
84 # MFUNC - Make all Malloc/Free/Realloc calls call
85 # CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
86 # call application defined callbacks via CRYPTO_set_mem_functions()
87 # MD5_ASM needs to be defined to use the x86 assembler for MD5
88 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1
89 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
90 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8. It must
91 # equal 4.
92 # PKCS1_CHECK - pkcs1 tests.
93
94 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
95 CC= $(CROSS_COMPILE){- $target{cc} -}
96 CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
97 CFLAG_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
98 LDFLAG= {- $config{lflags} -}
99 PLIB_LDFLAG= {- $config{plib_lflags} -}
100 EX_LIBS= {- $config{ex_libs} -}
101 EXE_EXT= {- $target{exe_extension} -}
102 ARFLAGS= {- $target{arflags} -}
103 AR=$(CROSS_COMPILE){- $target{ar} -} $(ARFLAGS) r
104 RANLIB= {- $target{ranlib} -}
105 NM= $(CROSS_COMPILE){- $target{nm} -}
106 PERL= {- $config{perl} -}
107 #RM= echo --
108 RM= rm -f
109 TAR= tar
110 TARFLAGS= --no-recursion
111 MAKEDEPPROG=$(CROSS_COMPILE){- $config{makedepprog} -}
112
113 # We let the C compiler driver to take care of .s files. This is done in
114 # order to be excused from maintaining a separate set of architecture
115 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
116 # gcc, then the driver will automatically translate it to -xarch=v8plus
117 # and pass it down to assembler.
118 AS=$(CC) -c
119 ASFLAG=$(CFLAG)
120
121 # For x86 assembler: Set PROCESSOR to 386 if you want to support
122 # the 80386.
123 PROCESSOR= {- $config{processor} -}
124
125 # CPUID module collects small commonly used assembler snippets
126 APPS_OBJ={- $target{apps_obj} -}
127 CPUID_OBJ= {- $target{cpuid_obj} -}
128 BN_ASM= {- $target{bn_obj} -}
129 EC_ASM= {- $target{ec_obj} -}
130 DES_ENC= {- $target{des_obj} -}
131 AES_ENC= {- $target{aes_obj} -}
132 BF_ENC= {- $target{bf_obj} -}
133 CAST_ENC= {- $target{cast_obj} -}
134 RC4_ENC= {- $target{rc4_obj} -}
135 RC5_ENC= {- $target{rc5_obj} -}
136 MD5_ASM_OBJ= {- $target{md5_obj} -}
137 SHA1_ASM_OBJ= {- $target{sha1_obj} -}
138 RMD160_ASM_OBJ= {- $target{rmd160_obj} -}
139 WP_ASM_OBJ= {- $target{wp_obj} -}
140 CMLL_ENC= {- $target{cmll_obj} -}
141 MODES_ASM_OBJ= {- $target{modes_obj} -}
142 PADLOCK_ASM_OBJ= {- $target{padlock_obj} -}
143 CHACHA_ENC= {- $target{chacha_obj} -}
144 POLY1305_ASM_OBJ= {- $target{poly1305_obj} -}
145 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
146
147 # Zlib stuff
148 ZLIB_INCLUDE={- $withargs{zlib_include} -}
149 LIBZLIB={- $withargs{zlib_lib} -}
150
151 # This is the location of fipscanister.o and friends.
152 # The FIPS module build will place it $(INSTALLTOP)/lib
153 # but since $(INSTALLTOP) can only take the default value
154 # when the module is built it will be in /usr/local/ssl/lib
155 # $(INSTALLTOP) for this build may be different so hard
156 # code the path.
157
158 FIPSLIBDIR={- $config{fipslibdir} -}
159
160 # The location of the library which contains fipscanister.o
161 # normally it will be libcrypto. If not compiling in FIPS mode
162 # at all this is empty making it a useful test for a FIPS compile.
163
164 FIPSCANLIB={- $config{fips} ? "libcrypto" : "" -}
165
166 # Shared library base address. Currently only used on Windows.
167 #
168
169 BASEADDR={- $config{baseaddr} -}
170
171 DIRS= {- join(" ", @{$config{dirs}}) -}
172 SHLIBDIRS= crypto ssl
173 INSTALL_SUBS= engines apps tools
174
175 # dirs in crypto to build
176 SDIRS= {- join(" ", @{$config{sdirs}}) -}
177
178 # tests to perform. "alltests" is a special word indicating that all tests
179 # should be performed.
180 TESTS = alltests
181
182 MAKEFILE= Makefile
183
184 MANDIR=$(INSTALLTOP)/share/man
185 MAN1=1
186 MAN3=3
187 MANSUFFIX=
188 HTMLSUFFIX=html
189 HTMLDIR=$(INSTALLTOP)/share/doc/$(BASENAME)/html
190 SHELL=/bin/sh
191
192 TOP= .
193 LIBS= libcrypto.a libssl.a
194 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
195 SHARED_SSL=libssl$(SHLIB_EXT)
196 SHARED_LIBS={- '$(SHARED_CRYPTO) $(SHARED_SSL)' if (!$config{no_shared}) -}
197 SHARED_LDFLAG={- $target{shared_ldflag}
198 # Unlike other OSes (like Solaris, Linux, Tru64,
199 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
200 # and FreeBSD) "demand" RPATH set on .so objects.
201 # Apparently application RPATH is not global and
202 # does not apply to .so linked with other .so.
203 # Problem manifests itself when libssl.so fails to
204 # load libcrypto.so. One can argue that we should
205 # engrave this into Makefile.shared rules or into
206 # BSD-* config lines above. Meanwhile let's try to
207 # be cautious and pass -rpath to linker only when
208 # $prefix is not /usr.
209 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
210 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
211 SHARED_RCFLAG={- $target{shared_rcflag} -}
212
213 GENERAL= Makefile
214 BASENAME= openssl
215 NAME= $(BASENAME)-$(VERSION)
216 TARFILE= ../$(NAME).tar
217 HEADER= e_os.h
218
219 # Directories created on install if they don't exist.
220 INSTALLDIRS= \
221 $(DESTDIR)$(INSTALLTOP)/bin \
222 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) \
223 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines \
224 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
225 $(DESTDIR)$(INSTALLTOP)/include/openssl \
226 $(DESTDIR)$(OPENSSLDIR)/misc \
227 $(DESTDIR)$(OPENSSLDIR)/certs \
228 $(DESTDIR)$(OPENSSLDIR)/private
229
230 all: Makefile build_all_but_tests
231
232 # as we stick to -e, CLEARENV ensures that local variables in lower
233 # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
234 # shell, which [annoyingly enough] terminates unset with error if VAR
235 # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
236 # which terminates unset with error if no variable was present:-(
237 CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
238 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES} \
239 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC} \
240 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
241 $${HEADER+HEADER} \
242 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
243 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
244 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
245 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
246 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
247
248 # LC_ALL=C ensures that error [and other] messages are delivered in
249 # same language for uniform treatment.
250 BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
251 CC='$(CC)' CFLAG='$(CFLAG)' CFLAG_Q='$(CFLAG_Q)' \
252 AS='$(CC)' ASFLAG='$(CFLAG) -c' \
253 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
254 CROSS_COMPILE='$(CROSS_COMPILE)' \
255 PERL='$(PERL)' \
256 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)' \
257 DESTDIR='$(DESTDIR)' \
258 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \
259 LIBDIR='$(LIBDIR)' \
260 SHARED_LDFLAG='$(SHARED_LDFLAG)' \
261 SHARED_RCFLAG='$(SHARED_RCFLAG)' \
262 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \
263 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
264 SHLIB_EXT='$(SHLIB_EXT)' DSO_EXT='$(DSO_EXT)' \
265 SHLIB_TARGET='$(SHLIB_TARGET)' \
266 LDFLAG='$(LDFLAG)' \
267 PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)' \
268 APPS_OBJ='$(APPS_OBJ)' \
269 CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
270 EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
271 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
272 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
273 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
274 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)' \
275 MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
276 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
277 WP_ASM_OBJ='$(WP_ASM_OBJ)' \
278 MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
279 PADLOCK_ASM_OBJ='$(PADLOCK_ASM_OBJ)' \
280 CHACHA_ENC='$(CHACHA_ENC)' \
281 POLY1305_ASM_OBJ='$(POLY1305_ASM_OBJ)' \
282 PERLASM_SCHEME='$(PERLASM_SCHEME)' \
283 FIPSLIBDIR='${FIPSLIBDIR}' \
284 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
285 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
286 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
287 # which in turn eliminates ambiguities in variable treatment with -e.
288
289 # BUILD_CMD is a generic macro to build a given target in a given
290 # subdirectory. The target must be given through the shell variable
291 # `target' and the subdirectory to build in must be given through `dir'.
292 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
293 # BUILD_ONE_CMD instead.
294 #
295 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
296 # subdirectories defined in $(DIRS). It requires that the target
297 # is given through the shell variable `target'.
298 #
299 # BUILD_ONE_CMD is a macro to build a given target in a given
300 # subdirectory if that subdirectory is part of $(DIRS). It requires
301 # exactly the same shell variables as BUILD_CMD.
302 BUILD_CMD= if [ -d "$$dir" ]; then \
303 ( cd $$dir && echo "making $$target in $$dir..." && \
304 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
305 ) || exit 1; \
306 fi
307 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
308 BUILD_ONE_CMD=\
309 if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
310 $(BUILD_CMD); \
311 fi
312
313 reflect:
314 @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
315
316 sub_all: build_all
317
318 build_all_but_tests: build_libs build_apps build_tools
319 build_all: build_all_but_tests build_tests
320
321 build_libs: build_libcrypto build_libssl openssl.pc
322
323 build_libcrypto: build_crypto build_engines libcrypto.pc
324 build_libssl: build_ssl libssl.pc
325
326 build_crypto:
327 @dir=crypto; target=all; $(BUILD_ONE_CMD)
328 build_ssl: build_crypto
329 @dir=ssl; target=all; $(BUILD_ONE_CMD)
330 build_engines: build_crypto
331 @dir=engines; target=all; AS='$(CC) -c'; export AS; $(BUILD_ONE_CMD)
332
333 build_apps: build_libs
334 @dir=apps; target=all; $(BUILD_ONE_CMD)
335 build_tests: build_libs
336 @dir=test; target=all; $(BUILD_ONE_CMD)
337 build_tools: build_libs
338 @dir=tools; target=all; $(BUILD_ONE_CMD)
339
340 all_testapps: build_libs build_testapps
341 build_testapps:
342 @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
343
344 libcrypto$(SHLIB_EXT): libcrypto.a
345 @if [ "$(SHLIB_TARGET)" != "" ]; then \
346 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
347 FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
348 export CC FIPSLD_CC; \
349 fi; \
350 $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared; \
351 else \
352 echo "There's no support for shared libraries on this platform" >&2; \
353 exit 1; \
354 fi
355
356 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
357 @if [ "$(SHLIB_TARGET)" != "" ]; then \
358 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
359 else \
360 echo "There's no support for shared libraries on this platform" >&2; \
361 exit 1; \
362 fi
363
364 link-shared:
365 @ set -e; for i in $(SHLIBDIRS); do \
366 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
367 LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
368 LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
369 symlink.$(SHLIB_TARGET); \
370 libs="$$libs -l$$i"; \
371 done
372
373 build-shared: do_$(SHLIB_TARGET) link-shared
374
375 do_$(SHLIB_TARGET):
376 @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
377 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
378 LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
379 LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
380 LIBDEPS="$$libs $(EX_LIBS)" \
381 link_a.$(SHLIB_TARGET); \
382 libs="-l$$i $$libs"; \
383 case "$(PLATFORM)" in \
384 Cygwin*) \
385 rm -f apps/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
386 rm -f test/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
387 cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll apps/; \
388 cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll test/; \
389 ;; \
390 mingw*) \
391 case $$i in \
392 crypto) i=libeay32;; \
393 ssl) i=ssleay32;; \
394 esac; \
395 rm -f apps/$$i.dll; \
396 rm -f test/$$i.dll; \
397 cp $$i.dll apps/; \
398 cp $$i.dll test/; \
399 esac; \
400 done
401
402 libcrypto.pc: Makefile
403 @ ( echo 'prefix=$(INSTALLTOP)'; \
404 echo 'exec_prefix=$${prefix}'; \
405 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
406 echo 'includedir=$${prefix}/include'; \
407 echo ''; \
408 echo 'Name: OpenSSL-libcrypto'; \
409 echo 'Description: OpenSSL cryptography library'; \
410 echo 'Version: '$(VERSION); \
411 echo 'Requires: '; \
412 echo 'Libs: -L$${libdir} -lcrypto'; \
413 echo 'Libs.private: $(EX_LIBS)'; \
414 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
415
416 libssl.pc: Makefile
417 @ ( echo 'prefix=$(INSTALLTOP)'; \
418 echo 'exec_prefix=$${prefix}'; \
419 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
420 echo 'includedir=$${prefix}/include'; \
421 echo ''; \
422 echo 'Name: OpenSSL-libssl'; \
423 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
424 echo 'Version: '$(VERSION); \
425 echo 'Requires.private: libcrypto'; \
426 echo 'Libs: -L$${libdir} -lssl'; \
427 echo 'Libs.private: $(EX_LIBS)'; \
428 echo 'Cflags: -I$${includedir}' ) > libssl.pc
429
430 openssl.pc: Makefile
431 @ ( echo 'prefix=$(INSTALLTOP)'; \
432 echo 'exec_prefix=$${prefix}'; \
433 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
434 echo 'includedir=$${prefix}/include'; \
435 echo ''; \
436 echo 'Name: OpenSSL'; \
437 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
438 echo 'Version: '$(VERSION); \
439 echo 'Requires: libssl libcrypto' ) > openssl.pc
440
441 Makefile: Makefile.in Configure config
442 @echo "Makefile is older than Makefile.in, Configure or config."
443 @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
444 @false
445
446 libclean:
447 rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
448
449 clean: libclean
450 rm -f */*/*.o */*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
451 rm -rf *.bak certs/.0
452 @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
453 rm -f $(LIBS) tags TAGS
454 rm -f openssl.pc libssl.pc libcrypto.pc
455 rm -f speed.* .pure
456 rm -f $(TARFILE)
457
458 makefile.one: files
459 $(PERL) util/mk1mf.pl >makefile.one; \
460 sh util/do_ms.sh
461
462 files:
463 $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
464 @set -e; target=files; $(RECURSIVE_BUILD_CMD)
465
466 gentests:
467 @(cd test && echo "generating dummy tests (if needed)..." && \
468 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
469
470 rehash: rehash.time
471 rehash.time: certs build_apps build_tools
472 @if [ -z "$(CROSS_COMPILE)" ]; then \
473 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
474 [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
475 OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \
476 export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \
477 $$OPENSSL rehash certs/demo \
478 || $(PERL) tools/c_rehash certs/demo) && \
479 touch rehash.time; \
480 else :; fi
481
482 test: files tests
483
484
485 tests: build_tests rehash
486 @(cd test && echo "testing..." && \
487 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
488 @if [ -z "$(CROSS_COMPILE)" ]; then \
489 OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a; \
490 fi
491
492 list-tests:
493 @(cd test && \
494 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. list-tests)
495
496 report:
497 @$(PERL) util/selftest.pl
498
499 tags TAGS: FORCE
500 rm -f TAGS tags
501 -ctags -R .
502 -etags `find . -name '*.[ch]' -o -name '*.pm'`
503
504 FORCE:
505
506 depend:
507 @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
508
509 update: generate errors ordinals depend
510
511 generate:
512 (cd apps && PERL='${PERL}' $(MAKE) generate)
513 (cd crypto/bn && PERL='${PERL}' $(MAKE) generate)
514 (cd crypto/objects && PERL='${PERL}' $(MAKE) generate)
515
516 errors:
517 $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
518 $(PERL) util/mkerr.pl -recurse -write
519 (cd engines; $(MAKE) PERL=$(PERL) errors)
520 (cd crypto/ct; $(MAKE) PERL=$(PERL) errors)
521
522 ordinals: util/libeay.num util/ssleay.num test_ordinals TABLE
523 util/libeay.num::
524 $(PERL) util/mkdef.pl crypto update
525 util/ssleay.num::
526 $(PERL) util/mkdef.pl ssl update
527 test_ordinals:
528 TOP=$(TOP) PERL=$(PERL) $(PERL) test/run_tests.pl test_ordinals
529
530 TABLE: Configure Configurations/*.conf
531 (echo 'Output of `Configure TABLE'"':"; \
532 $(PERL) Configure TABLE) > TABLE
533
534 # Build distribution tar-file. As the list of files returned by "find" is
535 # pretty long, on several platforms a "too many arguments" error or similar
536 # would occur. Therefore the list of files is temporarily stored into a file
537 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
538 # tar does not support the --files-from option.
539 TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
540 --owner 0 --group 0 \
541 --transform 's|^|$(NAME)/|' \
542 -cvf -
543
544 $(TARFILE).list:
545 git diff --quiet HEAD
546 git ls-files | sort > $(TARFILE).list
547
548 tar: $(TARFILE).list
549 find . -type d -print | xargs chmod 755
550 find . -type f -print | xargs chmod a+r
551 find . -type f -perm -0100 -print | xargs chmod a+x
552 $(TAR_COMMAND) | gzip --best > $(TARFILE).gz
553 rm -f $(TARFILE).list
554 ls -l $(TARFILE).gz
555
556 tar-snap: $(TARFILE).list
557 $(TAR_COMMAND) > $(TARFILE)
558 rm -f $(TARFILE).list
559 ls -l $(TARFILE)
560
561 dist:
562 $(PERL) Configure dist
563 @$(MAKE) SDIRS='$(SDIRS)' clean
564 @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
565
566 install: all install_docs install_sw
567
568 uninstall: uninstall_sw uninstall_docs
569
570 install_sw:
571 @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALLDIRS)
572 @set -e; for i in include/openssl/*.h; do \
573 (cp $$i $(DESTDIR)$(INSTALLTOP)/$$i; \
574 chmod 644 $(DESTDIR)$(INSTALLTOP)/$$i ); \
575 done;
576 @set -e; target=install; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
577 @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
578 do \
579 if [ -f "$$i" ]; then \
580 ( echo installing $$i; \
581 cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
582 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
583 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
584 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
585 fi; \
586 done;
587 @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
588 tmp="$(SHARED_LIBS)"; \
589 for i in $${tmp:-x}; \
590 do \
591 if [ -f "$$i" -o -f "$$i.a" ]; then \
592 ( echo installing $$i; \
593 if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
594 c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
595 cp $$c $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
596 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
597 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$c.new $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
598 cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
599 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
600 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
601 else \
602 cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
603 chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
604 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
605 fi ); \
606 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
607 ( case $$i in \
608 *crypto*) i=libeay32.dll;; \
609 *ssl*) i=ssleay32.dll;; \
610 esac; \
611 echo installing $$i; \
612 cp $$i $(DESTDIR)$(INSTALLTOP)/bin/$$i.new; \
613 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$i.new; \
614 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$i.new $(DESTDIR)$(INSTALLTOP)/bin/$$i ); \
615 fi; \
616 fi; \
617 done; \
618 ( here="`pwd`"; \
619 cd $(DESTDIR)$(INSTALLTOP)/$(LIBDIR); \
620 $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
621 if [ "$(INSTALLTOP)" != "/usr" ]; then \
622 echo 'OpenSSL shared libraries have been installed in:'; \
623 echo ' $(INSTALLTOP)'; \
624 fi; \
625 fi
626 cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
627 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
628 cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
629 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
630 cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
631 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
632
633 uninstall_sw:
634 cd include/openssl && files=* && cd $(DESTDIR)$(INSTALLTOP)/include/openssl && $(RM) $$files
635 @for i in $(LIBS) ;\
636 do \
637 test -f "$$i" && \
638 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i && \
639 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
640 done;
641 @if [ -n "$(SHARED_LIBS)" ]; then \
642 tmp="$(SHARED_LIBS)"; \
643 for i in $${tmp:-x}; \
644 do \
645 if [ -f "$$i" -o -f "$$i.a" ]; then \
646 if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
647 c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
648 echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
649 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
650 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
651 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
652 else \
653 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
654 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
655 fi; \
656 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
657 case $$i in \
658 *crypto*) i=libeay32.dll;; \
659 *ssl*) i=ssleay32.dll;; \
660 esac; \
661 echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$i; \
662 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$i; \
663 fi; \
664 fi; \
665 done; \
666 fi
667 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
668 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
669 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
670 @target=uninstall; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
671
672 install_html_docs:
673 here="`pwd`"; \
674 filecase=; \
675 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
676 filecase=-i; \
677 esac; \
678 for subdir in apps crypto ssl; do \
679 $(PERL) $(TOP)/util/mkdir-p $(DESTDIR)$(HTMLDIR)/$$subdir; \
680 for i in doc/$$subdir/*.pod; do \
681 fn=`basename $$i .pod`; \
682 echo "installing html/$$fn.$(HTMLSUFFIX)"; \
683 cat $$i \
684 | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
685 | pod2html --podroot=doc --htmlroot=.. --podpath=$$subdir:apps:crypto:ssl \
686 | sed -r 's/<!DOCTYPE.*//g' \
687 > $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
688 $(PERL) util/extract-names.pl < $$i | \
689 grep -v $$filecase "^$$fn\$$" | \
690 (cd $(DESTDIR)$(HTMLDIR)/$$subdir; \
691 while read n; do \
692 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
693 done); \
694 done; \
695 done
696
697 uninstall_html_docs:
698 here="`pwd`"; \
699 filecase=; \
700 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
701 filecase=-i; \
702 esac; \
703 for subdir in apps crypto ssl; do \
704 for i in doc/$$subdir/*.pod; do \
705 fn=`basename $$i .pod`; \
706 $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
707 $(PERL) util/extract-names.pl < $$i | \
708 grep -v $$filecase "^$$fn\$$" | \
709 while read n; do \
710 $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/"$$n".$(HTMLSUFFIX); \
711 done; \
712 done; \
713 done
714
715 install_docs:
716 @$(PERL) $(TOP)/util/mkdir-p.pl \
717 $(DESTDIR)$(MANDIR)/man1 \
718 $(DESTDIR)$(MANDIR)/man3 \
719 $(DESTDIR)$(MANDIR)/man5 \
720 $(DESTDIR)$(MANDIR)/man7
721 here="`pwd`"; \
722 filecase=; \
723 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
724 filecase=-i; \
725 esac; \
726 set -e; for i in doc/apps/*.pod; do \
727 fn=`basename $$i .pod`; \
728 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
729 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
730 (cd `$(PERL) util/dirname.pl $$i`; \
731 pod2man \
732 --section=$$sec --center=OpenSSL \
733 --release=$(VERSION) `basename $$i`) \
734 > $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
735 $(PERL) util/extract-names.pl < $$i | \
736 (grep -v $$filecase "^$$fn\$$"; true) | \
737 (grep -v "[ ]"; true) | \
738 (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
739 while read n; do \
740 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
741 done); \
742 done; \
743 set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
744 fn=`basename $$i .pod`; \
745 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
746 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
747 (cd `$(PERL) util/dirname.pl $$i`; \
748 pod2man \
749 --section=$$sec --center=OpenSSL \
750 --release=$(VERSION) `basename $$i`) \
751 > $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
752 $(PERL) util/extract-names.pl < $$i | \
753 (grep -v $$filecase "^$$fn\$$"; true) | \
754 (grep -v "[ ]"; true) | \
755 (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
756 while read n; do \
757 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
758 done); \
759 done
760
761 uninstall_docs:
762 @here="`pwd`"; \
763 filecase=; \
764 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \
765 filecase=-i; \
766 esac; \
767 for i in doc/apps/*.pod; do \
768 fn=`basename $$i .pod`; \
769 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
770 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
771 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
772 $(PERL) util/extract-names.pl < $$i | \
773 (grep -v $$filecase "^$$fn\$$"; true) | \
774 (grep -v "[ ]"; true) | \
775 while read n; do \
776 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
777 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
778 done; \
779 done; \
780 for i in doc/crypto/*.pod doc/ssl/*.pod; do \
781 fn=`basename $$i .pod`; \
782 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
783 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
784 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
785 $(PERL) util/extract-names.pl < $$i | \
786 (grep -v $$filecase "^$$fn\$$"; true) | \
787 (grep -v "[ ]"; true) | \
788 while read n; do \
789 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
790 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
791 done; \
792 done
793
794 # DO NOT DELETE THIS LINE -- make depend depends on it.