1142425Snectar### Generated automatically from Makefile.org by Configure.
2142425Snectar
3142425Snectar##
4142425Snectar## Makefile for OpenSSL
5142425Snectar##
6142425Snectar
7314125SdelphijVERSION=1.0.2k
8238405SjkimMAJOR=1
9290207SjkimMINOR=0.2
10238405SjkimSHLIB_VERSION_NUMBER=1.0.0
11142425SnectarSHLIB_VERSION_HISTORY=
12238405SjkimSHLIB_MAJOR=1
13238405SjkimSHLIB_MINOR=0.0
14142425SnectarSHLIB_EXT=
15142425SnectarPLATFORM=dist
16296279SjkimOPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-ssl2 no-store no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic static-engine
17142425SnectarCONFIGURE_ARGS=dist
18142425SnectarSHLIB_TARGET=
19142425Snectar
20142425Snectar# HERE indicates where this Makefile lives.  This can be used to indicate
21142425Snectar# where sub-Makefiles are expected to be.  Currently has very limited usage,
22142425Snectar# and should probably not be bothered with at all.
23142425SnectarHERE=.
24142425Snectar
25142425Snectar# INSTALL_PREFIX is for package builders so that they can configure
26142425Snectar# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
27142425Snectar# Normally it is left empty.
28142425SnectarINSTALL_PREFIX=
29142425SnectarINSTALLTOP=/usr/local/ssl
30142425Snectar
31142425Snectar# Do not edit this manually. Use Configure --openssldir=DIR do change this!
32142425SnectarOPENSSLDIR=/usr/local/ssl
33142425Snectar
34142425Snectar# NO_IDEA - Define to build without the IDEA algorithm
35142425Snectar# NO_RC4  - Define to build without the RC4 algorithm
36142425Snectar# NO_RC2  - Define to build without the RC2 algorithm
37142425Snectar# THREADS - Define when building with threads, you will probably also need any
38142425Snectar#           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
39142425Snectar# TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
40142425Snectar# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
41142425Snectar# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
42142425Snectar# DEVRANDOM - Give this the value of the 'random device' if your OS supports
43142425Snectar#           one.  32 bytes will be read from this when the random
44142425Snectar#           number generator is initalised.
45142425Snectar# SSL_FORBID_ENULL - define if you want the server to be not able to use the
46142425Snectar#           NULL encryption ciphers.
47142425Snectar#
48142425Snectar# LOCK_DEBUG - turns on lots of lock debug output :-)
49142425Snectar# REF_CHECK - turn on some xyz_free() assertions.
50142425Snectar# REF_PRINT - prints some stuff on structure free.
51142425Snectar# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
52142425Snectar# MFUNC - Make all Malloc/Free/Realloc calls call
53142425Snectar#       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
54142425Snectar#       call application defined callbacks via CRYPTO_set_mem_functions()
55142425Snectar# MD5_ASM needs to be defined to use the x86 assembler for MD5
56142425Snectar# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
57142425Snectar# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
58142425Snectar# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
59142425Snectar# equal 4.
60142425Snectar# PKCS1_CHECK - pkcs1 tests.
61142425Snectar
62142425SnectarCC= cc
63160814SsimonCFLAG= -O
64296279SjkimDEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOPENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS
65142425SnectarPEX_LIBS= 
66142425SnectarEX_LIBS= 
67142425SnectarEXE_EXT= 
68142425SnectarARFLAGS= 
69205128SsimonAR= ar $(ARFLAGS) r
70142425SnectarRANLIB= /usr/bin/ranlib
71306198SjkimRC= windres
72238405SjkimNM= nm
73167612SsimonPERL= /usr/bin/perl
74142425SnectarTAR= tar
75290207SjkimTARFLAGS= --no-recursion
76142425SnectarMAKEDEPPROG=makedepend
77205128SsimonLIBDIR=lib
78142425Snectar
79142425Snectar# We let the C compiler driver to take care of .s files. This is done in
80142425Snectar# order to be excused from maintaining a separate set of architecture
81142425Snectar# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
82142425Snectar# gcc, then the driver will automatically translate it to -xarch=v8plus
83142425Snectar# and pass it down to assembler.
84142425SnectarAS=$(CC) -c
85142425SnectarASFLAG=$(CFLAG)
86142425Snectar
87142425Snectar# For x86 assembler: Set PROCESSOR to 386 if you want to support
88142425Snectar# the 80386.
89142425SnectarPROCESSOR= 
90142425Snectar
91160814Ssimon# CPUID module collects small commonly used assembler snippets
92238405SjkimCPUID_OBJ= mem_clr.o
93160814SsimonBN_ASM= bn_asm.o
94290207SjkimEC_ASM= 
95142425SnectarDES_ENC= des_enc.o fcrypt_b.o
96238405SjkimAES_ENC= aes_core.o aes_cbc.o
97142425SnectarBF_ENC= bf_enc.o
98142425SnectarCAST_ENC= c_enc.o
99194206SsimonRC4_ENC= rc4_enc.o rc4_skey.o
100142425SnectarRC5_ENC= rc5_enc.o
101142425SnectarMD5_ASM_OBJ= 
102142425SnectarSHA1_ASM_OBJ= 
103142425SnectarRMD160_ASM_OBJ= 
104238405SjkimWP_ASM_OBJ= wp_block.o
105238405SjkimCMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o
106238405SjkimMODES_ASM_OBJ= 
107238405SjkimENGINES_ASM_OBJ= 
108238405SjkimPERLASM_SCHEME= 
109142425Snectar
110142425Snectar# KRB5 stuff
111142425SnectarKRB5_INCLUDES=
112142425SnectarLIBKRB5=
113142425Snectar
114160814Ssimon# Zlib stuff
115160814SsimonZLIB_INCLUDE=
116160814SsimonLIBZLIB=
117142425Snectar
118238405Sjkim# TOP level FIPS install directory.
119238405SjkimFIPSDIR=/usr/local/ssl/fips-2.0
120238405Sjkim
121194206Ssimon# This is the location of fipscanister.o and friends.
122194206Ssimon# The FIPS module build will place it $(INSTALLTOP)/lib
123194206Ssimon# but since $(INSTALLTOP) can only take the default value
124194206Ssimon# when the module is built it will be in /usr/local/ssl/lib
125238405Sjkim# $(INSTALLTOP) for this build may be different so hard
126194206Ssimon# code the path.
127194206Ssimon
128238405SjkimFIPSLIBDIR=
129194206Ssimon
130194206Ssimon# The location of the library which contains fipscanister.o
131194206Ssimon# normally it will be libcrypto unless fipsdso is set in which
132194206Ssimon# case it will be libfips. If not compiling in FIPS mode at all
133194206Ssimon# this is empty making it a useful test for a FIPS compile.
134194206Ssimon
135194206SsimonFIPSCANLIB=
136194206Ssimon
137194206Ssimon# Shared library base address. Currently only used on Windows.
138194206Ssimon#
139194206Ssimon
140194206SsimonBASEADDR=0xFB00000
141194206Ssimon
142160814SsimonDIRS=   crypto ssl engines apps test tools
143238405SjkimENGDIRS= ccgost
144160814SsimonSHLIBDIRS= crypto ssl
145142425Snectar
146142425Snectar# dirs in crypto to build
147160814SsimonSDIRS=  \
148160814Ssimon	objects \
149238405Sjkim	md4 md5 sha mdc2 hmac ripemd whrlpool \
150238405Sjkim	des aes rc2 rc4 idea bf cast camellia seed modes \
151160814Ssimon	bn ec rsa dsa ecdsa dh ecdh dso engine \
152142425Snectar	buffer bio stack lhash rand err \
153160814Ssimon	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
154238405Sjkim	cms pqueue ts srp cmac
155160814Ssimon# keep in mind that the above list is adjusted by ./Configure
156160814Ssimon# according to no-xxx arguments...
157142425Snectar
158142425Snectar# tests to perform.  "alltests" is a special word indicating that all tests
159142425Snectar# should be performed.
160142425SnectarTESTS = alltests
161142425Snectar
162142425SnectarMAKEFILE= Makefile
163142425Snectar
164142425SnectarMANDIR=$(OPENSSLDIR)/man
165142425SnectarMAN1=1
166142425SnectarMAN3=3
167142425SnectarMANSUFFIX=
168238405SjkimHTMLSUFFIX=html
169238405SjkimHTMLDIR=$(OPENSSLDIR)/html
170142425SnectarSHELL=/bin/sh
171142425Snectar
172142425SnectarTOP=    .
173142425SnectarONEDIRS=out tmp
174142425SnectarEDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
175142425SnectarWDIRS=  windows
176142425SnectarLIBS=   libcrypto.a libssl.a
177142425SnectarSHARED_CRYPTO=libcrypto$(SHLIB_EXT)
178142425SnectarSHARED_SSL=libssl$(SHLIB_EXT)
179142425SnectarSHARED_LIBS=
180142425SnectarSHARED_LIBS_LINK_EXTS=
181142425SnectarSHARED_LDFLAGS=
182142425Snectar
183142425SnectarGENERAL=        Makefile
184142425SnectarBASENAME=       openssl
185142425SnectarNAME=           $(BASENAME)-$(VERSION)
186295009SjkimTARFILE=        ../$(NAME).tar
187142425SnectarEXHEADER=       e_os2.h
188142425SnectarHEADER=         e_os.h
189142425Snectar
190284283Sjkimall: Makefile build_all
191142425Snectar
192160814Ssimon# as we stick to -e, CLEARENV ensures that local variables in lower
193160814Ssimon# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
194160814Ssimon# shell, which [annoyingly enough] terminates unset with error if VAR
195160814Ssimon# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
196160814Ssimon# which terminates unset with error if no variable was present:-(
197160814SsimonCLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
198160814Ssimon		$${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}	\
199160814Ssimon		$${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}		\
200160814Ssimon		$${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL}	\
201160814Ssimon		$${EXHEADER+EXHEADER} $${HEADER+HEADER}		\
202160814Ssimon		$${GENERAL+GENERAL} $${CFLAGS+CFLAGS}		\
203160814Ssimon		$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}		\
204238405Sjkim		$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS}	\
205160814Ssimon		$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}	\
206314125Sdelphij		$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}	\
207314125Sdelphij		$${APPS+APPS}
208142425Snectar
209291719Sjkim# LC_ALL=C ensures that error [and other] messages are delivered in
210291719Sjkim# same language for uniform treatment.
211291719SjkimBUILDENV=	LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
212238405Sjkim		CC='$(CC)' CFLAG='$(CFLAG)' 			\
213238405Sjkim		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
214238405Sjkim		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
215306198Sjkim		RC='$(RC)'              			\
216238405Sjkim		CROSS_COMPILE='$(CROSS_COMPILE)'	\
217238405Sjkim		PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'		\
218238405Sjkim		SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'	\
219238405Sjkim		INSTALL_PREFIX='$(INSTALL_PREFIX)'		\
220238405Sjkim		INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'	\
221238405Sjkim		LIBDIR='$(LIBDIR)'				\
222238405Sjkim		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
223238405Sjkim		DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'	\
224238405Sjkim		MAKEDEPPROG='$(MAKEDEPPROG)'			\
225238405Sjkim		SHARED_LDFLAGS='$(SHARED_LDFLAGS)'		\
226238405Sjkim		KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'	\
227238405Sjkim		ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'	\
228238405Sjkim		EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'	\
229238405Sjkim		SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)'	\
230238405Sjkim		PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'	\
231290207Sjkim		CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)'	\
232290207Sjkim		EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' 	\
233238405Sjkim		AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'	\
234238405Sjkim		BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'	\
235238405Sjkim		RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'	\
236238405Sjkim		SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'			\
237238405Sjkim		MD5_ASM_OBJ='$(MD5_ASM_OBJ)'			\
238238405Sjkim		RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'		\
239238405Sjkim		WP_ASM_OBJ='$(WP_ASM_OBJ)'			\
240238405Sjkim		MODES_ASM_OBJ='$(MODES_ASM_OBJ)'		\
241238405Sjkim		ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)'		\
242238405Sjkim		PERLASM_SCHEME='$(PERLASM_SCHEME)'		\
243194206Ssimon		FIPSLIBDIR='${FIPSLIBDIR}'			\
244238405Sjkim		FIPSDIR='${FIPSDIR}'				\
245194206Ssimon		FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"	\
246160814Ssimon		THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
247160814Ssimon# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
248160814Ssimon# which in turn eliminates ambiguities in variable treatment with -e.
249160814Ssimon
250160814Ssimon# BUILD_CMD is a generic macro to build a given target in a given
251160814Ssimon# subdirectory.  The target must be given through the shell variable
252160814Ssimon# `target' and the subdirectory to build in must be given through `dir'.
253160814Ssimon# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
254160814Ssimon# BUILD_ONE_CMD instead.
255160814Ssimon#
256160814Ssimon# BUILD_ONE_CMD is a macro to build a given target in a given
257160814Ssimon# subdirectory if that subdirectory is part of $(DIRS).  It requires
258160814Ssimon# exactly the same shell variables as BUILD_CMD.
259160814Ssimon#
260160814Ssimon# RECURSIVE_BUILD_CMD is a macro to build a given target in all
261160814Ssimon# subdirectories defined in $(DIRS).  It requires that the target
262160814Ssimon# is given through the shell variable `target'.
263160814SsimonBUILD_CMD=  if [ -d "$$dir" ]; then \
264238405Sjkim	    (	cd $$dir && echo "making $$target in $$dir..." && \
265160814Ssimon		$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
266160814Ssimon	    ) || exit 1; \
267160814Ssimon	    fi
268160814SsimonRECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
269160814SsimonBUILD_ONE_CMD=\
270238405Sjkim	if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
271160814Ssimon		$(BUILD_CMD); \
272142425Snectar	fi
273142425Snectar
274160814Ssimonreflect:
275160814Ssimon	@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
276142425Snectar
277160814Ssimonsub_all: build_all
278285329Sjkim
279160814Ssimonbuild_all: build_libs build_apps build_tests build_tools
280142425Snectar
281284283Sjkimbuild_libs: build_libcrypto build_libssl openssl.pc
282160814Ssimon
283284283Sjkimbuild_libcrypto: build_crypto build_engines libcrypto.pc
284284283Sjkimbuild_libssl: build_ssl libssl.pc
285284283Sjkim
286160814Ssimonbuild_crypto:
287238405Sjkim	@dir=crypto; target=all; $(BUILD_ONE_CMD)
288285329Sjkimbuild_ssl: build_crypto
289160814Ssimon	@dir=ssl; target=all; $(BUILD_ONE_CMD)
290285329Sjkimbuild_engines: build_crypto
291160814Ssimon	@dir=engines; target=all; $(BUILD_ONE_CMD)
292285329Sjkimbuild_apps: build_libs
293160814Ssimon	@dir=apps; target=all; $(BUILD_ONE_CMD)
294285329Sjkimbuild_tests: build_libs
295160814Ssimon	@dir=test; target=all; $(BUILD_ONE_CMD)
296285329Sjkimbuild_tools: build_libs
297160814Ssimon	@dir=tools; target=all; $(BUILD_ONE_CMD)
298160814Ssimon
299160814Ssimonall_testapps: build_libs build_testapps
300160814Ssimonbuild_testapps:
301160814Ssimon	@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
302160814Ssimon
303238405Sjkimfips_premain_dso$(EXE_EXT): libcrypto.a
304238405Sjkim	[ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
305238405Sjkim		-DFINGERPRINT_PREMAIN_DSO_LOAD -o $@  \
306238405Sjkim		$(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
307238405Sjkim		libcrypto.a $(EX_LIBS)
308238405Sjkim
309238405Sjkimlibcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
310142425Snectar	@if [ "$(SHLIB_TARGET)" != "" ]; then \
311238405Sjkim		if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
312238405Sjkim			FIPSLD_LIBCRYPTO=libcrypto.a ; \
313238405Sjkim			FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
314238405Sjkim			export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
315238405Sjkim		fi; \
316264278Sjkim		$(MAKE) -e SHLIBDIRS=crypto  CC="$${CC:-$(CC)}" build-shared && \
317264278Sjkim		(touch -c fips_premain_dso$(EXE_EXT) || :); \
318142425Snectar	else \
319142425Snectar		echo "There's no support for shared libraries on this platform" >&2; \
320160814Ssimon		exit 1; \
321142425Snectar	fi
322142425Snectar
323142425Snectarlibssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
324142425Snectar	@if [ "$(SHLIB_TARGET)" != "" ]; then \
325238405Sjkim		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
326142425Snectar	else \
327142425Snectar		echo "There's no support for shared libraries on this platform" >&2; \
328160814Ssimon		exit 1; \
329142425Snectar	fi
330142425Snectar
331142425Snectarclean-shared:
332160814Ssimon	@set -e; for i in $(SHLIBDIRS); do \
333142425Snectar		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
334142425Snectar			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
335142425Snectar			for j in $${tmp:-x}; do \
336142425Snectar				( set -x; rm -f lib$$i$$j ); \
337142425Snectar			done; \
338142425Snectar		fi; \
339142425Snectar		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
340290207Sjkim		if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
341160814Ssimon			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
342142425Snectar		fi; \
343142425Snectar	done
344142425Snectar
345142425Snectarlink-shared:
346238405Sjkim	@ set -e; for i in $(SHLIBDIRS); do \
347160814Ssimon		$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
348238405Sjkim			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
349238405Sjkim			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
350160814Ssimon			symlink.$(SHLIB_TARGET); \
351160814Ssimon		libs="$$libs -l$$i"; \
352142425Snectar	done
353142425Snectar
354160814Ssimonbuild-shared: do_$(SHLIB_TARGET) link-shared
355142425Snectar
356160814Ssimondo_$(SHLIB_TARGET):
357238405Sjkim	@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
358238405Sjkim		if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
359142425Snectar			libs="$(LIBKRB5) $$libs"; \
360142425Snectar		fi; \
361160814Ssimon		$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
362238405Sjkim			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
363238405Sjkim			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
364160814Ssimon			LIBDEPS="$$libs $(EX_LIBS)" \
365160814Ssimon			link_a.$(SHLIB_TARGET); \
366142425Snectar		libs="-l$$i $$libs"; \
367142425Snectar	done
368142425Snectar
369160814Ssimonlibcrypto.pc: Makefile
370160814Ssimon	@ ( echo 'prefix=$(INSTALLTOP)'; \
371160814Ssimon	    echo 'exec_prefix=$${prefix}'; \
372205128Ssimon	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
373160814Ssimon	    echo 'includedir=$${prefix}/include'; \
374306198Sjkim	    echo 'enginesdir=$${libdir}/engines'; \
375160814Ssimon	    echo ''; \
376160814Ssimon	    echo 'Name: OpenSSL-libcrypto'; \
377160814Ssimon	    echo 'Description: OpenSSL cryptography library'; \
378160814Ssimon	    echo 'Version: '$(VERSION); \
379160814Ssimon	    echo 'Requires: '; \
380238405Sjkim	    echo 'Libs: -L$${libdir} -lcrypto'; \
381238405Sjkim	    echo 'Libs.private: $(EX_LIBS)'; \
382160814Ssimon	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
383142425Snectar
384160814Ssimonlibssl.pc: Makefile
385160814Ssimon	@ ( echo 'prefix=$(INSTALLTOP)'; \
386160814Ssimon	    echo 'exec_prefix=$${prefix}'; \
387205128Ssimon	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
388160814Ssimon	    echo 'includedir=$${prefix}/include'; \
389160814Ssimon	    echo ''; \
390290207Sjkim	    echo 'Name: OpenSSL-libssl'; \
391160814Ssimon	    echo 'Description: Secure Sockets Layer and cryptography libraries'; \
392160814Ssimon	    echo 'Version: '$(VERSION); \
393290207Sjkim	    echo 'Requires.private: libcrypto'; \
394290207Sjkim	    echo 'Libs: -L$${libdir} -lssl'; \
395238405Sjkim	    echo 'Libs.private: $(EX_LIBS)'; \
396160814Ssimon	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
397142425Snectar
398142425Snectaropenssl.pc: Makefile
399142425Snectar	@ ( echo 'prefix=$(INSTALLTOP)'; \
400142425Snectar	    echo 'exec_prefix=$${prefix}'; \
401205128Ssimon	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
402142425Snectar	    echo 'includedir=$${prefix}/include'; \
403142425Snectar	    echo ''; \
404142425Snectar	    echo 'Name: OpenSSL'; \
405142425Snectar	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
406142425Snectar	    echo 'Version: '$(VERSION); \
407290207Sjkim	    echo 'Requires: libssl libcrypto' ) > openssl.pc
408142425Snectar
409160814SsimonMakefile: Makefile.org Configure config
410160814Ssimon	@echo "Makefile is older than Makefile.org, Configure or config."
411142425Snectar	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
412142425Snectar	@false
413142425Snectar
414142425Snectarlibclean:
415238405Sjkim	rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
416142425Snectar
417142425Snectarclean:	libclean
418142425Snectar	rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
419160814Ssimon	@set -e; target=clean; $(RECURSIVE_BUILD_CMD)
420160814Ssimon	rm -f $(LIBS)
421160814Ssimon	rm -f openssl.pc libssl.pc libcrypto.pc
422142425Snectar	rm -f speed.* .pure
423142425Snectar	rm -f $(TARFILE)
424160814Ssimon	@set -e; for i in $(ONEDIRS) ;\
425142425Snectar	do \
426142425Snectar	rm -fr $$i/*; \
427142425Snectar	done
428142425Snectar
429142425Snectarmakefile.one: files
430142425Snectar	$(PERL) util/mk1mf.pl >makefile.one; \
431142425Snectar	sh util/do_ms.sh
432142425Snectar
433142425Snectarfiles:
434142425Snectar	$(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
435160814Ssimon	@set -e; target=files; $(RECURSIVE_BUILD_CMD)
436142425Snectar
437142425Snectarlinks:
438142425Snectar	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
439142425Snectar	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
440160814Ssimon	@set -e; target=links; $(RECURSIVE_BUILD_CMD)
441142425Snectar
442142425Snectargentests:
443142425Snectar	@(cd test && echo "generating dummy tests (if needed)..." && \
444238405Sjkim	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
445142425Snectar
446142425Snectardclean:
447238405Sjkim	rm -rf *.bak include/openssl certs/.0
448160814Ssimon	@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
449142425Snectar
450142425Snectarrehash: rehash.time
451205128Ssimonrehash.time: certs apps
452205128Ssimon	@if [ -z "$(CROSS_COMPILE)" ]; then \
453205128Ssimon		(OPENSSL="`pwd`/util/opensslwrap.sh"; \
454238405Sjkim		[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
455205128Ssimon		OPENSSL_DEBUG_MEMORY=on; \
456205128Ssimon		export OPENSSL OPENSSL_DEBUG_MEMORY; \
457246772Sjkim		$(PERL) tools/c_rehash certs/demo) && \
458205128Ssimon		touch rehash.time; \
459238405Sjkim	else :; fi
460142425Snectar
461142425Snectartest:   tests
462142425Snectar
463142425Snectartests: rehash
464142425Snectar	@(cd test && echo "testing..." && \
465238405Sjkim	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
466238405Sjkim	OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
467142425Snectar
468142425Snectarreport:
469142425Snectar	@$(PERL) util/selftest.pl
470142425Snectar
471284283Sjkimupdate: errors stacks util/libeay.num util/ssleay.num TABLE
472284283Sjkim	@set -e; target=update; $(RECURSIVE_BUILD_CMD)
473284283Sjkim
474142425Snectardepend:
475160814Ssimon	@set -e; target=depend; $(RECURSIVE_BUILD_CMD)
476142425Snectar
477142425Snectarlint:
478160814Ssimon	@set -e; target=lint; $(RECURSIVE_BUILD_CMD)
479142425Snectar
480142425Snectartags:
481142425Snectar	rm -f TAGS
482142425Snectar	find . -name '[^.]*.[ch]' | xargs etags -a
483142425Snectar
484142425Snectarerrors:
485238405Sjkim	$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
486142425Snectar	$(PERL) util/mkerr.pl -recurse -write
487160814Ssimon	(cd engines; $(MAKE) PERL=$(PERL) errors)
488142425Snectar
489142425Snectarstacks:
490142425Snectar	$(PERL) util/mkstack.pl -write
491142425Snectar
492142425Snectarutil/libeay.num::
493142425Snectar	$(PERL) util/mkdef.pl crypto update
494142425Snectar
495142425Snectarutil/ssleay.num::
496142425Snectar	$(PERL) util/mkdef.pl ssl update
497142425Snectar
498142425SnectarTABLE: Configure
499142425Snectar	(echo 'Output of `Configure TABLE'"':"; \
500142425Snectar	$(PERL) Configure TABLE) > TABLE
501142425Snectar
502142425Snectar# Build distribution tar-file. As the list of files returned by "find" is
503142425Snectar# pretty long, on several platforms a "too many arguments" error or similar
504142425Snectar# would occur. Therefore the list of files is temporarily stored into a file
505142425Snectar# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
506142425Snectar# tar does not support the --files-from option.
507295009SjkimTAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
508295009Sjkim	                       --owner 0 --group 0 \
509295009Sjkim			       --transform 's|^|$(NAME)/|' \
510291719Sjkim			       -cvf -
511291719Sjkim
512295009Sjkim$(TARFILE).list:
513291719Sjkim	find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \
514291719Sjkim	       \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \
515295009Sjkim	       \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \
516295009Sjkim	       \! -name '.#*' \! -name '*~' \! -type l \
517295009Sjkim	    | sort > $(TARFILE).list
518291719Sjkim
519295009Sjkimtar: $(TARFILE).list
520142425Snectar	find . -type d -print | xargs chmod 755
521142425Snectar	find . -type f -print | xargs chmod a+r
522142425Snectar	find . -type f -perm -0100 -print | xargs chmod a+x
523295009Sjkim	$(TAR_COMMAND) | gzip --best > $(TARFILE).gz
524295009Sjkim	rm -f $(TARFILE).list
525295009Sjkim	ls -l $(TARFILE).gz
526142425Snectar
527295009Sjkimtar-snap: $(TARFILE).list
528295009Sjkim	$(TAR_COMMAND) > $(TARFILE)
529295009Sjkim	rm -f $(TARFILE).list
530295009Sjkim	ls -l $(TARFILE)
531142425Snectar
532142425Snectardist:   
533142425Snectar	$(PERL) Configure dist
534238405Sjkim	@$(MAKE) SDIRS='$(SDIRS)' clean
535295009Sjkim	@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
536142425Snectar
537142425Snectarinstall: all install_docs install_sw
538142425Snectar
539142425Snectarinstall_sw:
540142425Snectar	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
541205128Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
542205128Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
543205128Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
544142425Snectar		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
545142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
546142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
547142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
548160814Ssimon	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
549142425Snectar	do \
550142425Snectar	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
551142425Snectar	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
552142425Snectar	done;
553160814Ssimon	@set -e; target=install; $(RECURSIVE_BUILD_CMD)
554238405Sjkim	@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
555142425Snectar	do \
556142425Snectar		if [ -f "$$i" ]; then \
557142425Snectar		(       echo installing $$i; \
558205128Ssimon			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
559205128Ssimon			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
560205128Ssimon			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
561205128Ssimon			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
562142425Snectar		fi; \
563142425Snectar	done;
564160814Ssimon	@set -e; if [ -n "$(SHARED_LIBS)" ]; then \
565142425Snectar		tmp="$(SHARED_LIBS)"; \
566142425Snectar		for i in $${tmp:-x}; \
567142425Snectar		do \
568142425Snectar			if [ -f "$$i" -o -f "$$i.a" ]; then \
569142425Snectar			(       echo installing $$i; \
570290207Sjkim				if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
571160814Ssimon					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
572142425Snectar					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
573142425Snectar					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
574142425Snectar					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
575205128Ssimon					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
576205128Ssimon					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
577205128Ssimon					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
578290207Sjkim				else \
579290207Sjkim					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
580290207Sjkim					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
581290207Sjkim					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
582142425Snectar				fi ); \
583238405Sjkim				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
584238405Sjkim				(	case $$i in \
585238405Sjkim						*crypto*) i=libeay32.dll;; \
586238405Sjkim						*ssl*)    i=ssleay32.dll;; \
587238405Sjkim					esac; \
588238405Sjkim					echo installing $$i; \
589238405Sjkim	 				cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
590238405Sjkim	 				chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
591238405Sjkim	 				mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
592238405Sjkim				fi; \
593142425Snectar			fi; \
594142425Snectar		done; \
595142425Snectar		(	here="`pwd`"; \
596205128Ssimon			cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
597160814Ssimon			$(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
598142425Snectar		if [ "$(INSTALLTOP)" != "/usr" ]; then \
599142425Snectar			echo 'OpenSSL shared libraries have been installed in:'; \
600142425Snectar			echo '  $(INSTALLTOP)'; \
601142425Snectar			echo ''; \
602142425Snectar			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
603142425Snectar		fi; \
604142425Snectar	fi
605205128Ssimon	cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
606205128Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
607205128Ssimon	cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
608205128Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
609205128Ssimon	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
610205128Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
611142425Snectar
612238405Sjkiminstall_html_docs:
613238405Sjkim	here="`pwd`"; \
614290207Sjkim	filecase=; \
615290207Sjkim	case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
616290207Sjkim		filecase=-i; \
617290207Sjkim	esac; \
618238405Sjkim	for subdir in apps crypto ssl; do \
619238405Sjkim		mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
620238405Sjkim		for i in doc/$$subdir/*.pod; do \
621238405Sjkim			fn=`basename $$i .pod`; \
622238405Sjkim			echo "installing html/$$fn.$(HTMLSUFFIX)"; \
623238405Sjkim			cat $$i \
624238405Sjkim			| sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
625238405Sjkim			| pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
626238405Sjkim			| sed -r 's/<!DOCTYPE.*//g' \
627238405Sjkim			> $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
628238405Sjkim			$(PERL) util/extract-names.pl < $$i | \
629238405Sjkim				grep -v $$filecase "^$$fn\$$" | \
630238405Sjkim				(cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
631238405Sjkim				 while read n; do \
632238405Sjkim					PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
633238405Sjkim				 done); \
634238405Sjkim		done; \
635238405Sjkim	done
636238405Sjkim
637142425Snectarinstall_docs:
638142425Snectar	@$(PERL) $(TOP)/util/mkdir-p.pl \
639142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man1 \
640142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man3 \
641142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man5 \
642142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man7
643205128Ssimon	@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
644142425Snectar	here="`pwd`"; \
645142425Snectar	filecase=; \
646290207Sjkim	case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
647142425Snectar		filecase=-i; \
648290207Sjkim	esac; \
649160814Ssimon	set -e; for i in doc/apps/*.pod; do \
650142425Snectar		fn=`basename $$i .pod`; \
651160814Ssimon		sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
652142425Snectar		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
653142425Snectar		(cd `$(PERL) util/dirname.pl $$i`; \
654142425Snectar		sh -c "$$pod2man \
655142425Snectar			--section=$$sec --center=OpenSSL \
656142425Snectar			--release=$(VERSION) `basename $$i`") \
657142425Snectar			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
658142425Snectar		$(PERL) util/extract-names.pl < $$i | \
659160814Ssimon			(grep -v $$filecase "^$$fn\$$"; true) | \
660160814Ssimon			(grep -v "[	]"; true) | \
661142425Snectar			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
662142425Snectar			 while read n; do \
663238405Sjkim				PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
664142425Snectar			 done); \
665142425Snectar	done; \
666160814Ssimon	set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
667142425Snectar		fn=`basename $$i .pod`; \
668160814Ssimon		sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
669142425Snectar		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
670142425Snectar		(cd `$(PERL) util/dirname.pl $$i`; \
671142425Snectar		sh -c "$$pod2man \
672142425Snectar			--section=$$sec --center=OpenSSL \
673142425Snectar			--release=$(VERSION) `basename $$i`") \
674142425Snectar			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
675142425Snectar		$(PERL) util/extract-names.pl < $$i | \
676160814Ssimon			(grep -v $$filecase "^$$fn\$$"; true) | \
677160814Ssimon			(grep -v "[	]"; true) | \
678142425Snectar			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
679142425Snectar			 while read n; do \
680238405Sjkim				PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
681142425Snectar			 done); \
682142425Snectar	done
683142425Snectar
684142425Snectar# DO NOT DELETE THIS LINE -- make depend depends on it.
685