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