Makefile.org revision 194206
155714Skris##
255714Skris## Makefile for OpenSSL
355714Skris##
455714Skris
555714SkrisVERSION=
655714SkrisMAJOR=
755714SkrisMINOR=
868651SkrisSHLIB_VERSION_NUMBER=
968651SkrisSHLIB_VERSION_HISTORY=
1068651SkrisSHLIB_MAJOR=
1168651SkrisSHLIB_MINOR=
1276866SkrisSHLIB_EXT=
1355714SkrisPLATFORM=dist
1455714SkrisOPTIONS=
1568651SkrisCONFIGURE_ARGS=
1668651SkrisSHLIB_TARGET=
1768651Skris
18109998Smarkm# HERE indicates where this Makefile lives.  This can be used to indicate
19109998Smarkm# where sub-Makefiles are expected to be.  Currently has very limited usage,
20109998Smarkm# and should probably not be bothered with at all.
21109998SmarkmHERE=.
22109998Smarkm
2355714Skris# INSTALL_PREFIX is for package builders so that they can configure
2455714Skris# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
2555714Skris# Normally it is left empty.
2655714SkrisINSTALL_PREFIX=
2755714SkrisINSTALLTOP=/usr/local/ssl
2855714Skris
2955714Skris# Do not edit this manually. Use Configure --openssldir=DIR do change this!
3055714SkrisOPENSSLDIR=/usr/local/ssl
3155714Skris
3255714Skris# NO_IDEA - Define to build without the IDEA algorithm
3355714Skris# NO_RC4  - Define to build without the RC4 algorithm
3455714Skris# NO_RC2  - Define to build without the RC2 algorithm
3555714Skris# THREADS - Define when building with threads, you will probably also need any
3655714Skris#           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
3755714Skris# TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
3855714Skris# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
3955714Skris# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
4055714Skris# DEVRANDOM - Give this the value of the 'random device' if your OS supports
4155714Skris#           one.  32 bytes will be read from this when the random
4255714Skris#           number generator is initalised.
4355714Skris# SSL_FORBID_ENULL - define if you want the server to be not able to use the
4455714Skris#           NULL encryption ciphers.
4555714Skris#
4655714Skris# LOCK_DEBUG - turns on lots of lock debug output :-)
4755714Skris# REF_CHECK - turn on some xyz_free() assertions.
4855714Skris# REF_PRINT - prints some stuff on structure free.
4955714Skris# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
5055714Skris# MFUNC - Make all Malloc/Free/Realloc calls call
5155714Skris#       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
5255714Skris#       call application defined callbacks via CRYPTO_set_mem_functions()
5355714Skris# MD5_ASM needs to be defined to use the x86 assembler for MD5
5455714Skris# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
5555714Skris# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
5655714Skris# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
5755714Skris# equal 4.
5855714Skris# PKCS1_CHECK - pkcs1 tests.
5955714Skris
60160814SsimonCC= cc
61160814SsimonCFLAG= -O
6255714SkrisDEPFLAG= 
6376866SkrisPEX_LIBS= 
6455714SkrisEX_LIBS= 
6576866SkrisEXE_EXT= 
66109998SmarkmARFLAGS=
67109998SmarkmAR=ar $(ARFLAGS) r
68194206SsimonARD=ar $(ARFLAGS) d
6955714SkrisRANLIB= ranlib
7055714SkrisPERL= perl
7159191SkrisTAR= tar
7268651SkrisTARFLAGS= --no-recursion
73109998SmarkmMAKEDEPPROG=makedepend
7455714Skris
75111147Snectar# We let the C compiler driver to take care of .s files. This is done in
76111147Snectar# order to be excused from maintaining a separate set of architecture
77111147Snectar# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
78111147Snectar# gcc, then the driver will automatically translate it to -xarch=v8plus
79111147Snectar# and pass it down to assembler.
80111147SnectarAS=$(CC) -c
81120631SnectarASFLAG=$(CFLAG)
82111147Snectar
8355714Skris# For x86 assembler: Set PROCESSOR to 386 if you want to support
8455714Skris# the 80386.
8555714SkrisPROCESSOR=
8655714Skris
87160814Ssimon# CPUID module collects small commonly used assembler snippets
88160814SsimonCPUID_OBJ= 
89160814SsimonBN_ASM= bn_asm.o
90160814SsimonDES_ENC= des_enc.o fcrypt_b.o
91160814SsimonAES_ASM_OBJ=aes_core.o aes_cbc.o
92160814SsimonBF_ENC= bf_enc.o
93160814SsimonCAST_ENC= c_enc.o
94160814SsimonRC4_ENC= rc4_enc.o
95160814SsimonRC5_ENC= rc5_enc.o
96160814SsimonMD5_ASM_OBJ= 
97160814SsimonSHA1_ASM_OBJ= 
98160814SsimonRMD160_ASM_OBJ= 
9955714Skris
100109998Smarkm# KRB5 stuff
101109998SmarkmKRB5_INCLUDES=
102111147SnectarLIBKRB5=
103109998Smarkm
104160814Ssimon# Zlib stuff
105160814SsimonZLIB_INCLUDE=
106160814SsimonLIBZLIB=
10768651Skris
108194206Ssimon# This is the location of fipscanister.o and friends.
109194206Ssimon# The FIPS module build will place it $(INSTALLTOP)/lib
110194206Ssimon# but since $(INSTALLTOP) can only take the default value
111194206Ssimon# when the module is built it will be in /usr/local/ssl/lib
112194206Ssimon# $(INSTALLTOP) for this build make be different so hard
113194206Ssimon# code the path.
11455714Skris
115194206SsimonFIPSLIBDIR=/usr/local/ssl/lib/
116194206Ssimon
117194206Ssimon# This is set to "y" if fipscanister.o is compiled internally as
118194206Ssimon# opposed to coming from an external validated location.
119194206Ssimon
120194206SsimonFIPSCANISTERINTERNAL=n
121194206Ssimon
122194206Ssimon# The location of the library which contains fipscanister.o
123194206Ssimon# normally it will be libcrypto unless fipsdso is set in which
124194206Ssimon# case it will be libfips. If not compiling in FIPS mode at all
125194206Ssimon# this is empty making it a useful test for a FIPS compile.
126194206Ssimon
127194206SsimonFIPSCANLIB=
128194206Ssimon
129194206Ssimon# Shared library base address. Currently only used on Windows.
130194206Ssimon#
131194206Ssimon
132194206SsimonBASEADDR=
133194206Ssimon
134194206SsimonDIRS=   crypto fips ssl engines apps test tools
135194206SsimonSHLIBDIRS= crypto ssl fips
136194206Ssimon
13755714Skris# dirs in crypto to build
138160814SsimonSDIRS=  \
139160814Ssimon	objects \
14068651Skris	md2 md4 md5 sha mdc2 hmac ripemd \
141194206Ssimon	des aes rc2 rc4 rc5 idea bf cast camellia seed \
142160814Ssimon	bn ec rsa dsa ecdsa dh ecdh dso engine \
143142425Snectar	buffer bio stack lhash rand err \
144160814Ssimon	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
145194206Ssimon	store cms pqueue jpake
146160814Ssimon# keep in mind that the above list is adjusted by ./Configure
147160814Ssimon# according to no-xxx arguments...
14855714Skris
149109998Smarkm# tests to perform.  "alltests" is a special word indicating that all tests
150109998Smarkm# should be performed.
151109998SmarkmTESTS = alltests
152109998Smarkm
153142425SnectarMAKEFILE= Makefile
15455714Skris
15559191SkrisMANDIR=$(OPENSSLDIR)/man
15655714SkrisMAN1=1
15755714SkrisMAN3=3
158120631SnectarMANSUFFIX=
15955714SkrisSHELL=/bin/sh
16055714Skris
16155714SkrisTOP=    .
16255714SkrisONEDIRS=out tmp
16355714SkrisEDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
16455714SkrisWDIRS=  windows
16568651SkrisLIBS=   libcrypto.a libssl.a
16676866SkrisSHARED_CRYPTO=libcrypto$(SHLIB_EXT)
16776866SkrisSHARED_SSL=libssl$(SHLIB_EXT)
168194206SsimonSHARED_FIPS=
16976866SkrisSHARED_LIBS=
17076866SkrisSHARED_LIBS_LINK_EXTS=
171100928SnectarSHARED_LDFLAGS=
17255714Skris
17355714SkrisGENERAL=        Makefile
17455714SkrisBASENAME=       openssl
17555714SkrisNAME=           $(BASENAME)-$(VERSION)
17655714SkrisTARFILE=        $(NAME).tar
17755714SkrisWTARFILE=       $(NAME)-win.tar
178109998SmarkmEXHEADER=       e_os2.h
17955714SkrisHEADER=         e_os.h
18055714Skris
181160814Ssimonall: Makefile build_all openssl.pc libssl.pc libcrypto.pc
18255714Skris
183160814Ssimon# as we stick to -e, CLEARENV ensures that local variables in lower
184160814Ssimon# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
185160814Ssimon# shell, which [annoyingly enough] terminates unset with error if VAR
186160814Ssimon# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
187160814Ssimon# which terminates unset with error if no variable was present:-(
188160814SsimonCLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
189160814Ssimon		$${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}	\
190160814Ssimon		$${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}		\
191160814Ssimon		$${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL}	\
192160814Ssimon		$${EXHEADER+EXHEADER} $${HEADER+HEADER}		\
193160814Ssimon		$${GENERAL+GENERAL} $${CFLAGS+CFLAGS}		\
194160814Ssimon		$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}		\
195160814Ssimon		$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS}		\
196160814Ssimon		$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}	\
197160814Ssimon		$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
19876866Skris
199160814SsimonBUILDENV=	PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
200160814Ssimon		CC='${CC}' CFLAG='${CFLAG}' 			\
201160814Ssimon		AS='${CC}' ASFLAG='${CFLAG} -c'			\
202160814Ssimon		AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'	\
203160814Ssimon		SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib'	\
204160814Ssimon		INSTALL_PREFIX='${INSTALL_PREFIX}'		\
205160814Ssimon		INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'	\
206160814Ssimon		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
207160814Ssimon		DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}'	\
208160814Ssimon		MAKEDEPPROG='${MAKEDEPPROG}'			\
209160814Ssimon		SHARED_LDFLAGS='${SHARED_LDFLAGS}'		\
210160814Ssimon		KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'	\
211160814Ssimon		EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'	\
212160814Ssimon		SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}'	\
213160814Ssimon		PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}'	\
214160814Ssimon		CPUID_OBJ='${CPUID_OBJ}'			\
215160814Ssimon		BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' 	\
216160814Ssimon		AES_ASM_OBJ='${AES_ASM_OBJ}'			\
217160814Ssimon		BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}'	\
218160814Ssimon		RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}'	\
219160814Ssimon		SHA1_ASM_OBJ='${SHA1_ASM_OBJ}'			\
220160814Ssimon		MD5_ASM_OBJ='${MD5_ASM_OBJ}'			\
221160814Ssimon		RMD160_ASM_OBJ='${RMD160_ASM_OBJ}'		\
222194206Ssimon		FIPSLIBDIR='${FIPSLIBDIR}'			\
223194206Ssimon		FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"	\
224194206Ssimon		FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}'	\
225194206Ssimon		FIPS_EX_OBJ='${FIPS_EX_OBJ}'	\
226160814Ssimon		THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
227160814Ssimon# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
228160814Ssimon# which in turn eliminates ambiguities in variable treatment with -e.
229160814Ssimon
230160814Ssimon# BUILD_CMD is a generic macro to build a given target in a given
231160814Ssimon# subdirectory.  The target must be given through the shell variable
232160814Ssimon# `target' and the subdirectory to build in must be given through `dir'.
233160814Ssimon# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
234160814Ssimon# BUILD_ONE_CMD instead.
235160814Ssimon#
236160814Ssimon# BUILD_ONE_CMD is a macro to build a given target in a given
237160814Ssimon# subdirectory if that subdirectory is part of $(DIRS).  It requires
238160814Ssimon# exactly the same shell variables as BUILD_CMD.
239160814Ssimon#
240160814Ssimon# RECURSIVE_BUILD_CMD is a macro to build a given target in all
241160814Ssimon# subdirectories defined in $(DIRS).  It requires that the target
242160814Ssimon# is given through the shell variable `target'.
243160814SsimonBUILD_CMD=  if [ -d "$$dir" ]; then \
244194206Ssimon	    (	[ $$target != all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=/dev/null; \
245194206Ssimon		cd $$dir && echo "making $$target in $$dir..." && \
246160814Ssimon		$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
247160814Ssimon	    ) || exit 1; \
248160814Ssimon	    fi
249160814SsimonRECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
250160814SsimonBUILD_ONE_CMD=\
251160814Ssimon	if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
252160814Ssimon		$(BUILD_CMD); \
253142425Snectar	fi
254142425Snectar
255160814Ssimonreflect:
256160814Ssimon	@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
25755714Skris
258194206SsimonFIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
259194206Ssimon	../crypto/aes/aes_ecb.o \
260194206Ssimon	../crypto/aes/aes_ofb.o \
261194206Ssimon	../crypto/bn/bn_add.o \
262194206Ssimon	../crypto/bn/bn_blind.o \
263194206Ssimon	../crypto/bn/bn_ctx.o \
264194206Ssimon	../crypto/bn/bn_div.o \
265194206Ssimon	../crypto/bn/bn_exp2.o \
266194206Ssimon	../crypto/bn/bn_exp.o \
267194206Ssimon	../crypto/bn/bn_gcd.o \
268194206Ssimon	../crypto/bn/bn_lib.o \
269194206Ssimon	../crypto/bn/bn_mod.o \
270194206Ssimon	../crypto/bn/bn_mont.o \
271194206Ssimon	../crypto/bn/bn_mul.o \
272194206Ssimon	../crypto/bn/bn_prime.o \
273194206Ssimon	../crypto/bn/bn_rand.o \
274194206Ssimon	../crypto/bn/bn_recp.o \
275194206Ssimon	../crypto/bn/bn_shift.o \
276194206Ssimon	../crypto/bn/bn_sqr.o \
277194206Ssimon	../crypto/bn/bn_word.o \
278194206Ssimon	../crypto/bn/bn_x931p.o \
279194206Ssimon	../crypto/buffer/buf_str.o \
280194206Ssimon	../crypto/cryptlib.o \
281194206Ssimon	../crypto/des/cfb64ede.o \
282194206Ssimon	../crypto/des/cfb64enc.o \
283194206Ssimon	../crypto/des/cfb_enc.o \
284194206Ssimon	../crypto/des/ecb3_enc.o \
285194206Ssimon	../crypto/des/ecb_enc.o \
286194206Ssimon	../crypto/des/ofb64ede.o \
287194206Ssimon	../crypto/des/ofb64enc.o \
288194206Ssimon	../crypto/des/fcrypt.o \
289194206Ssimon	../crypto/des/set_key.o \
290194206Ssimon	../crypto/dsa/dsa_utl.o \
291194206Ssimon	../crypto/dsa/dsa_sign.o \
292194206Ssimon	../crypto/dsa/dsa_vrf.o \
293194206Ssimon	../crypto/err/err.o \
294194206Ssimon	../crypto/evp/digest.o \
295194206Ssimon	../crypto/evp/enc_min.o \
296194206Ssimon	../crypto/evp/e_aes.o \
297194206Ssimon	../crypto/evp/e_des3.o \
298194206Ssimon	../crypto/evp/p_sign.o \
299194206Ssimon	../crypto/evp/p_verify.o \
300194206Ssimon	../crypto/mem_clr.o \
301194206Ssimon	../crypto/mem.o \
302194206Ssimon	../crypto/rand/md_rand.o \
303194206Ssimon	../crypto/rand/rand_egd.o \
304194206Ssimon	../crypto/rand/randfile.o \
305194206Ssimon	../crypto/rand/rand_lib.o \
306194206Ssimon	../crypto/rand/rand_os2.o \
307194206Ssimon	../crypto/rand/rand_unix.o \
308194206Ssimon	../crypto/rand/rand_win.o \
309194206Ssimon	../crypto/rsa/rsa_lib.o \
310194206Ssimon	../crypto/rsa/rsa_none.o \
311194206Ssimon	../crypto/rsa/rsa_oaep.o \
312194206Ssimon	../crypto/rsa/rsa_pk1.o \
313194206Ssimon	../crypto/rsa/rsa_pss.o \
314194206Ssimon	../crypto/rsa/rsa_ssl.o \
315194206Ssimon	../crypto/rsa/rsa_x931.o \
316194206Ssimon	../crypto/sha/sha1dgst.o \
317194206Ssimon	../crypto/sha/sha256.o \
318194206Ssimon	../crypto/sha/sha512.o \
319194206Ssimon	../crypto/uid.o
320194206Ssimon
321160814Ssimonsub_all: build_all
322160814Ssimonbuild_all: build_libs build_apps build_tests build_tools
323142425Snectar
324194206Ssimonbuild_libs: build_crypto build_fips build_ssl build_shared build_engines
325160814Ssimon
326160814Ssimonbuild_crypto:
327194206Ssimon	if [ -n "$(FIPSCANLIB)" ]; then \
328194206Ssimon		EXCL_OBJ='$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
329194206Ssimon		ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
330194206Ssimon	else \
331194206Ssimon		ARX='${AR}' ; \
332194206Ssimon	fi ; export ARX ; \
333194206Ssimon		dir=crypto; target=all; $(BUILD_ONE_CMD)
334194206Ssimonbuild_fips:
335194206Ssimon	@dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
336160814Ssimonbuild_ssl:
337160814Ssimon	@dir=ssl; target=all; $(BUILD_ONE_CMD)
338160814Ssimonbuild_engines:
339160814Ssimon	@dir=engines; target=all; $(BUILD_ONE_CMD)
340160814Ssimonbuild_apps:
341160814Ssimon	@dir=apps; target=all; $(BUILD_ONE_CMD)
342160814Ssimonbuild_tests:
343160814Ssimon	@dir=test; target=all; $(BUILD_ONE_CMD)
344160814Ssimonbuild_tools:
345160814Ssimon	@dir=tools; target=all; $(BUILD_ONE_CMD)
346160814Ssimon
347160814Ssimonall_testapps: build_libs build_testapps
348160814Ssimonbuild_testapps:
349160814Ssimon	@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
350160814Ssimon
351194206Ssimonbuild_shared:	$(SHARED_LIBS)
352194206Ssimonlibcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
35368651Skris	@if [ "$(SHLIB_TARGET)" != "" ]; then \
354194206Ssimon		if [ "$(FIPSCANLIB)" = "libfips" ]; then \
355194206Ssimon			$(ARD) libcrypto.a fipscanister.o ; \
356194206Ssimon			$(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
357194206Ssimon			$(AR) libcrypto.a fips/fipscanister.o ; \
358194206Ssimon		else \
359194206Ssimon			if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
360194206Ssimon				FIPSLD_CC=$(CC); CC=fips/fipsld; \
361194206Ssimon				export CC FIPSLD_CC; \
362194206Ssimon			fi; \
363194206Ssimon			$(MAKE) -e SHLIBDIRS='crypto' build-shared; \
364194206Ssimon		fi \
36568651Skris	else \
36668651Skris		echo "There's no support for shared libraries on this platform" >&2; \
367160814Ssimon		exit 1; \
36868651Skris	fi
369109998Smarkm
37076866Skrislibssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
37168651Skris	@if [ "$(SHLIB_TARGET)" != "" ]; then \
372194206Ssimon		shlibdeps=-lcrypto; \
373194206Ssimon		[ "$(FIPSCANLIB)" = "libfips" ] && shlibdeps="$$shlibdeps -lfips"; \
374194206Ssimon		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS="$$shlibdeps" build-shared; \
37568651Skris	else \
376194206Ssimon		echo "There's no support for shared libraries on this platform" >&2 ; \
377194206Ssimon		exit 1; \
378194206Ssimon	fi
379194206Ssimon
380194206Ssimonfips/fipscanister.o:	build_fips
381194206Ssimonlibfips$(SHLIB_EXT):		fips/fipscanister.o
382194206Ssimon	@if [ "$(SHLIB_TARGET)" != "" ]; then \
383194206Ssimon		FIPSLD_CC=$(CC); CC=fips/fipsld; export CC FIPSLD_CC; \
384194206Ssimon		$(MAKE) -f Makefile.shared -e $(BUILDENV) \
385194206Ssimon			CC=$${CC} LIBNAME=fips THIS=$@ \
386194206Ssimon			LIBEXTRAS=fips/fipscanister.o \
387194206Ssimon			LIBDEPS="$(EX_LIBS)" \
388194206Ssimon			LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
389194206Ssimon			link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
390194206Ssimon	else \
39168651Skris		echo "There's no support for shared libraries on this platform" >&2; \
392160814Ssimon		exit 1; \
39368651Skris	fi
39468651Skris
395194206Ssimonlibfips.a:
396194206Ssimon	dir=fips; target=all; $(BUILD_ONE_CMD)
397194206Ssimon
39868651Skrisclean-shared:
399160814Ssimon	@set -e; for i in $(SHLIBDIRS); do \
40076866Skris		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
40176866Skris			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
40276866Skris			for j in $${tmp:-x}; do \
40376866Skris				( set -x; rm -f lib$$i$$j ); \
40476866Skris			done; \
40576866Skris		fi; \
40676866Skris		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
407100928Snectar		if [ "$(PLATFORM)" = "Cygwin" ]; then \
408160814Ssimon			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
409100928Snectar		fi; \
41068651Skris	done
41168651Skris
41276866Skrislink-shared:
413160814Ssimon	@ set -e; for i in ${SHLIBDIRS}; do \
414160814Ssimon		$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
415160814Ssimon			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
416160814Ssimon			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
417160814Ssimon			symlink.$(SHLIB_TARGET); \
418160814Ssimon		libs="$$libs -l$$i"; \
41968651Skris	done
42055714Skris
421160814Ssimonbuild-shared: do_$(SHLIB_TARGET) link-shared
42289837Skris
423160814Ssimondo_$(SHLIB_TARGET):
424160814Ssimon	@ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
425111147Snectar		if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
426111147Snectar			libs="$(LIBKRB5) $$libs"; \
427111147Snectar		fi; \
428160814Ssimon		$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
429160814Ssimon			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
430160814Ssimon			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
431160814Ssimon			LIBDEPS="$$libs $(EX_LIBS)" \
432160814Ssimon			link_a.$(SHLIB_TARGET); \
433111147Snectar		libs="-l$$i $$libs"; \
43468651Skris	done
43568651Skris
436160814Ssimonlibcrypto.pc: Makefile
437160814Ssimon	@ ( echo 'prefix=$(INSTALLTOP)'; \
438160814Ssimon	    echo 'exec_prefix=$${prefix}'; \
439160814Ssimon	    echo 'libdir=$${exec_prefix}/lib'; \
440160814Ssimon	    echo 'includedir=$${prefix}/include'; \
441160814Ssimon	    echo ''; \
442160814Ssimon	    echo 'Name: OpenSSL-libcrypto'; \
443160814Ssimon	    echo 'Description: OpenSSL cryptography library'; \
444160814Ssimon	    echo 'Version: '$(VERSION); \
445160814Ssimon	    echo 'Requires: '; \
446160814Ssimon	    echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \
447160814Ssimon	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
44889837Skris
449160814Ssimonlibssl.pc: Makefile
450160814Ssimon	@ ( echo 'prefix=$(INSTALLTOP)'; \
451160814Ssimon	    echo 'exec_prefix=$${prefix}'; \
452160814Ssimon	    echo 'libdir=$${exec_prefix}/lib'; \
453160814Ssimon	    echo 'includedir=$${prefix}/include'; \
454160814Ssimon	    echo ''; \
455160814Ssimon	    echo 'Name: OpenSSL'; \
456160814Ssimon	    echo 'Description: Secure Sockets Layer and cryptography libraries'; \
457160814Ssimon	    echo 'Version: '$(VERSION); \
458160814Ssimon	    echo 'Requires: '; \
459160814Ssimon	    echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
460160814Ssimon	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
46168651Skris
462142425Snectaropenssl.pc: Makefile
463109998Smarkm	@ ( echo 'prefix=$(INSTALLTOP)'; \
464109998Smarkm	    echo 'exec_prefix=$${prefix}'; \
465109998Smarkm	    echo 'libdir=$${exec_prefix}/lib'; \
466109998Smarkm	    echo 'includedir=$${prefix}/include'; \
467109998Smarkm	    echo ''; \
468109998Smarkm	    echo 'Name: OpenSSL'; \
469109998Smarkm	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
470109998Smarkm	    echo 'Version: '$(VERSION); \
471109998Smarkm	    echo 'Requires: '; \
472160814Ssimon	    echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
473109998Smarkm	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
474109998Smarkm
475160814SsimonMakefile: Makefile.org Configure config
476160814Ssimon	@echo "Makefile is older than Makefile.org, Configure or config."
47755714Skris	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
47855714Skris	@false
47955714Skris
48055714Skrislibclean:
481160814Ssimon	rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib
48255714Skris
483120631Snectarclean:	libclean
484120631Snectar	rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
485160814Ssimon	@set -e; target=clean; $(RECURSIVE_BUILD_CMD)
486160814Ssimon	rm -f $(LIBS)
487160814Ssimon	rm -f openssl.pc libssl.pc libcrypto.pc
488120631Snectar	rm -f speed.* .pure
48955714Skris	rm -f $(TARFILE)
490160814Ssimon	@set -e; for i in $(ONEDIRS) ;\
49155714Skris	do \
49255714Skris	rm -fr $$i/*; \
49355714Skris	done
49455714Skris
49555714Skrismakefile.one: files
49655714Skris	$(PERL) util/mk1mf.pl >makefile.one; \
49755714Skris	sh util/do_ms.sh
49855714Skris
49955714Skrisfiles:
500142425Snectar	$(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
501160814Ssimon	@set -e; target=files; $(RECURSIVE_BUILD_CMD)
50255714Skris
50355714Skrislinks:
50455714Skris	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
50555714Skris	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
506160814Ssimon	@set -e; target=links; $(RECURSIVE_BUILD_CMD)
507194206Ssimon	@if [ -z "$(FIPSCANLIB)" ]; then \
508194206Ssimon		set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
509194206Ssimon	fi
51055714Skris
511109998Smarkmgentests:
512109998Smarkm	@(cd test && echo "generating dummy tests (if needed)..." && \
513160814Ssimon	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
514109998Smarkm
51555714Skrisdclean:
51655714Skris	rm -f *.bak
517160814Ssimon	@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
51855714Skris
51959191Skrisrehash: rehash.time
52059191Skrisrehash.time: certs
521160814Ssimon	@(OPENSSL="`pwd`/util/opensslwrap.sh"; \
522160814Ssimon	  OPENSSL_DEBUG_MEMORY=on; \
523160814Ssimon	  export OPENSSL OPENSSL_DEBUG_MEMORY; \
524160814Ssimon	  $(PERL) tools/c_rehash certs)
52559191Skris	touch rehash.time
52655714Skris
52755714Skristest:   tests
52855714Skris
52955714Skristests: rehash
53055714Skris	@(cd test && echo "testing..." && \
531160814Ssimon	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
532160814Ssimon	util/opensslwrap.sh version -a
53355714Skris
53459191Skrisreport:
53559191Skris	@$(PERL) util/selftest.pl
53659191Skris
53755714Skrisdepend:
538160814Ssimon	@set -e; target=depend; $(RECURSIVE_BUILD_CMD)
53955714Skris
54055714Skrislint:
541160814Ssimon	@set -e; target=lint; $(RECURSIVE_BUILD_CMD)
54255714Skris
54355714Skristags:
544142425Snectar	rm -f TAGS
545142425Snectar	find . -name '[^.]*.[ch]' | xargs etags -a
54655714Skris
54755714Skriserrors:
54889837Skris	$(PERL) util/mkerr.pl -recurse -write
549160814Ssimon	(cd engines; $(MAKE) PERL=$(PERL) errors)
550160814Ssimon	$(PERL) util/ck_errf.pl */*.c */*/*.c
55155714Skris
55268651Skrisstacks:
55389837Skris	$(PERL) util/mkstack.pl -write
55468651Skris
55555714Skrisutil/libeay.num::
55689837Skris	$(PERL) util/mkdef.pl crypto update
55755714Skris
55855714Skrisutil/ssleay.num::
55989837Skris	$(PERL) util/mkdef.pl ssl update
56055714Skris
561109998Smarkmcrypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
56289837Skris	$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
563109998Smarkmcrypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
56489837Skris	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
56559191Skris
566142425Snectarapps/openssl-vms.cnf: apps/openssl.cnf
567142425Snectar	$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
568142425Snectar
569160814Ssimoncrypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
570160814Ssimon	$(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
571160814Ssimon
572160814Ssimon
57355714SkrisTABLE: Configure
57455714Skris	(echo 'Output of `Configure TABLE'"':"; \
57589837Skris	$(PERL) Configure TABLE) > TABLE
57655714Skris
577160814Ssimonupdate: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
57855714Skris
579100936Snectar# Build distribution tar-file. As the list of files returned by "find" is
580100936Snectar# pretty long, on several platforms a "too many arguments" error or similar
581100936Snectar# would occur. Therefore the list of files is temporarily stored into a file
582100936Snectar# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
583100936Snectar# tar does not support the --files-from option.
58455714Skristar:
585109998Smarkm	find . -type d -print | xargs chmod 755
586109998Smarkm	find . -type f -print | xargs chmod a+r
587109998Smarkm	find . -type f -perm -0100 -print | xargs chmod a+x
588100936Snectar	find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
589100936Snectar	$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
59055714Skris	tardy --user_number=0  --user_name=openssl \
59155714Skris	      --group_number=0 --group_name=openssl \
59255714Skris	      --prefix=openssl-$(VERSION) - |\
59355714Skris	gzip --best >../$(TARFILE).gz; \
594100936Snectar	rm -f ../$(TARFILE).list; \
59555714Skris	ls -l ../$(TARFILE).gz
59655714Skris
597109998Smarkmtar-snap:
598109998Smarkm	@$(TAR) $(TARFLAGS) -cvf - \
599109998Smarkm		`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` |\
600109998Smarkm	tardy --user_number=0  --user_name=openssl \
601109998Smarkm	      --group_number=0 --group_name=openssl \
602109998Smarkm	      --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
603109998Smarkm	ls -l ../$(TARFILE)
604109998Smarkm
60555714Skrisdist:   
60655714Skris	$(PERL) Configure dist
60755714Skris	@$(MAKE) dist_pem_h
60855714Skris	@$(MAKE) SDIRS='${SDIRS}' clean
609100936Snectar	@$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
61055714Skris
61155714Skrisdist_pem_h:
612160814Ssimon	(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
61355714Skris
614142425Snectarinstall: all install_docs install_sw
615142425Snectar
616142425Snectarinstall_sw:
61755714Skris	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
61855714Skris		$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
619160814Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines \
620109998Smarkm		$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \
62155714Skris		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
62255714Skris		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
62355714Skris		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
624142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
625160814Ssimon	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
62655714Skris	do \
62755714Skris	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
62855714Skris	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
62955714Skris	done;
630160814Ssimon	@set -e; target=install; $(RECURSIVE_BUILD_CMD)
631160814Ssimon	@set -e; for i in $(LIBS) ;\
63255714Skris	do \
63368651Skris		if [ -f "$$i" ]; then \
63468651Skris		(       echo installing $$i; \
635109998Smarkm			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
636160814Ssimon			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
637109998Smarkm			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
638109998Smarkm			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
639100928Snectar		fi; \
640109998Smarkm	done;
641160814Ssimon	@set -e; if [ -n "$(SHARED_LIBS)" ]; then \
64276866Skris		tmp="$(SHARED_LIBS)"; \
64376866Skris		for i in $${tmp:-x}; \
64476866Skris		do \
645100928Snectar			if [ -f "$$i" -o -f "$$i.a" ]; then \
64676866Skris			(       echo installing $$i; \
647100928Snectar				if [ "$(PLATFORM)" != "Cygwin" ]; then \
648109998Smarkm					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
649109998Smarkm					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
650109998Smarkm					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
651100928Snectar				else \
652160814Ssimon					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
653109998Smarkm					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
654109998Smarkm					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
655109998Smarkm					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
656160814Ssimon					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
657160814Ssimon					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
658160814Ssimon					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
659100928Snectar				fi ); \
660100928Snectar			fi; \
66176866Skris		done; \
66276866Skris		(	here="`pwd`"; \
66376866Skris			cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
664160814Ssimon			$(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
665111147Snectar		if [ "$(INSTALLTOP)" != "/usr" ]; then \
666111147Snectar			echo 'OpenSSL shared libraries have been installed in:'; \
667111147Snectar			echo '  $(INSTALLTOP)'; \
668111147Snectar			echo ''; \
669111147Snectar			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
670111147Snectar		fi; \
67176866Skris	fi
672160814Ssimon	cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
673160814Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/libcrypto.pc
674160814Ssimon	cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
675160814Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/libssl.pc
676109998Smarkm	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
677127128Snectar	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc
67855714Skris
67959191Skrisinstall_docs:
68059191Skris	@$(PERL) $(TOP)/util/mkdir-p.pl \
68159191Skris		$(INSTALL_PREFIX)$(MANDIR)/man1 \
68259191Skris		$(INSTALL_PREFIX)$(MANDIR)/man3 \
68359191Skris		$(INSTALL_PREFIX)$(MANDIR)/man5 \
68459191Skris		$(INSTALL_PREFIX)$(MANDIR)/man7
685109998Smarkm	@pod2man="`cd util; ./pod2mantest $(PERL)`"; \
686109998Smarkm	here="`pwd`"; \
687109998Smarkm	filecase=; \
688160814Ssimon	if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
689109998Smarkm		filecase=-i; \
690109998Smarkm	fi; \
691160814Ssimon	set -e; for i in doc/apps/*.pod; do \
69259191Skris		fn=`basename $$i .pod`; \
693160814Ssimon		sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
694120631Snectar		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
695100936Snectar		(cd `$(PERL) util/dirname.pl $$i`; \
696109998Smarkm		sh -c "$$pod2man \
697100936Snectar			--section=$$sec --center=OpenSSL \
698100936Snectar			--release=$(VERSION) `basename $$i`") \
699120631Snectar			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
700109998Smarkm		$(PERL) util/extract-names.pl < $$i | \
701160814Ssimon			(grep -v $$filecase "^$$fn\$$"; true) | \
702160814Ssimon			(grep -v "[	]"; true) | \
703109998Smarkm			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
704109998Smarkm			 while read n; do \
705120631Snectar				$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
706109998Smarkm			 done); \
707101613Snectar	done; \
708160814Ssimon	set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
70959191Skris		fn=`basename $$i .pod`; \
710160814Ssimon		sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
711120631Snectar		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
712100936Snectar		(cd `$(PERL) util/dirname.pl $$i`; \
713109998Smarkm		sh -c "$$pod2man \
714100936Snectar			--section=$$sec --center=OpenSSL \
715100936Snectar			--release=$(VERSION) `basename $$i`") \
716120631Snectar			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
717109998Smarkm		$(PERL) util/extract-names.pl < $$i | \
718160814Ssimon			(grep -v $$filecase "^$$fn\$$"; true) | \
719160814Ssimon			(grep -v "[	]"; true) | \
720109998Smarkm			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
721109998Smarkm			 while read n; do \
722120631Snectar				$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
723109998Smarkm			 done); \
72459191Skris	done
72559191Skris
72655714Skris# DO NOT DELETE THIS LINE -- make depend depends on it.
727