Makefile revision 261037
133965Sjdp### Generated automatically from Makefile.org by Configure.
2218822Sdim
3218822Sdim##
433965Sjdp## Makefile for OpenSSL
5130561Sobrien##
6130561Sobrien
7130561SobrienVERSION=1.0.1f
8130561SobrienMAJOR=1
933965SjdpMINOR=0.1
10130561SobrienSHLIB_VERSION_NUMBER=1.0.0
11130561SobrienSHLIB_VERSION_HISTORY=
12130561SobrienSHLIB_MAJOR=1
13130561SobrienSHLIB_MINOR=0.0
1433965SjdpSHLIB_EXT=
15130561SobrienPLATFORM=dist
16130561SobrienOPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-store no-zlib no-zlib-dynamic static-engine
17218822SdimCONFIGURE_ARGS=dist
1833965SjdpSHLIB_TARGET=
19218822Sdim
20218822Sdim# HERE indicates where this Makefile lives.  This can be used to indicate
21130561Sobrien# where sub-Makefiles are expected to be.  Currently has very limited usage,
22130561Sobrien# and should probably not be bothered with at all.
23130561SobrienHERE=.
24130561Sobrien
25130561Sobrien# INSTALL_PREFIX is for package builders so that they can configure
26130561Sobrien# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
27130561Sobrien# Normally it is left empty.
28130561SobrienINSTALL_PREFIX=
29130561SobrienINSTALLTOP=/usr/local/ssl
30130561Sobrien
31130561Sobrien# Do not edit this manually. Use Configure --openssldir=DIR do change this!
32130561SobrienOPENSSLDIR=/usr/local/ssl
33130561Sobrien
34130561Sobrien# NO_IDEA - Define to build without the IDEA algorithm
35130561Sobrien# NO_RC4  - Define to build without the RC4 algorithm
36130561Sobrien# NO_RC2  - Define to build without the RC2 algorithm
37130561Sobrien# THREADS - Define when building with threads, you will probably also need any
38130561Sobrien#           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
39130561Sobrien# TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
40130561Sobrien# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
41130561Sobrien# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
42130561Sobrien# DEVRANDOM - Give this the value of the 'random device' if your OS supports
43130561Sobrien#           one.  32 bytes will be read from this when the random
44130561Sobrien#           number generator is initalised.
45130561Sobrien# SSL_FORBID_ENULL - define if you want the server to be not able to use the
46130561Sobrien#           NULL encryption ciphers.
47130561Sobrien#
48130561Sobrien# LOCK_DEBUG - turns on lots of lock debug output :-)
49130561Sobrien# REF_CHECK - turn on some xyz_free() assertions.
50130561Sobrien# REF_PRINT - prints some stuff on structure free.
51130561Sobrien# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
52130561Sobrien# MFUNC - Make all Malloc/Free/Realloc calls call
53130561Sobrien#       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
54130561Sobrien#       call application defined callbacks via CRYPTO_set_mem_functions()
55130561Sobrien# MD5_ASM needs to be defined to use the x86 assembler for MD5
56130561Sobrien# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
57130561Sobrien# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
58130561Sobrien# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
59130561Sobrien# equal 4.
60130561Sobrien# PKCS1_CHECK - pkcs1 tests.
61130561Sobrien
62130561SobrienCC= cc
63130561SobrienCFLAG= -O
64130561SobrienDEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE
65130561SobrienPEX_LIBS= 
66130561SobrienEX_LIBS= 
67130561SobrienEXE_EXT= 
68130561SobrienARFLAGS= 
69130561SobrienAR= ar $(ARFLAGS) r
70130561SobrienRANLIB= /usr/bin/ranlib
71130561SobrienNM= nm
72130561SobrienPERL= /usr/bin/perl
73130561SobrienTAR= tar
74130561SobrienTARFLAGS= --no-recursion --record-size=10240
75130561SobrienMAKEDEPPROG=makedepend
76130561SobrienLIBDIR=lib
77218822Sdim
78218822Sdim# We let the C compiler driver to take care of .s files. This is done in
79218822Sdim# order to be excused from maintaining a separate set of architecture
80218822Sdim# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
81218822Sdim# gcc, then the driver will automatically translate it to -xarch=v8plus
82218822Sdim# and pass it down to assembler.
83218822SdimAS=$(CC) -c
84218822SdimASFLAG=$(CFLAG)
85218822Sdim
86218822Sdim# For x86 assembler: Set PROCESSOR to 386 if you want to support
87218822Sdim# the 80386.
88218822SdimPROCESSOR= 
89218822Sdim
90218822Sdim# CPUID module collects small commonly used assembler snippets
91218822SdimCPUID_OBJ= mem_clr.o
92218822SdimBN_ASM= bn_asm.o
93130561SobrienDES_ENC= des_enc.o fcrypt_b.o
94130561SobrienAES_ENC= aes_core.o aes_cbc.o
9533965SjdpBF_ENC= bf_enc.o
96130561SobrienCAST_ENC= c_enc.o
97130561SobrienRC4_ENC= rc4_enc.o rc4_skey.o
98130561SobrienRC5_ENC= rc5_enc.o
99130561SobrienMD5_ASM_OBJ= 
100130561SobrienSHA1_ASM_OBJ= 
101130561SobrienRMD160_ASM_OBJ= 
102130561SobrienWP_ASM_OBJ= wp_block.o
103130561SobrienCMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o
104130561SobrienMODES_ASM_OBJ= 
105130561SobrienENGINES_ASM_OBJ= 
106130561SobrienPERLASM_SCHEME= 
107130561Sobrien
108130561Sobrien# KRB5 stuff
109130561SobrienKRB5_INCLUDES=
110130561SobrienLIBKRB5=
111130561Sobrien
112130561Sobrien# Zlib stuff
113130561SobrienZLIB_INCLUDE=
114130561SobrienLIBZLIB=
115130561Sobrien
116130561Sobrien# TOP level FIPS install directory.
117130561SobrienFIPSDIR=/usr/local/ssl/fips-2.0
118130561Sobrien
119130561Sobrien# This is the location of fipscanister.o and friends.
120130561Sobrien# The FIPS module build will place it $(INSTALLTOP)/lib
121130561Sobrien# but since $(INSTALLTOP) can only take the default value
122130561Sobrien# when the module is built it will be in /usr/local/ssl/lib
123130561Sobrien# $(INSTALLTOP) for this build may be different so hard
124130561Sobrien# code the path.
125130561Sobrien
126130561SobrienFIPSLIBDIR=
127218822Sdim
128218822Sdim# The location of the library which contains fipscanister.o
129218822Sdim# normally it will be libcrypto unless fipsdso is set in which
130218822Sdim# case it will be libfips. If not compiling in FIPS mode at all
131218822Sdim# this is empty making it a useful test for a FIPS compile.
132130561Sobrien
133130561SobrienFIPSCANLIB=
134130561Sobrien
135130561Sobrien# Shared library base address. Currently only used on Windows.
136130561Sobrien#
137130561Sobrien
138130561SobrienBASEADDR=0xFB00000
139130561Sobrien
140130561SobrienDIRS=   crypto ssl engines apps test tools
141130561SobrienENGDIRS= ccgost
142130561SobrienSHLIBDIRS= crypto ssl
143130561Sobrien
144130561Sobrien# dirs in crypto to build
145130561SobrienSDIRS=  \
146130561Sobrien	objects \
147130561Sobrien	md4 md5 sha mdc2 hmac ripemd whrlpool \
148130561Sobrien	des aes rc2 rc4 idea bf cast camellia seed modes \
149130561Sobrien	bn ec rsa dsa ecdsa dh ecdh dso engine \
150130561Sobrien	buffer bio stack lhash rand err \
151130561Sobrien	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
152130561Sobrien	cms pqueue ts srp cmac
153130561Sobrien# keep in mind that the above list is adjusted by ./Configure
154130561Sobrien# according to no-xxx arguments...
155130561Sobrien
156130561Sobrien# tests to perform.  "alltests" is a special word indicating that all tests
157130561Sobrien# should be performed.
158130561SobrienTESTS = alltests
159130561Sobrien
160130561SobrienMAKEFILE= Makefile
161130561Sobrien
162130561SobrienMANDIR=$(OPENSSLDIR)/man
163130561SobrienMAN1=1
164130561SobrienMAN3=3
165130561SobrienMANSUFFIX=
166130561SobrienHTMLSUFFIX=html
167130561SobrienHTMLDIR=$(OPENSSLDIR)/html
168130561SobrienSHELL=/bin/sh
169130561Sobrien
170130561SobrienTOP=    .
171130561SobrienONEDIRS=out tmp
172130561SobrienEDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
173130561SobrienWDIRS=  windows
174130561SobrienLIBS=   libcrypto.a libssl.a
175130561SobrienSHARED_CRYPTO=libcrypto$(SHLIB_EXT)
176130561SobrienSHARED_SSL=libssl$(SHLIB_EXT)
177130561SobrienSHARED_LIBS=
178130561SobrienSHARED_LIBS_LINK_EXTS=
179130561SobrienSHARED_LDFLAGS=
180130561Sobrien
181130561SobrienGENERAL=        Makefile
182130561SobrienBASENAME=       openssl
183130561SobrienNAME=           $(BASENAME)-$(VERSION)
184130561SobrienTARFILE=        $(NAME).tar
185130561SobrienWTARFILE=       $(NAME)-win.tar
186130561SobrienEXHEADER=       e_os2.h
187130561SobrienHEADER=         e_os.h
188130561Sobrien
189130561Sobrienall: Makefile build_all openssl.pc libssl.pc libcrypto.pc
190130561Sobrien
19133965Sjdp# as we stick to -e, CLEARENV ensures that local variables in lower
192130561Sobrien# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
193130561Sobrien# shell, which [annoyingly enough] terminates unset with error if VAR
194130561Sobrien# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
195130561Sobrien# which terminates unset with error if no variable was present:-(
196130561SobrienCLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
197130561Sobrien		$${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}	\
198130561Sobrien		$${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}		\
199130561Sobrien		$${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL}	\
20060484Sobrien		$${EXHEADER+EXHEADER} $${HEADER+HEADER}		\
201218822Sdim		$${GENERAL+GENERAL} $${CFLAGS+CFLAGS}		\
202218822Sdim		$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}		\
203218822Sdim		$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS}	\
204218822Sdim		$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}	\
205218822Sdim		$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
20660484Sobrien
207218822SdimBUILDENV=	PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
208218822Sdim		CC='$(CC)' CFLAG='$(CFLAG)' 			\
209218822Sdim		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
210218822Sdim		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
211218822Sdim		CROSS_COMPILE='$(CROSS_COMPILE)'	\
212218822Sdim		PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'		\
213218822Sdim		SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'	\
214218822Sdim		INSTALL_PREFIX='$(INSTALL_PREFIX)'		\
215218822Sdim		INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'	\
21660484Sobrien		LIBDIR='$(LIBDIR)'				\
217218822Sdim		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
21860484Sobrien		DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'	\
219218822Sdim		MAKEDEPPROG='$(MAKEDEPPROG)'			\
220218822Sdim		SHARED_LDFLAGS='$(SHARED_LDFLAGS)'		\
221218822Sdim		KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'	\
222218822Sdim		ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'	\
223130561Sobrien		EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'	\
224218822Sdim		SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)'	\
225218822Sdim		PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'	\
226218822Sdim		CPUID_OBJ='$(CPUID_OBJ)'			\
227218822Sdim		BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' 	\
228218822Sdim		AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'	\
229218822Sdim		BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'	\
230218822Sdim		RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'	\
231218822Sdim		SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'			\
232218822Sdim		MD5_ASM_OBJ='$(MD5_ASM_OBJ)'			\
233218822Sdim		RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'		\
234218822Sdim		WP_ASM_OBJ='$(WP_ASM_OBJ)'			\
235218822Sdim		MODES_ASM_OBJ='$(MODES_ASM_OBJ)'		\
236218822Sdim		ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)'		\
237218822Sdim		PERLASM_SCHEME='$(PERLASM_SCHEME)'		\
238218822Sdim		FIPSLIBDIR='${FIPSLIBDIR}'			\
239218822Sdim		FIPSDIR='${FIPSDIR}'				\
240218822Sdim		FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"	\
241218822Sdim		THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
242218822Sdim# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
243218822Sdim# which in turn eliminates ambiguities in variable treatment with -e.
244218822Sdim
245218822Sdim# BUILD_CMD is a generic macro to build a given target in a given
246218822Sdim# subdirectory.  The target must be given through the shell variable
247218822Sdim# `target' and the subdirectory to build in must be given through `dir'.
248218822Sdim# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
249218822Sdim# BUILD_ONE_CMD instead.
250218822Sdim#
251218822Sdim# BUILD_ONE_CMD is a macro to build a given target in a given
252218822Sdim# subdirectory if that subdirectory is part of $(DIRS).  It requires
253218822Sdim# exactly the same shell variables as BUILD_CMD.
254218822Sdim#
255218822Sdim# RECURSIVE_BUILD_CMD is a macro to build a given target in all
256218822Sdim# subdirectories defined in $(DIRS).  It requires that the target
257218822Sdim# is given through the shell variable `target'.
258218822SdimBUILD_CMD=  if [ -d "$$dir" ]; then \
259218822Sdim	    (	cd $$dir && echo "making $$target in $$dir..." && \
260218822Sdim		$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
261218822Sdim	    ) || exit 1; \
262218822Sdim	    fi
263218822SdimRECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
264218822SdimBUILD_ONE_CMD=\
265218822Sdim	if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
266218822Sdim		$(BUILD_CMD); \
267218822Sdim	fi
268218822Sdim
269218822Sdimreflect:
270218822Sdim	@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
271218822Sdim
272218822Sdimsub_all: build_all
273218822Sdimbuild_all: build_libs build_apps build_tests build_tools
274218822Sdim
275218822Sdimbuild_libs: build_crypto build_ssl build_engines
276218822Sdim
277218822Sdimbuild_crypto:
278218822Sdim	@dir=crypto; target=all; $(BUILD_ONE_CMD)
279218822Sdimbuild_ssl:
280218822Sdim	@dir=ssl; target=all; $(BUILD_ONE_CMD)
281218822Sdimbuild_engines:
282218822Sdim	@dir=engines; target=all; $(BUILD_ONE_CMD)
283218822Sdimbuild_apps:
284218822Sdim	@dir=apps; target=all; $(BUILD_ONE_CMD)
285218822Sdimbuild_tests:
286218822Sdim	@dir=test; target=all; $(BUILD_ONE_CMD)
287218822Sdimbuild_tools:
288218822Sdim	@dir=tools; target=all; $(BUILD_ONE_CMD)
289218822Sdim
290218822Sdimall_testapps: build_libs build_testapps
291218822Sdimbuild_testapps:
292218822Sdim	@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
293218822Sdim
294218822Sdimfips_premain_dso$(EXE_EXT): libcrypto.a
295218822Sdim	[ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
296218822Sdim		-DFINGERPRINT_PREMAIN_DSO_LOAD -o $@  \
297218822Sdim		$(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
298218822Sdim		libcrypto.a $(EX_LIBS)
299218822Sdim
300218822Sdimlibcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
301218822Sdim	@if [ "$(SHLIB_TARGET)" != "" ]; then \
302218822Sdim		if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
303218822Sdim			FIPSLD_LIBCRYPTO=libcrypto.a ; \
304218822Sdim			FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
305218822Sdim			export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
306218822Sdim		fi; \
307218822Sdim		$(MAKE) -e SHLIBDIRS=crypto  CC=$${CC:-$(CC)} build-shared; \
308218822Sdim		touch -c fips_premain_dso$(EXE_EXT); \
309218822Sdim	else \
310218822Sdim		echo "There's no support for shared libraries on this platform" >&2; \
311218822Sdim		exit 1; \
312218822Sdim	fi
313218822Sdim
314218822Sdimlibssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
315218822Sdim	@if [ "$(SHLIB_TARGET)" != "" ]; then \
316218822Sdim		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
317218822Sdim	else \
318218822Sdim		echo "There's no support for shared libraries on this platform" >&2; \
319218822Sdim		exit 1; \
320218822Sdim	fi
321218822Sdim
322218822Sdimclean-shared:
323218822Sdim	@set -e; for i in $(SHLIBDIRS); do \
324218822Sdim		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
325218822Sdim			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
326218822Sdim			for j in $${tmp:-x}; do \
327218822Sdim				( set -x; rm -f lib$$i$$j ); \
328218822Sdim			done; \
329218822Sdim		fi; \
330218822Sdim		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
331218822Sdim		if [ "$(PLATFORM)" = "Cygwin" ]; then \
332218822Sdim			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
333218822Sdim		fi; \
334218822Sdim	done
335218822Sdim
336218822Sdimlink-shared:
337218822Sdim	@ set -e; for i in $(SHLIBDIRS); do \
338218822Sdim		$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
339218822Sdim			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
340218822Sdim			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
341218822Sdim			symlink.$(SHLIB_TARGET); \
342218822Sdim		libs="$$libs -l$$i"; \
343218822Sdim	done
344218822Sdim
345218822Sdimbuild-shared: do_$(SHLIB_TARGET) link-shared
346218822Sdim
347218822Sdimdo_$(SHLIB_TARGET):
348218822Sdim	@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
349218822Sdim		if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
350218822Sdim			libs="$(LIBKRB5) $$libs"; \
351218822Sdim		fi; \
352218822Sdim		$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
353218822Sdim			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
354218822Sdim			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
355218822Sdim			LIBDEPS="$$libs $(EX_LIBS)" \
356218822Sdim			link_a.$(SHLIB_TARGET); \
357218822Sdim		libs="-l$$i $$libs"; \
358218822Sdim	done
359218822Sdim
360218822Sdimlibcrypto.pc: Makefile
361218822Sdim	@ ( echo 'prefix=$(INSTALLTOP)'; \
362218822Sdim	    echo 'exec_prefix=$${prefix}'; \
363218822Sdim	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
364218822Sdim	    echo 'includedir=$${prefix}/include'; \
365218822Sdim	    echo ''; \
366218822Sdim	    echo 'Name: OpenSSL-libcrypto'; \
367218822Sdim	    echo 'Description: OpenSSL cryptography library'; \
368218822Sdim	    echo 'Version: '$(VERSION); \
369218822Sdim	    echo 'Requires: '; \
370130561Sobrien	    echo 'Libs: -L$${libdir} -lcrypto'; \
371130561Sobrien	    echo 'Libs.private: $(EX_LIBS)'; \
37233965Sjdp	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
37333965Sjdp
374218822Sdimlibssl.pc: Makefile
375218822Sdim	@ ( echo 'prefix=$(INSTALLTOP)'; \
37633965Sjdp	    echo 'exec_prefix=$${prefix}'; \
37733965Sjdp	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
37833965Sjdp	    echo 'includedir=$${prefix}/include'; \
37933965Sjdp	    echo ''; \
380130561Sobrien	    echo 'Name: OpenSSL'; \
381130561Sobrien	    echo 'Description: Secure Sockets Layer and cryptography libraries'; \
382218822Sdim	    echo 'Version: '$(VERSION); \
38333965Sjdp	    echo 'Requires: '; \
384218822Sdim	    echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
38533965Sjdp	    echo 'Libs.private: $(EX_LIBS)'; \
386218822Sdim	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
38733965Sjdp
388218822Sdimopenssl.pc: Makefile
38933965Sjdp	@ ( echo 'prefix=$(INSTALLTOP)'; \
390218822Sdim	    echo 'exec_prefix=$${prefix}'; \
39133965Sjdp	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
392218822Sdim	    echo 'includedir=$${prefix}/include'; \
39333965Sjdp	    echo ''; \
394218822Sdim	    echo 'Name: OpenSSL'; \
39533965Sjdp	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
396218822Sdim	    echo 'Version: '$(VERSION); \
39733965Sjdp	    echo 'Requires: '; \
398218822Sdim	    echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
39933965Sjdp	    echo 'Libs.private: $(EX_LIBS)'; \
400218822Sdim	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
40133965Sjdp
402218822SdimMakefile: Makefile.org Configure config
40333965Sjdp	@echo "Makefile is older than Makefile.org, Configure or config."
40460484Sobrien	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
40533965Sjdp	@false
40660484Sobrien
40733965Sjdplibclean:
40860484Sobrien	rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
40933965Sjdp
41060484Sobrienclean:	libclean
41133965Sjdp	rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
412130561Sobrien	@set -e; target=clean; $(RECURSIVE_BUILD_CMD)
413130561Sobrien	rm -f $(LIBS)
414218822Sdim	rm -f openssl.pc libssl.pc libcrypto.pc
41533965Sjdp	rm -f speed.* .pure
416218822Sdim	rm -f $(TARFILE)
41733965Sjdp	@set -e; for i in $(ONEDIRS) ;\
418218822Sdim	do \
41933965Sjdp	rm -fr $$i/*; \
420218822Sdim	done
42133965Sjdp
422218822Sdimmakefile.one: files
42333965Sjdp	$(PERL) util/mk1mf.pl >makefile.one; \
424218822Sdim	sh util/do_ms.sh
42533965Sjdp
426218822Sdimfiles:
42733965Sjdp	$(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
428218822Sdim	@set -e; target=files; $(RECURSIVE_BUILD_CMD)
42933965Sjdp
430218822Sdimlinks:
43133965Sjdp	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
432218822Sdim	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
43333965Sjdp	@set -e; target=links; $(RECURSIVE_BUILD_CMD)
434218822Sdim
43533965Sjdpgentests:
436218822Sdim	@(cd test && echo "generating dummy tests (if needed)..." && \
43733965Sjdp	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
438218822Sdim
43933965Sjdpdclean:
440218822Sdim	rm -rf *.bak include/openssl certs/.0
44133965Sjdp	@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
442218822Sdim
44333965Sjdprehash: rehash.time
444218822Sdimrehash.time: certs apps
44533965Sjdp	@if [ -z "$(CROSS_COMPILE)" ]; then \
446218822Sdim		(OPENSSL="`pwd`/util/opensslwrap.sh"; \
44733965Sjdp		[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
448218822Sdim		OPENSSL_DEBUG_MEMORY=on; \
44933965Sjdp		export OPENSSL OPENSSL_DEBUG_MEMORY; \
450218822Sdim		$(PERL) tools/c_rehash certs/demo) && \
45133965Sjdp		touch rehash.time; \
452218822Sdim	else :; fi
453130561Sobrien
454218822Sdimtest:   tests
45533965Sjdp
456218822Sdimtests: rehash
45733965Sjdp	@(cd test && echo "testing..." && \
458218822Sdim	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
45933965Sjdp	OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
460218822Sdim
46133965Sjdpreport:
462218822Sdim	@$(PERL) util/selftest.pl
46333965Sjdp
464218822Sdimdepend:
465218822Sdim	@set -e; target=depend; $(RECURSIVE_BUILD_CMD)
466218822Sdim
467218822Sdimlint:
46860484Sobrien	@set -e; target=lint; $(RECURSIVE_BUILD_CMD)
46933965Sjdp
47060484Sobrientags:
47133965Sjdp	rm -f TAGS
47260484Sobrien	find . -name '[^.]*.[ch]' | xargs etags -a
47338889Sjdp
474218822Sdimerrors:
47533965Sjdp	$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
476218822Sdim	$(PERL) util/mkerr.pl -recurse -write
47733965Sjdp	(cd engines; $(MAKE) PERL=$(PERL) errors)
478218822Sdim
47933965Sjdpstacks:
480218822Sdim	$(PERL) util/mkstack.pl -write
48133965Sjdp
482218822Sdimutil/libeay.num::
48333965Sjdp	$(PERL) util/mkdef.pl crypto update
484218822Sdim
48533965Sjdputil/ssleay.num::
486218822Sdim	$(PERL) util/mkdef.pl ssl update
48738889Sjdp
488218822Sdimcrypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
489218822Sdim	$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
49060484Sobriencrypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
49133965Sjdp	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
49260484Sobriencrypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xref.txt crypto/objects/obj_mac.num
49333965Sjdp	$(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objects/obj_xref.txt >crypto/objects/obj_xref.h
49460484Sobrien
49533965Sjdpapps/openssl-vms.cnf: apps/openssl.cnf
496218822Sdim	$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
49733965Sjdp
498218822Sdimcrypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
49933965Sjdp	$(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
500218822Sdim
50133965Sjdp
502218822SdimTABLE: Configure
50333965Sjdp	(echo 'Output of `Configure TABLE'"':"; \
504130561Sobrien	$(PERL) Configure TABLE) > TABLE
505130561Sobrien
506130561Sobrienupdate: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
50785815Sobrien
50833965Sjdp# Build distribution tar-file. As the list of files returned by "find" is
50985815Sobrien# pretty long, on several platforms a "too many arguments" error or similar
51033965Sjdp# would occur. Therefore the list of files is temporarily stored into a file
511218822Sdim# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
51233965Sjdp# tar does not support the --files-from option.
513218822Sdimtar:
51433965Sjdp	find . -type d -print | xargs chmod 755
515218822Sdim	find . -type f -print | xargs chmod a+r
51633965Sjdp	find . -type f -perm -0100 -print | xargs chmod a+x
51760484Sobrien	find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
51833965Sjdp	$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
51960484Sobrien	tardy --user_number=0  --user_name=openssl \
52033965Sjdp	      --group_number=0 --group_name=openssl \
52160484Sobrien	      --prefix=openssl-$(VERSION) - |\
52233965Sjdp	gzip --best >../$(TARFILE).gz; \
52360484Sobrien	rm -f ../$(TARFILE).list; \
52433965Sjdp	ls -l ../$(TARFILE).gz
52560484Sobrien
52633965Sjdptar-snap:
52760484Sobrien	@$(TAR) $(TARFLAGS) -cvf - \
52833965Sjdp		`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` |\
529130561Sobrien	tardy --user_number=0  --user_name=openssl \
530130561Sobrien	      --group_number=0 --group_name=openssl \
531130561Sobrien	      --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
53233965Sjdp	ls -l ../$(TARFILE)
533218822Sdim
53433965Sjdpdist:   
535218822Sdim	$(PERL) Configure dist
53633965Sjdp	@$(MAKE) dist_pem_h
537218822Sdim	@$(MAKE) SDIRS='$(SDIRS)' clean
53833965Sjdp	@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
53960484Sobrien
54033965Sjdpdist_pem_h:
54160484Sobrien	(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
54233965Sjdp
54360484Sobrieninstall: all install_docs install_sw
54433965Sjdp
54560484Sobrieninstall_sw:
54633965Sjdp	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
54760484Sobrien		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
54833965Sjdp		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
54960484Sobrien		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
55033965Sjdp		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
551130561Sobrien		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
552130561Sobrien		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
553130561Sobrien		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
55433965Sjdp	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
55560484Sobrien	do \
55633965Sjdp	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
557218822Sdim	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
55833965Sjdp	done;
559218822Sdim	@set -e; target=install; $(RECURSIVE_BUILD_CMD)
56033965Sjdp	@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
561218822Sdim	do \
56233965Sjdp		if [ -f "$$i" ]; then \
563218822Sdim		(       echo installing $$i; \
56433965Sjdp			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
565218822Sdim			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
56633965Sjdp			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
567218822Sdim			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
56833965Sjdp		fi; \
569218822Sdim	done;
57033965Sjdp	@set -e; if [ -n "$(SHARED_LIBS)" ]; then \
571218822Sdim		tmp="$(SHARED_LIBS)"; \
57233965Sjdp		for i in $${tmp:-x}; \
573218822Sdim		do \
57433965Sjdp			if [ -f "$$i" -o -f "$$i.a" ]; then \
575218822Sdim			(       echo installing $$i; \
57633965Sjdp				if [ "$(PLATFORM)" != "Cygwin" ]; then \
577218822Sdim					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
57833965Sjdp					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
579218822Sdim					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
58033965Sjdp				else \
581218822Sdim					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
58233965Sjdp					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
583218822Sdim					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
584218822Sdim					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
585218822Sdim					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
586218822Sdim					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
587218822Sdim					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
588218822Sdim				fi ); \
589218822Sdim				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
59033965Sjdp				(	case $$i in \
591218822Sdim						*crypto*) i=libeay32.dll;; \
59233965Sjdp						*ssl*)    i=ssleay32.dll;; \
593218822Sdim					esac; \
59433965Sjdp					echo installing $$i; \
595218822Sdim	 				cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
59638889Sjdp	 				chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
597218822Sdim	 				mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
59833965Sjdp				fi; \
599218822Sdim			fi; \
60033965Sjdp		done; \
601218822Sdim		(	here="`pwd`"; \
60233965Sjdp			cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
603218822Sdim			$(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
60433965Sjdp		if [ "$(INSTALLTOP)" != "/usr" ]; then \
605218822Sdim			echo 'OpenSSL shared libraries have been installed in:'; \
60633965Sjdp			echo '  $(INSTALLTOP)'; \
607218822Sdim			echo ''; \
60833965Sjdp			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
609218822Sdim		fi; \
61033965Sjdp	fi
611218822Sdim	cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
612218822Sdim	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
613218822Sdim	cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
614218822Sdim	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
615218822Sdim	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
616218822Sdim	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
617218822Sdim
61833965Sjdpinstall_html_docs:
619218822Sdim	here="`pwd`"; \
62038889Sjdp	for subdir in apps crypto ssl; do \
621218822Sdim		mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
62238889Sjdp		for i in doc/$$subdir/*.pod; do \
623218822Sdim			fn=`basename $$i .pod`; \
62438889Sjdp			echo "installing html/$$fn.$(HTMLSUFFIX)"; \
625218822Sdim			cat $$i \
62633965Sjdp			| sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
627218822Sdim			| pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
62833965Sjdp			| sed -r 's/<!DOCTYPE.*//g' \
629218822Sdim			> $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
63033965Sjdp			$(PERL) util/extract-names.pl < $$i | \
631218822Sdim				grep -v $$filecase "^$$fn\$$" | \
63233965Sjdp				(cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
633218822Sdim				 while read n; do \
63433965Sjdp					PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
635218822Sdim				 done); \
63633965Sjdp		done; \
637218822Sdim	done
63833965Sjdp
639218822Sdiminstall_docs:
640218822Sdim	@$(PERL) $(TOP)/util/mkdir-p.pl \
641218822Sdim		$(INSTALL_PREFIX)$(MANDIR)/man1 \
642218822Sdim		$(INSTALL_PREFIX)$(MANDIR)/man3 \
643218822Sdim		$(INSTALL_PREFIX)$(MANDIR)/man5 \
644218822Sdim		$(INSTALL_PREFIX)$(MANDIR)/man7
645218822Sdim	@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
646218822Sdim	here="`pwd`"; \
64733965Sjdp	filecase=; \
648218822Sdim	if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
649218822Sdim		filecase=-i; \
65033965Sjdp	fi; \
651218822Sdim	set -e; for i in doc/apps/*.pod; do \
65233965Sjdp		fn=`basename $$i .pod`; \
653218822Sdim		sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
654218822Sdim		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
655130561Sobrien		(cd `$(PERL) util/dirname.pl $$i`; \
656218822Sdim		sh -c "$$pod2man \
657218822Sdim			--section=$$sec --center=OpenSSL \
65833965Sjdp			--release=$(VERSION) `basename $$i`") \
65960484Sobrien			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
66033965Sjdp		$(PERL) util/extract-names.pl < $$i | \
661218822Sdim			(grep -v $$filecase "^$$fn\$$"; true) | \
662218822Sdim			(grep -v "[	]"; true) | \
66333965Sjdp			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
664218822Sdim			 while read n; do \
66533965Sjdp				PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
666218822Sdim			 done); \
66733965Sjdp	done; \
668218822Sdim	set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
66933965Sjdp		fn=`basename $$i .pod`; \
670218822Sdim		sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
671218822Sdim		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
67233965Sjdp		(cd `$(PERL) util/dirname.pl $$i`; \
673218822Sdim		sh -c "$$pod2man \
67433965Sjdp			--section=$$sec --center=OpenSSL \
675218822Sdim			--release=$(VERSION) `basename $$i`") \
67633965Sjdp			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
67733965Sjdp		$(PERL) util/extract-names.pl < $$i | \
678218822Sdim			(grep -v $$filecase "^$$fn\$$"; true) | \
67933965Sjdp			(grep -v "[	]"; true) | \
680218822Sdim			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
68133965Sjdp			 while read n; do \
682218822Sdim				PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
68333965Sjdp			 done); \
684218822Sdim	done
68533965Sjdp
686218822Sdim# DO NOT DELETE THIS LINE -- make depend depends on it.
687130561Sobrien