]> git.ipfire.org Git - thirdparty/openssl.git/blame - Makefile.org
Make sure OPENSSL_cleanse checks for NULL
[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
99aab161 68RANLIB= ranlib
cbfb39d1 69NM= nm
99aab161 70PERL= perl
2dbb3ccd 71TAR= tar
46ebd9e3 72TARFLAGS= --no-recursion --record-size=10240
cf1b7d96 73MAKEDEPPROG=makedepend
d5ec7d66 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
0ddd3ea2 92AES_ENC= 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=
ed26604a 100WP_ASM_OBJ=
6a8517f2 101CMLL_ENC=
886657a6
AP
102MODES_ASM_OBJ=
103ENGINES_ASM_OBJ=
fa8e921f 104PERLASM_SCHEME=
58964a49 105
f9b3bff6
RL
106# KRB5 stuff
107KRB5_INCLUDES=
c1269c81 108LIBKRB5=
f9b3bff6 109
ad2695b1
DSH
110# Zlib stuff
111ZLIB_INCLUDE=
112LIBZLIB=
113
7207eca1
DSH
114# TOP level FIPS install directory.
115FIPSDIR=
116
117# This is the location of fipscanister.o and friends.
118# The FIPS module build will place it $(INSTALLTOP)/lib
119# but since $(INSTALLTOP) can only take the default value
120# when the module is built it will be in /usr/local/ssl/lib
121# $(INSTALLTOP) for this build may be different so hard
122# code the path.
123
124FIPSLIBDIR=
125
126# The location of the library which contains fipscanister.o
127# normally it will be libcrypto unless fipsdso is set in which
128# case it will be libfips. If not compiling in FIPS mode at all
129# this is empty making it a useful test for a FIPS compile.
130
131FIPSCANLIB=
132
133# Shared library base address. Currently only used on Windows.
134#
135
136BASEADDR=
137
506fec1a 138DIRS= crypto ssl engines apps test tools
d07692cd 139ENGDIRS= ccgost
0973910f
UM
140SHLIBDIRS= crypto ssl
141
d02b48c6
RE
142# dirs in crypto to build
143SDIRS= \
d87b79bf 144 objects \
d1593e6b 145 md2 md4 md5 sha mdc2 hmac ripemd whrlpool \
5d48a66a 146 des aes rc2 rc4 rc5 idea bf cast camellia seed modes \
67ea999d 147 bn ec rsa dsa ecdsa dh ecdh dso engine \
d87b79bf 148 buffer bio stack lhash rand err \
a5db6fa5 149 evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
260d08b8 150 cms pqueue ts jpake srp store cmac
02c31fa4
AP
151# keep in mind that the above list is adjusted by ./Configure
152# according to no-xxx arguments...
d02b48c6 153
f777408f
RL
154# tests to perform. "alltests" is a special word indicating that all tests
155# should be performed.
156TESTS = alltests
157
42ba5d23 158MAKEFILE= Makefile
d02b48c6 159
e1c55191 160MANDIR=$(OPENSSLDIR)/man
d02b48c6
RE
161MAN1=1
162MAN3=3
1cc087fe 163MANSUFFIX=
60cdb821
UM
164HTMLSUFFIX=html
165HTMLDIR=$(OPENSSLDIR)/html
d02b48c6
RE
166SHELL=/bin/sh
167
58964a49 168TOP= .
d02b48c6 169ONEDIRS=out tmp
7d7d2cbc 170EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS
58964a49 171WDIRS= windows
b436a982 172LIBS= libcrypto.a libssl.a
a22fb399
RL
173SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
174SHARED_SSL=libssl$(SHLIB_EXT)
175SHARED_LIBS=
176SHARED_LIBS_LINK_EXTS=
a5595fde 177SHARED_LDFLAGS=
58964a49
RE
178
179GENERAL= Makefile
9ce5db45 180BASENAME= openssl
58964a49
RE
181NAME= $(BASENAME)-$(VERSION)
182TARFILE= $(NAME).tar
183WTARFILE= $(NAME)-win.tar
cf1b7d96 184EXHEADER= e_os2.h
58964a49 185HEADER= e_os.h
d02b48c6 186
ee2d14be 187all: Makefile build_all
d02b48c6 188
02c31fa4 189# as we stick to -e, CLEARENV ensures that local variables in lower
a41b0aad
AP
190# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
191# shell, which [annoyingly enough] terminates unset with error if VAR
192# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
193# which terminates unset with error if no variable was present:-(
194CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
02c31fa4
AP
195 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES} \
196 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC} \
197 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
198 $${EXHEADER+EXHEADER} $${HEADER+HEADER} \
199 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS} \
200 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \
d36e0ee4 201 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
2f3c39bc 202 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \
02c31fa4
AP
203 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
204
a370537b
AP
205BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
206 CC='$(CC)' CFLAG='$(CFLAG)' \
207 AS='$(CC)' ASFLAG='$(CFLAG) -c' \
208 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
9b1f24df 209 CROSS_COMPILE='$(CROSS_COMPILE)' \
d07692cd 210 PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \
d5ec7d66 211 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)' \
a370537b
AP
212 INSTALL_PREFIX='$(INSTALL_PREFIX)' \
213 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \
38437fa1 214 LIBDIR='$(LIBDIR)' \
a370537b
AP
215 MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
216 DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)' \
217 MAKEDEPPROG='$(MAKEDEPPROG)' \
218 SHARED_LDFLAGS='$(SHARED_LDFLAGS)' \
219 KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)' \
8681c66e 220 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \
a370537b
AP
221 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
222 SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
223 PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)' \
224 CPUID_OBJ='$(CPUID_OBJ)' \
225 BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' \
226 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
227 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)' \
228 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)' \
229 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)' \
230 MD5_ASM_OBJ='$(MD5_ASM_OBJ)' \
231 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)' \
232 WP_ASM_OBJ='$(WP_ASM_OBJ)' \
886657a6
AP
233 MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
234 ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
a370537b 235 PERLASM_SCHEME='$(PERLASM_SCHEME)' \
7207eca1
DSH
236 FIPSLIBDIR='${FIPSLIBDIR}' \
237 FIPSDIR='${FIPSDIR}' \
238 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \
02c31fa4
AP
239 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
240# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
241# which in turn eliminates ambiguities in variable treatment with -e.
d0590fe6 242
b480283c
RL
243# BUILD_CMD is a generic macro to build a given target in a given
244# subdirectory. The target must be given through the shell variable
245# `target' and the subdirectory to build in must be given through `dir'.
246# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
247# BUILD_ONE_CMD instead.
248#
249# BUILD_ONE_CMD is a macro to build a given target in a given
250# subdirectory if that subdirectory is part of $(DIRS). It requires
251# exactly the same shell variables as BUILD_CMD.
252#
253# RECURSIVE_BUILD_CMD is a macro to build a given target in all
254# subdirectories defined in $(DIRS). It requires that the target
255# is given through the shell variable `target'.
02c31fa4
AP
256BUILD_CMD= if [ -d "$$dir" ]; then \
257 ( cd $$dir && echo "making $$target in $$dir..." && \
258 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
259 ) || exit 1; \
260 fi
261RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
f5ce5e14 262BUILD_ONE_CMD=\
b3b201b6 263 if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
f5ce5e14
RL
264 $(BUILD_CMD); \
265 fi
88c80b3e 266
734540f8 267reflect:
02c31fa4 268 @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
734540f8 269
4c82171a 270sub_all: build_all
83d66209 271
88c80b3e
RL
272build_all: build_libs build_apps build_tests build_tools
273
ee2d14be
RL
274build_libs: build_libcrypto build_libssl openssl.pc
275
276build_libcrypto: build_crypto build_engines libcrypto.pc
277build_libssl: build_ssl libssl.pc
88c80b3e
RL
278
279build_crypto:
f5ce5e14 280 @dir=crypto; target=all; $(BUILD_ONE_CMD)
83d66209 281build_ssl: build_crypto
f5ce5e14 282 @dir=ssl; target=all; $(BUILD_ONE_CMD)
83d66209 283build_engines: build_crypto
f5ce5e14 284 @dir=engines; target=all; $(BUILD_ONE_CMD)
83d66209 285build_apps: build_libs
f5ce5e14 286 @dir=apps; target=all; $(BUILD_ONE_CMD)
83d66209 287build_tests: build_libs
f5ce5e14 288 @dir=test; target=all; $(BUILD_ONE_CMD)
83d66209 289build_tools: build_libs
f5ce5e14 290 @dir=tools; target=all; $(BUILD_ONE_CMD)
ba5477eb
RL
291
292all_testapps: build_libs build_testapps
293build_testapps:
f5ce5e14 294 @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
b436a982 295
a168ec1d 296fips_premain_dso$(EXE_EXT): libcrypto.a
8bfd0ae4 297 [ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
a168ec1d
DSH
298 -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ \
299 $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
300 libcrypto.a $(EX_LIBS)
301
302libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
f4316c36 303 @if [ "$(SHLIB_TARGET)" != "" ]; then \
a168ec1d
DSH
304 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
305 FIPSLD_LIBCRYPTO=libcrypto.a ; \
4a18d5c8 306 FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
a168ec1d
DSH
307 export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
308 fi; \
5b56fec6
AP
309 $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared && \
310 (touch -c fips_premain_dso$(EXE_EXT) || :); \
f4316c36
RL
311 else \
312 echo "There's no support for shared libraries on this platform" >&2; \
d0590fe6 313 exit 1; \
f4316c36 314 fi
0f180d1d 315
a22fb399 316libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
f4316c36 317 @if [ "$(SHLIB_TARGET)" != "" ]; then \
5ddcb866 318 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
f4316c36
RL
319 else \
320 echo "There's no support for shared libraries on this platform" >&2; \
d0590fe6 321 exit 1; \
f4316c36 322 fi
b436a982
RL
323
324clean-shared:
cfd06a62 325 @set -e; for i in $(SHLIBDIRS); do \
a22fb399
RL
326 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
327 tmp="$(SHARED_LIBS_LINK_EXTS)"; \
328 for j in $${tmp:-x}; do \
329 ( set -x; rm -f lib$$i$$j ); \
330 done; \
331 fi; \
332 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
49e04548 333 if [ "$(PLATFORM)" = "Cygwin" ]; then \
1fe198b6
RL
334 ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
335 fi; \
b436a982 336 done
d02b48c6 337
a22fb399 338link-shared:
a370537b 339 @ set -e; for i in $(SHLIBDIRS); do \
755c5b33 340 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
a370537b
AP
341 LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
342 LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
30afcc07 343 symlink.$(SHLIB_TARGET); \
6b86bad5 344 libs="$$libs -l$$i"; \
0fd44e2d
RL
345 done
346
30afcc07
RL
347build-shared: do_$(SHLIB_TARGET) link-shared
348
349do_$(SHLIB_TARGET):
a370537b 350 @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
757e9886 351 if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
c1269c81
RL
352 libs="$(LIBKRB5) $$libs"; \
353 fi; \
02c31fa4 354 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
a370537b
AP
355 LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
356 LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
30afcc07
RL
357 LIBDEPS="$$libs $(EX_LIBS)" \
358 link_a.$(SHLIB_TARGET); \
c1269c81 359 libs="-l$$i $$libs"; \
a3fffd64
RL
360 done
361
0962fbbf
RL
362libcrypto.pc: Makefile
363 @ ( echo 'prefix=$(INSTALLTOP)'; \
364 echo 'exec_prefix=$${prefix}'; \
d5ec7d66 365 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
0962fbbf
RL
366 echo 'includedir=$${prefix}/include'; \
367 echo ''; \
368 echo 'Name: OpenSSL-libcrypto'; \
369 echo 'Description: OpenSSL cryptography library'; \
370 echo 'Version: '$(VERSION); \
371 echo 'Requires: '; \
bf493e8d
DSH
372 echo 'Libs: -L$${libdir} -lcrypto'; \
373 echo 'Libs.private: $(EX_LIBS)'; \
0962fbbf
RL
374 echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
375
376libssl.pc: Makefile
377 @ ( echo 'prefix=$(INSTALLTOP)'; \
378 echo 'exec_prefix=$${prefix}'; \
d5ec7d66 379 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
0962fbbf
RL
380 echo 'includedir=$${prefix}/include'; \
381 echo ''; \
382 echo 'Name: OpenSSL'; \
383 echo 'Description: Secure Sockets Layer and cryptography libraries'; \
384 echo 'Version: '$(VERSION); \
385 echo 'Requires: '; \
bf493e8d
DSH
386 echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
387 echo 'Libs.private: $(EX_LIBS)'; \
0962fbbf
RL
388 echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
389
42ba5d23 390openssl.pc: Makefile
56824b96
RL
391 @ ( echo 'prefix=$(INSTALLTOP)'; \
392 echo 'exec_prefix=$${prefix}'; \
d5ec7d66 393 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
56824b96
RL
394 echo 'includedir=$${prefix}/include'; \
395 echo ''; \
396 echo 'Name: OpenSSL'; \
397 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
398 echo 'Version: '$(VERSION); \
399 echo 'Requires: '; \
bf493e8d
DSH
400 echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
401 echo 'Libs.private: $(EX_LIBS)'; \
49be7042 402 echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
56824b96 403
c7199e62
BL
404Makefile: Makefile.org Configure config
405 @echo "Makefile is older than Makefile.org, Configure or config."
49b81422 406 @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
9535d202
BL
407 @false
408
dfeab068 409libclean:
886657a6 410 rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
dfeab068 411
7841edc9
RL
412clean: libclean
413 rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
02c31fa4
AP
414 @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
415 rm -f $(LIBS)
0962fbbf 416 rm -f openssl.pc libssl.pc libcrypto.pc
7841edc9 417 rm -f speed.* .pure
bb8f3c58 418 rm -f $(TARFILE)
cfd06a62 419 @set -e; for i in $(ONEDIRS) ;\
d02b48c6 420 do \
bb8f3c58 421 rm -fr $$i/*; \
d02b48c6
RE
422 done
423
424makefile.one: files
99aab161 425 $(PERL) util/mk1mf.pl >makefile.one; \
d02b48c6
RE
426 sh util/do_ms.sh
427
bacad008 428files:
42ba5d23 429 $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
02c31fa4 430 @set -e; target=files; $(RECURSIVE_BUILD_CMD)
d02b48c6
RE
431
432links:
6576774b 433 @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
41d2a336 434 @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
02c31fa4 435 @set -e; target=links; $(RECURSIVE_BUILD_CMD)
d02b48c6 436
1cc67fa8
RL
437gentests:
438 @(cd test && echo "generating dummy tests (if needed)..." && \
a370537b 439 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
1cc67fa8 440
d02b48c6 441dclean:
95553390 442 rm -rf *.bak include/openssl certs/.0
02c31fa4 443 @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
d02b48c6 444
e6e7b5f3 445rehash: rehash.time
cbfb39d1 446rehash.time: certs apps
9b1f24df 447 @if [ -z "$(CROSS_COMPILE)" ]; then \
cbfb39d1 448 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
6d0624ac 449 [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
cbfb39d1
AP
450 OPENSSL_DEBUG_MEMORY=on; \
451 export OPENSSL OPENSSL_DEBUG_MEMORY; \
5bb6d965 452 $(PERL) tools/c_rehash certs/demo) && \
cbfb39d1
AP
453 touch rehash.time; \
454 else :; fi
d02b48c6 455
58964a49 456test: tests
d02b48c6 457
73bfb9ad 458tests: rehash
bb8f3c58 459 @(cd test && echo "testing..." && \
c9a17781
DSH
460 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
461 OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
d02b48c6 462
d7f0ab5f
UM
463report:
464 @$(PERL) util/selftest.pl
465
f460f050 466update: errors stacks util/libeay.num util/ssleay.num TABLE
eb797fde
RL
467 @set -e; target=update; $(RECURSIVE_BUILD_CMD)
468
d02b48c6 469depend:
02c31fa4 470 @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
d02b48c6
RE
471
472lint:
02c31fa4 473 @set -e; target=lint; $(RECURSIVE_BUILD_CMD)
d02b48c6
RE
474
475tags:
a273a282
BL
476 rm -f TAGS
477 find . -name '[^.]*.[ch]' | xargs etags -a
d02b48c6
RE
478
479errors:
be60a3fe 480 $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
f6485909 481 $(PERL) util/mkerr.pl -recurse -write
506fec1a 482 (cd engines; $(MAKE) PERL=$(PERL) errors)
d02b48c6 483
a6fbcb42
DSH
484stacks:
485 $(PERL) util/mkstack.pl -write
486
7740a1c6 487util/libeay.num::
f6485909 488 $(PERL) util/mkdef.pl crypto update
7740a1c6
BM
489
490util/ssleay.num::
f6485909 491 $(PERL) util/mkdef.pl ssl update
7740a1c6 492
62c419d6 493TABLE: Configure
2330e18b 494 (echo 'Output of `Configure TABLE'"':"; \
f6485909 495 $(PERL) Configure TABLE) > TABLE
7740a1c6 496
f9de8446
LJ
497# Build distribution tar-file. As the list of files returned by "find" is
498# pretty long, on several platforms a "too many arguments" error or similar
499# would occur. Therefore the list of files is temporarily stored into a file
500# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
501# tar does not support the --files-from option.
be856204 502TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list \
2035e2db 503 --owner openssl:0 --group openssl:0 \
be856204
RL
504 --transform 's|^|openssl-$(VERSION)/|' \
505 -cvf -
506
507../$(TARFILE).list:
508 find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \
509 \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \
510 \! -name '*test' \! -name '.#*' \! -name '*~' \
511 | sort > ../$(TARFILE).list
512
513tar: ../$(TARFILE).list
756b9a00
LJ
514 find . -type d -print | xargs chmod 755
515 find . -type f -print | xargs chmod a+r
516 find . -type f -perm -0100 -print | xargs chmod a+x
be856204
RL
517 $(TAR_COMMAND) | gzip --best >../$(TARFILE).gz
518 rm -f ../$(TARFILE).list
651d0aff 519 ls -l ../$(TARFILE).gz
d02b48c6 520
be856204
RL
521tar-snap: ../$(TARFILE).list
522 $(TAR_COMMAND) > ../$(TARFILE)
523 rm -f ../$(TARFILE).list
41d2a336
RL
524 ls -l ../$(TARFILE)
525
58964a49 526dist:
99aab161 527 $(PERL) Configure dist
d02b48c6 528 @$(MAKE) dist_pem_h
a370537b
AP
529 @$(MAKE) SDIRS='$(SDIRS)' clean
530 @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
d02b48c6
RE
531
532dist_pem_h:
02c31fa4 533 (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
d02b48c6 534
28a80034
RL
535install: all install_docs install_sw
536
537install_sw:
f0588887 538 @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
d5ec7d66
DSH
539 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
540 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
541 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
f0588887
BM
542 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
543 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
544 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
8d472bdd 545 $(INSTALL_PREFIX)$(OPENSSLDIR)/private
a2ac429d 546 @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
2a4a0a34
BM
547 do \
548 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
549 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
550 done;
02c31fa4 551 @set -e; target=install; $(RECURSIVE_BUILD_CMD)
886657a6 552 @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
d02b48c6 553 do \
b436a982
RL
554 if [ -f "$$i" ]; then \
555 ( echo installing $$i; \
d5ec7d66
DSH
556 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
557 $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
558 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
559 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
2c975b50
LJ
560 fi; \
561 done;
cfd06a62 562 @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
a22fb399
RL
563 tmp="$(SHARED_LIBS)"; \
564 for i in $${tmp:-x}; \
565 do \
1fe198b6 566 if [ -f "$$i" -o -f "$$i.a" ]; then \
a22fb399 567 ( echo installing $$i; \
49e04548 568 if [ "$(PLATFORM)" != "Cygwin" ]; then \
d5ec7d66
DSH
569 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
570 chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
571 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
1fe198b6 572 else \
447aa490 573 c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
7104c376
RL
574 cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
575 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
30c08f2e 576 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
d5ec7d66
DSH
577 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
578 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
579 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
1fe198b6 580 fi ); \
4c1a6e00
LJ
581 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
582 ( case $$i in \
583 *crypto*) i=libeay32.dll;; \
584 *ssl*) i=ssleay32.dll;; \
585 esac; \
586 echo installing $$i; \
587 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
588 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
589 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
590 fi; \
2c975b50 591 fi; \
a22fb399
RL
592 done; \
593 ( here="`pwd`"; \
a1e11652 594 cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
4c3a2d64 595 $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
e68cb95d
RL
596 if [ "$(INSTALLTOP)" != "/usr" ]; then \
597 echo 'OpenSSL shared libraries have been installed in:'; \
598 echo ' $(INSTALLTOP)'; \
599 echo ''; \
c0cc5c30 600 sed -e '1,/^$$/d' doc/openssl-shared.txt; \
e68cb95d 601 fi; \
a22fb399 602 fi
d5ec7d66
DSH
603 cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
604 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
605 cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
606 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
607 cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
608 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
e6e7b5f3 609
60cdb821
UM
610install_html_docs:
611 here="`pwd`"; \
612 for subdir in apps crypto ssl; do \
613 mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
614 for i in doc/$$subdir/*.pod; do \
615 fn=`basename $$i .pod`; \
616 echo "installing html/$$fn.$(HTMLSUFFIX)"; \
617 cat $$i \
618 | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
619 | pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
620 | sed -r 's/<!DOCTYPE.*//g' \
621 > $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
622 $(PERL) util/extract-names.pl < $$i | \
623 grep -v $$filecase "^$$fn\$$" | \
624 (cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
625 while read n; do \
69a0034e 626 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
60cdb821
UM
627 done); \
628 done; \
629 done
630
e6e7b5f3
BM
631install_docs:
632 @$(PERL) $(TOP)/util/mkdir-p.pl \
e1c55191
UM
633 $(INSTALL_PREFIX)$(MANDIR)/man1 \
634 $(INSTALL_PREFIX)$(MANDIR)/man3 \
635 $(INSTALL_PREFIX)$(MANDIR)/man5 \
636 $(INSTALL_PREFIX)$(MANDIR)/man7
6d4943e8 637 @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
ec9f67f6
RL
638 here="`pwd`"; \
639 filecase=; \
94c1672e 640 if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
ec9f67f6
RL
641 filecase=-i; \
642 fi; \
cfd06a62 643 set -e; for i in doc/apps/*.pod; do \
c6ce792f 644 fn=`basename $$i .pod`; \
401ee37a 645 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
1cc087fe 646 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
d13363af 647 (cd `$(PERL) util/dirname.pl $$i`; \
623e9e66 648 sh -c "$$pod2man \
2962243d
RL
649 --section=$$sec --center=OpenSSL \
650 --release=$(VERSION) `basename $$i`") \
1cc087fe 651 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
ec9f67f6 652 $(PERL) util/extract-names.pl < $$i | \
f6098f2d
RL
653 (grep -v $$filecase "^$$fn\$$"; true) | \
654 (grep -v "[ ]"; true) | \
ec9f67f6
RL
655 (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
656 while read n; do \
69a0034e 657 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
ec9f67f6 658 done); \
f6f99618 659 done; \
cfd06a62 660 set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
c6ce792f 661 fn=`basename $$i .pod`; \
401ee37a 662 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
1cc087fe 663 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
d13363af 664 (cd `$(PERL) util/dirname.pl $$i`; \
623e9e66 665 sh -c "$$pod2man \
2962243d
RL
666 --section=$$sec --center=OpenSSL \
667 --release=$(VERSION) `basename $$i`") \
1cc087fe 668 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
ec9f67f6 669 $(PERL) util/extract-names.pl < $$i | \
f6098f2d
RL
670 (grep -v $$filecase "^$$fn\$$"; true) | \
671 (grep -v "[ ]"; true) | \
ec9f67f6
RL
672 (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
673 while read n; do \
69a0034e 674 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
ec9f67f6 675 done); \
c6ce792f 676 done
d02b48c6
RE
677
678# DO NOT DELETE THIS LINE -- make depend depends on it.