]> git.ipfire.org Git - thirdparty/openssl.git/blame - Makefile.org
Reject negative shifts for BN_rshift and BN_lshift
[thirdparty/openssl.git] / Makefile.org
CommitLineData
d56128f0
RE
1##
2## Makefile for OpenSSL
3##
4
0973910f
UM
5VERSION=
6MAJOR=
7MINOR=
b436a982
RL
8SHLIB_VERSION_NUMBER=
9SHLIB_VERSION_HISTORY=
10SHLIB_MAJOR=
11SHLIB_MINOR=
a22fb399 12SHLIB_EXT=
d56128f0 13PLATFORM=dist
31ff97b2 14OPTIONS=
c59cb511 15CONFIGURE_ARGS=
b436a982
RL
16SHLIB_TARGET=
17
30c08f2e
RL
18# HERE indicates where this Makefile lives. This can be used to indicate
19# where sub-Makefiles are expected to be. Currently has very limited usage,
20# and should probably not be bothered with at all.
21HERE=.
22
e5f3045f
BM
23# INSTALL_PREFIX is for package builders so that they can configure
24# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
25# Normally it is left empty.
26INSTALL_PREFIX=
462ba4f6
UM
27INSTALLTOP=/usr/local/ssl
28
29# Do not edit this manually. Use Configure --openssldir=DIR do change this!
30OPENSSLDIR=/usr/local/ssl
d56128f0 31
d02b48c6
RE
32# NO_IDEA - Define to build without the IDEA algorithm
33# NO_RC4 - Define to build without the RC4 algorithm
34# NO_RC2 - Define to build without the RC2 algorithm
35# THREADS - Define when building with threads, you will probably also need any
58964a49 36# system defines as well, i.e. _REENTERANT for Solaris 2.[34]
d02b48c6
RE
37# TERMIO - Define the termio terminal subsystem, needed if sgtty is missing.
38# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
39# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
40# DEVRANDOM - Give this the value of the 'random device' if your OS supports
58964a49
RE
41# one. 32 bytes will be read from this when the random
42# number generator is initalised.
baf748ba 43# SSL_FORBID_ENULL - define if you want the server to be not able to use the
58964a49 44# NULL encryption ciphers.
d02b48c6
RE
45#
46# LOCK_DEBUG - turns on lots of lock debug output :-)
47# REF_CHECK - turn on some xyz_free() assertions.
58964a49 48# REF_PRINT - prints some stuff on structure free.
d02b48c6
RE
49# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
50# MFUNC - Make all Malloc/Free/Realloc calls call
58964a49
RE
51# CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
52# call application defined callbacks via CRYPTO_set_mem_functions()
53# MD5_ASM needs to be defined to use the x86 assembler for MD5
54# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
55# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
dfeab068
RE
56# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8. It must
57# equal 4.
58# PKCS1_CHECK - pkcs1 tests.
d02b48c6 59
67ea999d
AP
60CC= cc
61CFLAG= -O
f5d7a031 62DEPFLAG=
bc29d0e5 63PEX_LIBS=
651d0aff 64EX_LIBS=
967d95f0 65EXE_EXT=
179add2b
RL
66ARFLAGS=
67AR=ar $(ARFLAGS) r
d83dde61 68ARD=ar $(ARFLAGS) d
99aab161
UM
69RANLIB= ranlib
70PERL= perl
2dbb3ccd 71TAR= tar
2e9fd430 72TARFLAGS= --no-recursion --record-size=10240
cf1b7d96 73MAKEDEPPROG=makedepend
985b5ee7 74LIBDIR=lib
d02b48c6 75
3cc9a89d
AP
76# We let the C compiler driver to take care of .s files. This is done in
77# order to be excused from maintaining a separate set of architecture
78# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
79# gcc, then the driver will automatically translate it to -xarch=v8plus
80# and pass it down to assembler.
81AS=$(CC) -c
01fc834b 82ASFLAG=$(CFLAG)
3cc9a89d 83
14e21f86
AP
84# For x86 assembler: Set PROCESSOR to 386 if you want to support
85# the 80386.
86PROCESSOR=
87
88# CPUID module collects small commonly used assembler snippets
89CPUID_OBJ=
dfeab068 90BN_ASM= bn_asm.o
67ea999d 91DES_ENC= des_enc.o fcrypt_b.o
ed65fab9 92AES_ASM_OBJ=aes_core.o aes_cbc.o
67ea999d
AP
93BF_ENC= bf_enc.o
94CAST_ENC= c_enc.o
95RC4_ENC= rc4_enc.o
96RC5_ENC= rc5_enc.o
97MD5_ASM_OBJ=
98SHA1_ASM_OBJ=
99RMD160_ASM_OBJ=
58964a49 100
f9b3bff6
RL
101# KRB5 stuff
102KRB5_INCLUDES=
c1269c81 103LIBKRB5=
f9b3bff6 104
7614f0e5
DSH
105# Zlib stuff
106ZLIB_INCLUDE=
107LIBZLIB=
108
d83dde61
DSH
109# This is the location of fipscanister.o and friends.
110# The FIPS module build will place it $(INSTALLTOP)/lib
111# but since $(INSTALLTOP) can only take the default value
112# when the module is built it will be in /usr/local/ssl/lib
113# $(INSTALLTOP) for this build make be different so hard
114# code the path.
115
985b5ee7 116FIPSLIBDIR=/usr/local/ssl/$(LIBDIR)/
d83dde61
DSH
117
118# This is set to "y" if fipscanister.o is compiled internally as
119# opposed to coming from an external validated location.
120
121FIPSCANISTERINTERNAL=n
122
123# The location of the library which contains fipscanister.o
124# normally it will be libcrypto unless fipsdso is set in which
125# case it will be libfips. If not compiling in FIPS mode at all
126# this is empty making it a useful test for a FIPS compile.
127
128FIPSCANLIB=
129
130# Shared library base address. Currently only used on Windows.
131#
132
133BASEADDR=
134
135DIRS= crypto fips ssl engines apps test tools
136SHLIBDIRS= crypto ssl fips
0973910f 137
d02b48c6
RE
138# dirs in crypto to build
139SDIRS= \
d87b79bf 140 objects \
3009458e 141 md2 md4 md5 sha mdc2 hmac ripemd \
c3cc4662 142 des aes rc2 rc4 rc5 idea bf cast camellia seed \
67ea999d 143 bn ec rsa dsa ecdsa dh ecdh dso engine \
d87b79bf 144 buffer bio stack lhash rand err \
a5db6fa5 145 evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
2124e869 146 store cms pqueue jpake
a24b7eeb
AP
147# keep in mind that the above list is adjusted by ./Configure
148# according to no-xxx arguments...
d02b48c6 149
f777408f
RL
150# tests to perform. "alltests" is a special word indicating that all tests
151# should be performed.
152TESTS = alltests
153
42ba5d23 154MAKEFILE= Makefile
d02b48c6 155
e1c55191 156MANDIR=$(OPENSSLDIR)/man
d02b48c6
RE
157MAN1=1
158MAN3=3
1cc087fe 159MANSUFFIX=
d02b48c6
RE
160SHELL=/bin/sh
161
58964a49 162TOP= .
d02b48c6 163ONEDIRS=out tmp
7d7d2cbc 164EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS
58964a49 165WDIRS= windows
b436a982 166LIBS= libcrypto.a libssl.a
a22fb399
RL
167SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
168SHARED_SSL=libssl$(SHLIB_EXT)
d83dde61 169SHARED_FIPS=
a22fb399
RL
170SHARED_LIBS=
171SHARED_LIBS_LINK_EXTS=
a5595fde 172SHARED_LDFLAGS=
58964a49
RE
173
174GENERAL= Makefile
9ce5db45 175BASENAME= openssl
58964a49
RE
176NAME= $(BASENAME)-$(VERSION)
177TARFILE= $(NAME).tar
178WTARFILE= $(NAME)-win.tar
cf1b7d96 179EXHEADER= e_os2.h
58964a49 180HEADER= e_os.h
d02b48c6 181
ef8a18f4 182all: Makefile build_all openssl.pc libssl.pc libcrypto.pc
d02b48c6 183
a24b7eeb
AP
184# as we stick to -e, CLEARENV ensures that local variables in lower
185# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
186# shell, which [annoyingly enough] terminates unset with error if VAR
187# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
188# which terminates unset with error if no variable was present:-(
189CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
190 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES} \
191 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC} \
192 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
193 $${EXHEADER+EXHEADER} $${HEADER+HEADER} \
194 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
195 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
196 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} \
197 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
198 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
199
d0590fe6 200BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
d0590fe6 201 CC='${CC}' CFLAG='${CFLAG}' \
33c3ecf7 202 AS='${CC}' ASFLAG='${CFLAG} -c' \
d0590fe6 203 AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}' \
985b5ee7 204 SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/$(LIBDIR)' \
7844ff73 205 INSTALL_PREFIX='${INSTALL_PREFIX}' \
7abbffc3 206 INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' \
98f43a17 207 LIBDIR='${LIBDIR}' \
a24b7eeb 208 MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
ce92b6eb
AP
209 DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}' \
210 MAKEDEPPROG='${MAKEDEPPROG}' \
a24b7eeb 211 SHARED_LDFLAGS='${SHARED_LDFLAGS}' \
d0590fe6
AP
212 KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' \
213 EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' \
214 SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
215 PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' \
14e21f86 216 CPUID_OBJ='${CPUID_OBJ}' \
d0590fe6
AP
217 BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' \
218 AES_ASM_OBJ='${AES_ASM_OBJ}' \
219 BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' \
220 RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' \
221 SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' \
222 MD5_ASM_OBJ='${MD5_ASM_OBJ}' \
7abbffc3 223 RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' \
1ff7b649
AP
224 FIPSLIBDIR='${FIPSLIBDIR}' \
225 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
d83dde61
DSH
226 FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}' \
227 FIPS_EX_OBJ='${FIPS_EX_OBJ}' \
a24b7eeb
AP
228 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
229# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
230# which in turn eliminates ambiguities in variable treatment with -e.
d0590fe6 231
6b5f5e35
RL
232# BUILD_CMD is a generic macro to build a given target in a given
233# subdirectory. The target must be given through the shell variable
234# `target' and the subdirectory to build in must be given through `dir'.
235# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
236# BUILD_ONE_CMD instead.
237#
238# BUILD_ONE_CMD is a macro to build a given target in a given
239# subdirectory if that subdirectory is part of $(DIRS). It requires
240# exactly the same shell variables as BUILD_CMD.
241#
242# RECURSIVE_BUILD_CMD is a macro to build a given target in all
243# subdirectories defined in $(DIRS). It requires that the target
244# is given through the shell variable `target'.
a24b7eeb 245BUILD_CMD= if [ -d "$$dir" ]; then \
1ff7b649
AP
246 ( [ $$target != all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=/dev/null; \
247 cd $$dir && echo "making $$target in $$dir..." && \
a24b7eeb
AP
248 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
249 ) || exit 1; \
250 fi
251RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
6b5f5e35
RL
252BUILD_ONE_CMD=\
253 if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
254 $(BUILD_CMD); \
255 fi
88c80b3e 256
734540f8 257reflect:
a24b7eeb 258 @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
734540f8 259
d83dde61
DSH
260FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
261 ../crypto/aes/aes_ecb.o \
262 ../crypto/aes/aes_ofb.o \
263 ../crypto/bn/bn_add.o \
264 ../crypto/bn/bn_blind.o \
265 ../crypto/bn/bn_ctx.o \
266 ../crypto/bn/bn_div.o \
267 ../crypto/bn/bn_exp2.o \
268 ../crypto/bn/bn_exp.o \
269 ../crypto/bn/bn_gcd.o \
270 ../crypto/bn/bn_lib.o \
271 ../crypto/bn/bn_mod.o \
272 ../crypto/bn/bn_mont.o \
273 ../crypto/bn/bn_mul.o \
274 ../crypto/bn/bn_prime.o \
275 ../crypto/bn/bn_rand.o \
276 ../crypto/bn/bn_recp.o \
277 ../crypto/bn/bn_shift.o \
278 ../crypto/bn/bn_sqr.o \
279 ../crypto/bn/bn_word.o \
280 ../crypto/bn/bn_x931p.o \
281 ../crypto/buffer/buf_str.o \
282 ../crypto/cryptlib.o \
283 ../crypto/des/cfb64ede.o \
284 ../crypto/des/cfb64enc.o \
285 ../crypto/des/cfb_enc.o \
286 ../crypto/des/ecb3_enc.o \
287 ../crypto/des/ecb_enc.o \
288 ../crypto/des/ofb64ede.o \
289 ../crypto/des/ofb64enc.o \
290 ../crypto/des/fcrypt.o \
291 ../crypto/des/set_key.o \
292 ../crypto/dsa/dsa_utl.o \
293 ../crypto/dsa/dsa_sign.o \
294 ../crypto/dsa/dsa_vrf.o \
295 ../crypto/err/err.o \
296 ../crypto/evp/digest.o \
297 ../crypto/evp/enc_min.o \
298 ../crypto/evp/e_aes.o \
299 ../crypto/evp/e_des3.o \
300 ../crypto/evp/p_sign.o \
301 ../crypto/evp/p_verify.o \
302 ../crypto/mem_clr.o \
303 ../crypto/mem.o \
304 ../crypto/rand/md_rand.o \
305 ../crypto/rand/rand_egd.o \
306 ../crypto/rand/randfile.o \
307 ../crypto/rand/rand_lib.o \
308 ../crypto/rand/rand_os2.o \
309 ../crypto/rand/rand_unix.o \
310 ../crypto/rand/rand_win.o \
311 ../crypto/rsa/rsa_lib.o \
312 ../crypto/rsa/rsa_none.o \
313 ../crypto/rsa/rsa_oaep.o \
314 ../crypto/rsa/rsa_pk1.o \
315 ../crypto/rsa/rsa_pss.o \
316 ../crypto/rsa/rsa_ssl.o \
317 ../crypto/rsa/rsa_x931.o \
318 ../crypto/sha/sha1dgst.o \
319 ../crypto/sha/sha256.o \
320 ../crypto/sha/sha512.o \
321 ../crypto/uid.o
322
4c82171a 323sub_all: build_all
88c80b3e
RL
324build_all: build_libs build_apps build_tests build_tools
325
d83dde61 326build_libs: build_crypto build_fips build_ssl build_shared build_engines
88c80b3e
RL
327
328build_crypto:
d83dde61
DSH
329 if [ -n "$(FIPSCANLIB)" ]; then \
330 EXCL_OBJ='$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
331 ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
332 else \
333 ARX='${AR}' ; \
334 fi ; export ARX ; \
335 dir=crypto; target=all; $(BUILD_ONE_CMD)
336build_fips:
337 @dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
9ac37cb0 338build_ssl: build_crypto
6b5f5e35 339 @dir=ssl; target=all; $(BUILD_ONE_CMD)
9ac37cb0 340build_engines: build_crypto
6b5f5e35 341 @dir=engines; target=all; $(BUILD_ONE_CMD)
9ac37cb0 342build_apps: build_libs
6b5f5e35 343 @dir=apps; target=all; $(BUILD_ONE_CMD)
9ac37cb0 344build_tests: build_libs
6b5f5e35 345 @dir=test; target=all; $(BUILD_ONE_CMD)
9ac37cb0 346build_tools: build_libs
6b5f5e35 347 @dir=tools; target=all; $(BUILD_ONE_CMD)
ba5477eb
RL
348
349all_testapps: build_libs build_testapps
350build_testapps:
6b5f5e35 351 @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
b436a982 352
d83dde61
DSH
353build_shared: $(SHARED_LIBS)
354libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
f4316c36 355 @if [ "$(SHLIB_TARGET)" != "" ]; then \
d83dde61
DSH
356 if [ "$(FIPSCANLIB)" = "libfips" ]; then \
357 $(ARD) libcrypto.a fipscanister.o ; \
358 $(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
359 $(AR) libcrypto.a fips/fipscanister.o ; \
360 else \
361 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
0dc1b3c1 362 FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
d83dde61
DSH
363 export CC FIPSLD_CC; \
364 fi; \
365 $(MAKE) -e SHLIBDIRS='crypto' build-shared; \
366 fi \
f4316c36
RL
367 else \
368 echo "There's no support for shared libraries on this platform" >&2; \
d0590fe6 369 exit 1; \
f4316c36 370 fi
0f180d1d 371
a22fb399 372libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
f4316c36 373 @if [ "$(SHLIB_TARGET)" != "" ]; then \
d83dde61
DSH
374 shlibdeps=-lcrypto; \
375 [ "$(FIPSCANLIB)" = "libfips" ] && shlibdeps="$$shlibdeps -lfips"; \
376 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS="$$shlibdeps" build-shared; \
377 else \
378 echo "There's no support for shared libraries on this platform" >&2 ; \
379 exit 1; \
380 fi
381
382fips/fipscanister.o: build_fips
383libfips$(SHLIB_EXT): fips/fipscanister.o
384 @if [ "$(SHLIB_TARGET)" != "" ]; then \
0dc1b3c1 385 FIPSLD_CC="$(CC)"; CC=fips/fipsld; export CC FIPSLD_CC; \
d83dde61
DSH
386 $(MAKE) -f Makefile.shared -e $(BUILDENV) \
387 CC=$${CC} LIBNAME=fips THIS=$@ \
388 LIBEXTRAS=fips/fipscanister.o \
389 LIBDEPS="$(EX_LIBS)" \
390 LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
391 link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
f4316c36
RL
392 else \
393 echo "There's no support for shared libraries on this platform" >&2; \
d0590fe6 394 exit 1; \
f4316c36 395 fi
b436a982 396
d83dde61
DSH
397libfips.a:
398 dir=fips; target=all; $(BUILD_ONE_CMD)
399
b436a982 400clean-shared:
cfd06a62 401 @set -e; for i in $(SHLIBDIRS); do \
a22fb399
RL
402 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
403 tmp="$(SHARED_LIBS_LINK_EXTS)"; \
404 for j in $${tmp:-x}; do \
405 ( set -x; rm -f lib$$i$$j ); \
406 done; \
407 fi; \
408 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
49e04548 409 if [ "$(PLATFORM)" = "Cygwin" ]; then \
1fe198b6
RL
410 ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
411 fi; \
b436a982 412 done
d02b48c6 413
a22fb399 414link-shared:
cfd06a62 415 @ set -e; for i in ${SHLIBDIRS}; do \
3bfe024d 416 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
30afcc07
RL
417 LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
418 LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
419 symlink.$(SHLIB_TARGET); \
6b86bad5 420 libs="$$libs -l$$i"; \
0fd44e2d
RL
421 done
422
30afcc07
RL
423build-shared: do_$(SHLIB_TARGET) link-shared
424
425do_$(SHLIB_TARGET):
cfd06a62 426 @ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
c1269c81
RL
427 if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
428 libs="$(LIBKRB5) $$libs"; \
429 fi; \
a24b7eeb 430 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
30afcc07
RL
431 LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
432 LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
433 LIBDEPS="$$libs $(EX_LIBS)" \
434 link_a.$(SHLIB_TARGET); \
c1269c81 435 libs="-l$$i $$libs"; \
a3fffd64
RL
436 done
437
ef8a18f4
RL
438libcrypto.pc: Makefile
439 @ ( echo 'prefix=$(INSTALLTOP)'; \
440 echo 'exec_prefix=$${prefix}'; \
985b5ee7 441 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
ef8a18f4
RL
442 echo 'includedir=$${prefix}/include'; \
443 echo ''; \
444 echo 'Name: OpenSSL-libcrypto'; \
445 echo 'Description: OpenSSL cryptography library'; \
446 echo 'Version: '$(VERSION); \
447 echo 'Requires: '; \
448 echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \
449 echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
450
451libssl.pc: Makefile
452 @ ( echo 'prefix=$(INSTALLTOP)'; \
453 echo 'exec_prefix=$${prefix}'; \
985b5ee7 454 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
ef8a18f4
RL
455 echo 'includedir=$${prefix}/include'; \
456 echo ''; \
457 echo 'Name: OpenSSL'; \
458 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
459 echo 'Version: '$(VERSION); \
460 echo 'Requires: '; \
461 echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
462 echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
463
42ba5d23 464openssl.pc: Makefile
56824b96
RL
465 @ ( echo 'prefix=$(INSTALLTOP)'; \
466 echo 'exec_prefix=$${prefix}'; \
985b5ee7 467 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
56824b96
RL
468 echo 'includedir=$${prefix}/include'; \
469 echo ''; \
470 echo 'Name: OpenSSL'; \
471 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
472 echo 'Version: '$(VERSION); \
473 echo 'Requires: '; \
474 echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
49be7042 475 echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
56824b96 476
c7199e62
BL
477Makefile: Makefile.org Configure config
478 @echo "Makefile is older than Makefile.org, Configure or config."
49b81422 479 @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
9535d202
BL
480 @false
481
dfeab068 482libclean:
15da07d4 483 rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib
dfeab068 484
7841edc9
RL
485clean: libclean
486 rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
a24b7eeb
AP
487 @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
488 rm -f $(LIBS)
ef8a18f4 489 rm -f openssl.pc libssl.pc libcrypto.pc
7841edc9 490 rm -f speed.* .pure
bb8f3c58 491 rm -f $(TARFILE)
cfd06a62 492 @set -e; for i in $(ONEDIRS) ;\
d02b48c6 493 do \
bb8f3c58 494 rm -fr $$i/*; \
d02b48c6
RE
495 done
496
497makefile.one: files
99aab161 498 $(PERL) util/mk1mf.pl >makefile.one; \
d02b48c6
RE
499 sh util/do_ms.sh
500
bacad008 501files:
42ba5d23 502 $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
a24b7eeb 503 @set -e; target=files; $(RECURSIVE_BUILD_CMD)
d02b48c6
RE
504
505links:
6576774b 506 @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
41d2a336 507 @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
a24b7eeb 508 @set -e; target=links; $(RECURSIVE_BUILD_CMD)
b7650eb2
DSH
509 @if [ -z "$(FIPSCANLIB)" ]; then \
510 set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
98448a53 511 fi
d02b48c6 512
1cc67fa8
RL
513gentests:
514 @(cd test && echo "generating dummy tests (if needed)..." && \
a24b7eeb 515 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
1cc67fa8 516
d02b48c6 517dclean:
bb8f3c58 518 rm -f *.bak
a24b7eeb 519 @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
d02b48c6 520
e6e7b5f3 521rehash: rehash.time
8196257f
DSH
522rehash.time: certs apps
523 @if [ -z "$(CROSS_COMPILE)" ]; then \
524 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
525 OPENSSL_DEBUG_MEMORY=on; \
526 export OPENSSL OPENSSL_DEBUG_MEMORY; \
527 $(PERL) tools/c_rehash certs) && \
528 touch rehash.time; \
529 fi
d02b48c6 530
58964a49 531test: tests
d02b48c6 532
73bfb9ad 533tests: rehash
bb8f3c58 534 @(cd test && echo "testing..." && \
a24b7eeb 535 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
62d27939 536 util/opensslwrap.sh version -a
d02b48c6 537
d7f0ab5f
UM
538report:
539 @$(PERL) util/selftest.pl
540
d02b48c6 541depend:
a24b7eeb 542 @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
d02b48c6
RE
543
544lint:
a24b7eeb 545 @set -e; target=lint; $(RECURSIVE_BUILD_CMD)
d02b48c6
RE
546
547tags:
a273a282
BL
548 rm -f TAGS
549 find . -name '[^.]*.[ch]' | xargs etags -a
d02b48c6
RE
550
551errors:
f6485909 552 $(PERL) util/mkerr.pl -recurse -write
506fec1a 553 (cd engines; $(MAKE) PERL=$(PERL) errors)
fbeaa3c4 554 $(PERL) util/ck_errf.pl */*.c */*/*.c
d02b48c6 555
e41c8d6a 556stacks:
f6485909 557 $(PERL) util/mkstack.pl -write
e41c8d6a 558
7740a1c6 559util/libeay.num::
f6485909 560 $(PERL) util/mkdef.pl crypto update
7740a1c6
BM
561
562util/ssleay.num::
f6485909 563 $(PERL) util/mkdef.pl ssl update
7740a1c6 564
1d00800e 565crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
f6485909 566 $(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
0357422d 567crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
f6485909 568 $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
49e747e6 569
2faa930b
RL
570apps/openssl-vms.cnf: apps/openssl.cnf
571 $(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
572
d8e64093
RL
573crypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
574 $(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
575
576
62c419d6 577TABLE: Configure
2330e18b 578 (echo 'Output of `Configure TABLE'"':"; \
f6485909 579 $(PERL) Configure TABLE) > TABLE
7740a1c6 580
d8e64093 581update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
7740a1c6 582
f9de8446
LJ
583# Build distribution tar-file. As the list of files returned by "find" is
584# pretty long, on several platforms a "too many arguments" error or similar
585# would occur. Therefore the list of files is temporarily stored into a file
586# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
587# tar does not support the --files-from option.
d02b48c6 588tar:
756b9a00
LJ
589 find . -type d -print | xargs chmod 755
590 find . -type f -print | xargs chmod a+r
591 find . -type f -perm -0100 -print | xargs chmod a+x
f9de8446
LJ
592 find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
593 $(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
5a061129 594 tardy --user_number=0 --user_name=openssl \
9ce5db45
RE
595 --group_number=0 --group_name=openssl \
596 --prefix=openssl-$(VERSION) - |\
651d0aff 597 gzip --best >../$(TARFILE).gz; \
f9de8446 598 rm -f ../$(TARFILE).list; \
651d0aff 599 ls -l ../$(TARFILE).gz
d02b48c6 600
41d2a336
RL
601tar-snap:
602 @$(TAR) $(TARFLAGS) -cvf - \
3a7cef3e 603 `find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \! -name '*test' \! -name '.#*' \! -name '*~' | sort` |\
41d2a336
RL
604 tardy --user_number=0 --user_name=openssl \
605 --group_number=0 --group_name=openssl \
606 --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
607 ls -l ../$(TARFILE)
608
58964a49 609dist:
99aab161 610 $(PERL) Configure dist
d02b48c6
RE
611 @$(MAKE) dist_pem_h
612 @$(MAKE) SDIRS='${SDIRS}' clean
870d3d55 613 @$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
d02b48c6
RE
614
615dist_pem_h:
a24b7eeb 616 (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
d02b48c6 617
28a80034
RL
618install: all install_docs install_sw
619
620install_sw:
f0588887 621 @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
985b5ee7
DSH
622 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
623 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
624 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
f0588887
BM
625 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
626 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
627 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
8d472bdd 628 $(INSTALL_PREFIX)$(OPENSSLDIR)/private
a2ac429d 629 @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
2a4a0a34
BM
630 do \
631 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
632 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
633 done;
a24b7eeb 634 @set -e; target=install; $(RECURSIVE_BUILD_CMD)
cfd06a62 635 @set -e; for i in $(LIBS) ;\
d02b48c6 636 do \
b436a982
RL
637 if [ -f "$$i" ]; then \
638 ( echo installing $$i; \
985b5ee7
DSH
639 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
640 $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
641 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
642 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
2c975b50
LJ
643 fi; \
644 done;
cfd06a62 645 @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
a22fb399
RL
646 tmp="$(SHARED_LIBS)"; \
647 for i in $${tmp:-x}; \
648 do \
1fe198b6 649 if [ -f "$$i" -o -f "$$i.a" ]; then \
a22fb399 650 ( echo installing $$i; \
49e04548 651 if [ "$(PLATFORM)" != "Cygwin" ]; then \
985b5ee7
DSH
652 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
653 chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
654 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
1fe198b6 655 else \
15da07d4 656 c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
7104c376
RL
657 cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
658 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
30c08f2e 659 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
985b5ee7
DSH
660 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
661 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
662 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
1fe198b6 663 fi ); \
2c975b50 664 fi; \
a22fb399
RL
665 done; \
666 ( here="`pwd`"; \
985b5ee7 667 cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
4c3a2d64 668 $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
e68cb95d
RL
669 if [ "$(INSTALLTOP)" != "/usr" ]; then \
670 echo 'OpenSSL shared libraries have been installed in:'; \
671 echo ' $(INSTALLTOP)'; \
672 echo ''; \
c0cc5c30 673 sed -e '1,/^$$/d' doc/openssl-shared.txt; \
e68cb95d 674 fi; \
a22fb399 675 fi
985b5ee7
DSH
676 cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
677 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
678 cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
679 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
680 cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
681 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
e6e7b5f3
BM
682
683install_docs:
684 @$(PERL) $(TOP)/util/mkdir-p.pl \
e1c55191
UM
685 $(INSTALL_PREFIX)$(MANDIR)/man1 \
686 $(INSTALL_PREFIX)$(MANDIR)/man3 \
687 $(INSTALL_PREFIX)$(MANDIR)/man5 \
688 $(INSTALL_PREFIX)$(MANDIR)/man7
82c27734 689 @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
ec9f67f6
RL
690 here="`pwd`"; \
691 filecase=; \
94c1672e 692 if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
ec9f67f6
RL
693 filecase=-i; \
694 fi; \
cfd06a62 695 set -e; for i in doc/apps/*.pod; do \
c6ce792f 696 fn=`basename $$i .pod`; \
401ee37a 697 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
1cc087fe 698 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
d13363af 699 (cd `$(PERL) util/dirname.pl $$i`; \
623e9e66 700 sh -c "$$pod2man \
2962243d
RL
701 --section=$$sec --center=OpenSSL \
702 --release=$(VERSION) `basename $$i`") \
1cc087fe 703 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
ec9f67f6 704 $(PERL) util/extract-names.pl < $$i | \
a4ae7466
RL
705 (grep -v $$filecase "^$$fn\$$"; true) | \
706 (grep -v "[ ]"; true) | \
ec9f67f6
RL
707 (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
708 while read n; do \
49096719 709 $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
ec9f67f6 710 done); \
f6f99618 711 done; \
cfd06a62 712 set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
c6ce792f 713 fn=`basename $$i .pod`; \
401ee37a 714 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
1cc087fe 715 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
d13363af 716 (cd `$(PERL) util/dirname.pl $$i`; \
623e9e66 717 sh -c "$$pod2man \
2962243d
RL
718 --section=$$sec --center=OpenSSL \
719 --release=$(VERSION) `basename $$i`") \
1cc087fe 720 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
ec9f67f6 721 $(PERL) util/extract-names.pl < $$i | \
a4ae7466
RL
722 (grep -v $$filecase "^$$fn\$$"; true) | \
723 (grep -v "[ ]"; true) | \
ec9f67f6
RL
724 (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
725 while read n; do \
49096719 726 $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
ec9f67f6 727 done); \
c6ce792f 728 done
d02b48c6
RE
729
730# DO NOT DELETE THIS LINE -- make depend depends on it.