]> git.ipfire.org Git - thirdparty/openssl.git/blob - Makefile.in
Always build library object files with shared library cflags
[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}},"OPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","ENGINESDIR=\"\\\"\$(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_CFLAG={- $target{shared_cflag} -}
198 SHARED_LDFLAG={- $target{shared_ldflag}
199 # Unlike other OSes (like Solaris, Linux, Tru64,
200 # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
201 # and FreeBSD) "demand" RPATH set on .so objects.
202 # Apparently application RPATH is not global and
203 # does not apply to .so linked with other .so.
204 # Problem manifests itself when libssl.so fails to
205 # load libcrypto.so. One can argue that we should
206 # engrave this into Makefile.shared rules or into
207 # BSD-* config lines above. Meanwhile let's try to
208 # be cautious and pass -rpath to linker only when
209 # $prefix is not /usr.
210 . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
211 ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
212 SHARED_RCFLAG={- $target{shared_rcflag} -}
213
214 GENERAL= Makefile
215 BASENAME= openssl
216 NAME= $(BASENAME)-$(VERSION)
217 TARFILE= ../$(NAME).tar
218 HEADER= e_os.h
219
220 # Directories created on install if they don't exist.
221 INSTALLDIRS= \
222 $(DESTDIR)$(INSTALLTOP)/bin \
223 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) \
224 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines \
225 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
226 $(DESTDIR)$(INSTALLTOP)/include/openssl \
227 $(DESTDIR)$(OPENSSLDIR)/misc \
228 $(DESTDIR)$(OPENSSLDIR)/certs \
229 $(DESTDIR)$(OPENSSLDIR)/private
230
231 all: Makefile build_all_but_tests
232
233 # as we stick to -e, CLEARENV ensures that local variables in lower
234 # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
235 # shell, which [annoyingly enough] terminates unset with error if VAR
236 # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
237 # which terminates unset with error if no variable was present:-(
238 CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
239 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES} \
240 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC} \
241 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
242 $${HEADER+HEADER} \
243 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
244 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
245 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
246 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
247 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
248
249 # LC_ALL=C ensures that error [and other] messages are delivered in
250 # same language for uniform treatment.
251 BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
252 CC='$(CC)' CFLAG='$(CFLAG)' CFLAG_Q='$(CFLAG_Q)' \
253 SHARED_CFLAG='$(SHARED_CFLAG)' \
254 AS='$(CC)' ASFLAG='$(CFLAG) -c' \
255 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
256 CROSS_COMPILE='$(CROSS_COMPILE)' \
257 PERL='$(PERL)' \
258 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)' \
259 DESTDIR='$(DESTDIR)' \
260 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \
261 LIBDIR='$(LIBDIR)' \
262 SHARED_LDFLAG='$(SHARED_LDFLAG)' \
263 SHARED_RCFLAG='$(SHARED_RCFLAG)' \
264 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \
265 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
266 SHLIB_EXT='$(SHLIB_EXT)' DSO_EXT='$(DSO_EXT)' \
267 SHLIB_TARGET='$(SHLIB_TARGET)' \
268 LDFLAG='$(LDFLAG)' \
269 PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)' \
270 APPS_OBJ='$(APPS_OBJ)' \
271 CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
272 EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
273 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
274 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
275 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
276 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)' \
277 MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
278 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
279 WP_ASM_OBJ='$(WP_ASM_OBJ)' \
280 MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
281 PADLOCK_ASM_OBJ='$(PADLOCK_ASM_OBJ)' \
282 CHACHA_ENC='$(CHACHA_ENC)' \
283 POLY1305_ASM_OBJ='$(POLY1305_ASM_OBJ)' \
284 PERLASM_SCHEME='$(PERLASM_SCHEME)' \
285 FIPSLIBDIR='${FIPSLIBDIR}' \
286 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
287 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
288 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
289 # which in turn eliminates ambiguities in variable treatment with -e.
290
291 # BUILD_CMD is a generic macro to build a given target in a given
292 # subdirectory. The target must be given through the shell variable
293 # `target' and the subdirectory to build in must be given through `dir'.
294 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
295 # BUILD_ONE_CMD instead.
296 #
297 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
298 # subdirectories defined in $(DIRS). It requires that the target
299 # is given through the shell variable `target'.
300 #
301 # BUILD_ONE_CMD is a macro to build a given target in a given
302 # subdirectory if that subdirectory is part of $(DIRS). It requires
303 # exactly the same shell variables as BUILD_CMD.
304 BUILD_CMD= if [ -d "$$dir" ]; then \
305 ( cd $$dir && echo "making $$target in $$dir..." && \
306 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
307 ) || exit 1; \
308 fi
309 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
310 BUILD_ONE_CMD=\
311 if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
312 $(BUILD_CMD); \
313 fi
314
315 reflect:
316 @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
317
318 sub_all: build_all
319
320 build_all_but_tests: build_libs build_apps build_tools
321 build_all: build_all_but_tests build_tests
322
323 build_libs: build_libcrypto build_libssl openssl.pc
324
325 build_libcrypto: build_crypto build_engines libcrypto.pc
326 build_libssl: build_ssl libssl.pc
327
328 build_crypto:
329 @dir=crypto; target=all; $(BUILD_ONE_CMD)
330 build_ssl: build_crypto
331 @dir=ssl; target=all; $(BUILD_ONE_CMD)
332 build_engines: build_crypto
333 @dir=engines; target=all; AS='$(CC) -c'; export AS; $(BUILD_ONE_CMD)
334
335 build_apps: build_libs
336 @dir=apps; target=all; $(BUILD_ONE_CMD)
337 build_tests: build_libs
338 @dir=test; target=all; $(BUILD_ONE_CMD)
339 build_tools: build_libs
340 @dir=tools; target=all; $(BUILD_ONE_CMD)
341
342 all_testapps: build_libs build_testapps
343 build_testapps:
344 @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
345
346 libcrypto$(SHLIB_EXT): libcrypto.a
347 @if [ "$(SHLIB_TARGET)" != "" ]; then \
348 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
349 FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
350 export CC FIPSLD_CC; \
351 fi; \
352 $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared; \
353 else \
354 echo "There's no support for shared libraries on this platform" >&2; \
355 exit 1; \
356 fi
357
358 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
359 @if [ "$(SHLIB_TARGET)" != "" ]; then \
360 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
361 else \
362 echo "There's no support for shared libraries on this platform" >&2; \
363 exit 1; \
364 fi
365
366 link-shared:
367 @ set -e; for i in $(SHLIBDIRS); do \
368 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
369 LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
370 LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
371 symlink.$(SHLIB_TARGET); \
372 libs="$$libs -l$$i"; \
373 done
374
375 build-shared: do_$(SHLIB_TARGET) link-shared
376
377 do_$(SHLIB_TARGET):
378 @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
379 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
380 LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
381 LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
382 LIBDEPS="$$libs $(EX_LIBS)" \
383 link_shlib.$(SHLIB_TARGET); \
384 libs="-l$$i $$libs"; \
385 case "$(PLATFORM)" in \
386 Cygwin*) \
387 rm -f apps/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
388 rm -f test/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
389 cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll apps/; \
390 cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll test/; \
391 ;; \
392 mingw*) \
393 arch=; \
394 if expr $(PLATFORM) : mingw64 > /dev/null; then \
395 arch=-x64; \
396 fi; \
397 rm -f apps/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
398 rm -f test/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
399 cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll apps/; \
400 cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll test/; \
401 ;; \
402 esac; \
403 done
404
405 libcrypto.pc: Makefile
406 @ ( echo 'prefix=$(INSTALLTOP)'; \
407 echo 'exec_prefix=$${prefix}'; \
408 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
409 echo 'includedir=$${prefix}/include'; \
410 echo ''; \
411 echo 'Name: OpenSSL-libcrypto'; \
412 echo 'Description: OpenSSL cryptography library'; \
413 echo 'Version: '$(VERSION); \
414 echo 'Requires: '; \
415 echo 'Libs: -L$${libdir} -lcrypto'; \
416 echo 'Libs.private: $(EX_LIBS)'; \
417 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
418
419 libssl.pc: Makefile
420 @ ( echo 'prefix=$(INSTALLTOP)'; \
421 echo 'exec_prefix=$${prefix}'; \
422 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
423 echo 'includedir=$${prefix}/include'; \
424 echo ''; \
425 echo 'Name: OpenSSL-libssl'; \
426 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
427 echo 'Version: '$(VERSION); \
428 echo 'Requires.private: libcrypto'; \
429 echo 'Libs: -L$${libdir} -lssl'; \
430 echo 'Libs.private: $(EX_LIBS)'; \
431 echo 'Cflags: -I$${includedir}' ) > libssl.pc
432
433 openssl.pc: Makefile
434 @ ( echo 'prefix=$(INSTALLTOP)'; \
435 echo 'exec_prefix=$${prefix}'; \
436 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
437 echo 'includedir=$${prefix}/include'; \
438 echo ''; \
439 echo 'Name: OpenSSL'; \
440 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
441 echo 'Version: '$(VERSION); \
442 echo 'Requires: libssl libcrypto' ) > openssl.pc
443
444 Makefile: Makefile.in Configure config
445 @echo "Makefile is older than Makefile.in, Configure or config."
446 @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
447 @false
448
449 libclean:
450 rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
451
452 clean: libclean
453 rm -f */*/*.o */*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
454 rm -rf *.bak certs/.0
455 @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
456 rm -f $(LIBS) tags TAGS
457 rm -f openssl.pc libssl.pc libcrypto.pc
458 rm -f speed.* .pure
459 rm -f $(TARFILE)
460
461 makefile.one: files
462 $(PERL) util/mk1mf.pl >makefile.one; \
463 sh util/do_ms.sh
464
465 files:
466 $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
467 @set -e; target=files; $(RECURSIVE_BUILD_CMD)
468
469 gentests:
470 @(cd test && echo "generating dummy tests (if needed)..." && \
471 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
472
473 rehash: rehash.time
474 rehash.time: certs build_apps build_tools
475 @if [ -z "$(CROSS_COMPILE)" ]; then \
476 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
477 [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
478 OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \
479 export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \
480 $$OPENSSL rehash certs/demo \
481 || $(PERL) tools/c_rehash certs/demo) && \
482 touch rehash.time; \
483 else :; fi
484
485 test: files tests
486
487
488 tests: build_tests rehash
489 @(cd test && echo "testing..." && \
490 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
491 @if [ -z "$(CROSS_COMPILE)" ]; then \
492 OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a; \
493 fi
494
495 list-tests:
496 @(cd test && \
497 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. list-tests)
498
499 report:
500 @$(PERL) util/selftest.pl
501
502 tags TAGS: FORCE
503 rm -f TAGS tags
504 -ctags -R .
505 -etags `find . -name '*.[ch]' -o -name '*.pm'`
506
507 FORCE:
508
509 depend:
510 @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
511
512 update: generate errors ordinals depend
513
514 generate:
515 (cd apps && PERL='${PERL}' $(MAKE) generate)
516 (cd crypto/bn && PERL='${PERL}' $(MAKE) generate)
517 (cd crypto/objects && PERL='${PERL}' $(MAKE) generate)
518
519 errors:
520 $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
521 $(PERL) util/mkerr.pl -recurse -write
522 (cd engines; $(MAKE) PERL=$(PERL) errors)
523 (cd crypto/ct; $(MAKE) PERL=$(PERL) errors)
524
525 ordinals: util/libeay.num util/ssleay.num test_ordinals TABLE
526 util/libeay.num::
527 $(PERL) util/mkdef.pl crypto update
528 util/ssleay.num::
529 $(PERL) util/mkdef.pl ssl update
530 test_ordinals:
531 TOP=$(TOP) PERL=$(PERL) $(PERL) test/run_tests.pl test_ordinals
532
533 TABLE: Configure Configurations/*.conf
534 (echo 'Output of `Configure TABLE'"':"; \
535 $(PERL) Configure TABLE) > TABLE
536
537 # Build distribution tar-file. As the list of files returned by "find" is
538 # pretty long, on several platforms a "too many arguments" error or similar
539 # would occur. Therefore the list of files is temporarily stored into a file
540 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
541 # tar does not support the --files-from option.
542 TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
543 --owner 0 --group 0 \
544 --transform 's|^|$(NAME)/|' \
545 -cvf -
546
547 $(TARFILE).list:
548 git diff --quiet HEAD
549 git ls-files | sort > $(TARFILE).list
550
551 tar: $(TARFILE).list
552 find . -type d -print | xargs chmod 755
553 find . -type f -print | xargs chmod a+r
554 find . -type f -perm -0100 -print | xargs chmod a+x
555 $(TAR_COMMAND) | gzip --best > $(TARFILE).gz
556 rm -f $(TARFILE).list
557 ls -l $(TARFILE).gz
558
559 tar-snap: $(TARFILE).list
560 $(TAR_COMMAND) > $(TARFILE)
561 rm -f $(TARFILE).list
562 ls -l $(TARFILE)
563
564 dist:
565 $(PERL) Configure dist
566 @$(MAKE) SDIRS='$(SDIRS)' clean
567 @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
568
569 install: all install_docs install_sw
570
571 uninstall: uninstall_sw uninstall_docs
572
573 install_sw:
574 @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALLDIRS)
575 @set -e; for i in include/openssl/*.h; do \
576 (cp $$i $(DESTDIR)$(INSTALLTOP)/$$i; \
577 chmod 644 $(DESTDIR)$(INSTALLTOP)/$$i ); \
578 done;
579 @set -e; target=install; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
580 @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
581 do \
582 if [ -f "$$i" ]; then \
583 ( echo installing $$i; \
584 cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
585 $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
586 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
587 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
588 fi; \
589 done;
590 @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
591 tmp="$(SHARED_LIBS)"; \
592 for i in $${tmp:-x}; \
593 do \
594 if [ -f "$$i" -o -f "$$i.a" ]; then \
595 case "$(PLATFORM)" in \
596 Cygwin*) \
597 c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
598 echo installing $$c; \
599 cp $$c $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
600 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
601 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$c.new $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
602 echo installing $$i.a; \
603 cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
604 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
605 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
606 ;; \
607 mingw*) \
608 arch=; \
609 if expr $(PLATFORM) : mingw64 > /dev/null; then \
610 arch=-x64; \
611 fi; \
612 m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
613 echo installing $$m; \
614 cp $$m $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
615 chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
616 mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$m.new $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
617 echo installing $$i.a; \
618 cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
619 chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
620 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
621 ;; \
622 *) \
623 echo installing $$i; \
624 cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
625 chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
626 mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
627 ;; \
628 esac; \
629 fi; \
630 done; \
631 ( here="`pwd`"; \
632 cd $(DESTDIR)$(INSTALLTOP)/$(LIBDIR); \
633 $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
634 if [ "$(INSTALLTOP)" != "/usr" ]; then \
635 echo 'OpenSSL shared libraries have been installed in:'; \
636 echo ' $(INSTALLTOP)'; \
637 fi; \
638 fi
639 cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
640 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
641 cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
642 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
643 cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
644 chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
645
646 uninstall_sw:
647 cd include/openssl && files=* && cd $(DESTDIR)$(INSTALLTOP)/include/openssl && $(RM) $$files
648 @for i in $(LIBS) ;\
649 do \
650 test -f "$$i" && \
651 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i && \
652 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
653 done;
654 @if [ -n "$(SHARED_LIBS)" ]; then \
655 tmp="$(SHARED_LIBS)"; \
656 for i in $${tmp:-x}; \
657 do \
658 if [ -f "$$i" -o -f "$$i.a" ]; then \
659 case "$(PLATFORM)" in \
660 Cygwin*) \
661 c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
662 echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
663 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
664 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
665 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
666 ;; \
667 mingw*) \
668 arch=; \
669 if expr $(PLATFORM) : mingw64 > /dev/null; then \
670 arch=-x64; \
671 fi; \
672 m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
673 echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
674 $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
675 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
676 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
677 ;; \
678 *) \
679 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
680 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
681 ;; \
682 esac; \
683 fi; \
684 done; \
685 fi
686 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
687 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
688 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
689 @target=uninstall; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
690
691 install_html_docs:
692 here="`pwd`"; \
693 filecase=; \
694 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
695 filecase=-i; \
696 esac; \
697 for subdir in apps crypto ssl; do \
698 $(PERL) $(TOP)/util/mkdir-p $(DESTDIR)$(HTMLDIR)/$$subdir; \
699 for i in doc/$$subdir/*.pod; do \
700 fn=`basename $$i .pod`; \
701 echo "installing html/$$fn.$(HTMLSUFFIX)"; \
702 cat $$i \
703 | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
704 | pod2html --podroot=doc --htmlroot=.. --podpath=$$subdir:apps:crypto:ssl \
705 | sed -r 's/<!DOCTYPE.*//g' \
706 > $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
707 $(PERL) util/extract-names.pl < $$i | \
708 grep -v $$filecase "^$$fn\$$" | \
709 (cd $(DESTDIR)$(HTMLDIR)/$$subdir; \
710 while read n; do \
711 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
712 done); \
713 done; \
714 done
715
716 uninstall_html_docs:
717 here="`pwd`"; \
718 filecase=; \
719 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
720 filecase=-i; \
721 esac; \
722 for subdir in apps crypto ssl; do \
723 for i in doc/$$subdir/*.pod; do \
724 fn=`basename $$i .pod`; \
725 $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
726 $(PERL) util/extract-names.pl < $$i | \
727 grep -v $$filecase "^$$fn\$$" | \
728 while read n; do \
729 $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/"$$n".$(HTMLSUFFIX); \
730 done; \
731 done; \
732 done
733
734 install_docs:
735 @$(PERL) $(TOP)/util/mkdir-p.pl \
736 $(DESTDIR)$(MANDIR)/man1 \
737 $(DESTDIR)$(MANDIR)/man3 \
738 $(DESTDIR)$(MANDIR)/man5 \
739 $(DESTDIR)$(MANDIR)/man7
740 here="`pwd`"; \
741 filecase=; \
742 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
743 filecase=-i; \
744 esac; \
745 set -e; for i in doc/apps/*.pod; do \
746 fn=`basename $$i .pod`; \
747 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
748 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
749 (cd `$(PERL) util/dirname.pl $$i`; \
750 pod2man \
751 --section=$$sec --center=OpenSSL \
752 --release=$(VERSION) `basename $$i`) \
753 > $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
754 $(PERL) util/extract-names.pl < $$i | \
755 (grep -v $$filecase "^$$fn\$$"; true) | \
756 (grep -v "[ ]"; true) | \
757 (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
758 while read n; do \
759 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
760 done); \
761 done; \
762 set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
763 fn=`basename $$i .pod`; \
764 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
765 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
766 (cd `$(PERL) util/dirname.pl $$i`; \
767 pod2man \
768 --section=$$sec --center=OpenSSL \
769 --release=$(VERSION) `basename $$i`) \
770 > $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
771 $(PERL) util/extract-names.pl < $$i | \
772 (grep -v $$filecase "^$$fn\$$"; true) | \
773 (grep -v "[ ]"; true) | \
774 (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
775 while read n; do \
776 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
777 done); \
778 done
779
780 uninstall_docs:
781 @here="`pwd`"; \
782 filecase=; \
783 case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \
784 filecase=-i; \
785 esac; \
786 for i in doc/apps/*.pod; do \
787 fn=`basename $$i .pod`; \
788 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
789 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
790 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
791 $(PERL) util/extract-names.pl < $$i | \
792 (grep -v $$filecase "^$$fn\$$"; true) | \
793 (grep -v "[ ]"; true) | \
794 while read n; do \
795 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
796 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
797 done; \
798 done; \
799 for i in doc/crypto/*.pod doc/ssl/*.pod; do \
800 fn=`basename $$i .pod`; \
801 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
802 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
803 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
804 $(PERL) util/extract-names.pl < $$i | \
805 (grep -v $$filecase "^$$fn\$$"; true) | \
806 (grep -v "[ ]"; true) | \
807 while read n; do \
808 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
809 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
810 done; \
811 done
812
813 # DO NOT DELETE THIS LINE -- make depend depends on it.