1142425Snectar### Generated automatically from Makefile.org by Configure.
2142425Snectar
3142425Snectar##
4142425Snectar## Makefile for OpenSSL
5142425Snectar##
6142425Snectar
7296317SdelphijVERSION=1.0.1s
8238405SjkimMAJOR=1
9238405SjkimMINOR=0.1
10238405SjkimSHLIB_VERSION_NUMBER=1.0.0
11142425SnectarSHLIB_VERSION_HISTORY=
12238405SjkimSHLIB_MAJOR=1
13238405SjkimSHLIB_MINOR=0.0
14142425SnectarSHLIB_EXT=
15142425SnectarPLATFORM=dist
16296317SdelphijOPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared 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
64296317SdelphijDEPFLAG= -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_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
71238405SjkimNM= nm
72167612SsimonPERL= /usr/bin/perl
73142425SnectarTAR= tar
74246772SjkimTARFLAGS= --no-recursion --record-size=10240
75142425SnectarMAKEDEPPROG=makedepend
76205128SsimonLIBDIR=lib
77142425Snectar
78142425Snectar# We let the C compiler driver to take care of .s files. This is done in
79142425Snectar# order to be excused from maintaining a separate set of architecture
80142425Snectar# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
81142425Snectar# gcc, then the driver will automatically translate it to -xarch=v8plus
82142425Snectar# and pass it down to assembler.
83142425SnectarAS=$(CC) -c
84142425SnectarASFLAG=$(CFLAG)
85142425Snectar
86142425Snectar# For x86 assembler: Set PROCESSOR to 386 if you want to support
87142425Snectar# the 80386.
88142425SnectarPROCESSOR= 
89142425Snectar
90160814Ssimon# CPUID module collects small commonly used assembler snippets
91238405SjkimCPUID_OBJ= mem_clr.o
92160814SsimonBN_ASM= bn_asm.o
93142425SnectarDES_ENC= des_enc.o fcrypt_b.o
94238405SjkimAES_ENC= aes_core.o aes_cbc.o
95142425SnectarBF_ENC= bf_enc.o
96142425SnectarCAST_ENC= c_enc.o
97194206SsimonRC4_ENC= rc4_enc.o rc4_skey.o
98142425SnectarRC5_ENC= rc5_enc.o
99142425SnectarMD5_ASM_OBJ= 
100142425SnectarSHA1_ASM_OBJ= 
101142425SnectarRMD160_ASM_OBJ= 
102238405SjkimWP_ASM_OBJ= wp_block.o
103238405SjkimCMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o
104238405SjkimMODES_ASM_OBJ= 
105238405SjkimENGINES_ASM_OBJ= 
106238405SjkimPERLASM_SCHEME= 
107142425Snectar
108142425Snectar# KRB5 stuff
109142425SnectarKRB5_INCLUDES=
110142425SnectarLIBKRB5=
111142425Snectar
112160814Ssimon# Zlib stuff
113160814SsimonZLIB_INCLUDE=
114160814SsimonLIBZLIB=
115142425Snectar
116238405Sjkim# TOP level FIPS install directory.
117238405SjkimFIPSDIR=/usr/local/ssl/fips-2.0
118238405Sjkim
119194206Ssimon# This is the location of fipscanister.o and friends.
120194206Ssimon# The FIPS module build will place it $(INSTALLTOP)/lib
121194206Ssimon# but since $(INSTALLTOP) can only take the default value
122194206Ssimon# when the module is built it will be in /usr/local/ssl/lib
123238405Sjkim# $(INSTALLTOP) for this build may be different so hard
124194206Ssimon# code the path.
125194206Ssimon
126238405SjkimFIPSLIBDIR=
127194206Ssimon
128194206Ssimon# The location of the library which contains fipscanister.o
129194206Ssimon# normally it will be libcrypto unless fipsdso is set in which
130194206Ssimon# case it will be libfips. If not compiling in FIPS mode at all
131194206Ssimon# this is empty making it a useful test for a FIPS compile.
132194206Ssimon
133194206SsimonFIPSCANLIB=
134194206Ssimon
135194206Ssimon# Shared library base address. Currently only used on Windows.
136194206Ssimon#
137194206Ssimon
138194206SsimonBASEADDR=0xFB00000
139194206Ssimon
140160814SsimonDIRS=   crypto ssl engines apps test tools
141238405SjkimENGDIRS= ccgost
142160814SsimonSHLIBDIRS= crypto ssl
143142425Snectar
144142425Snectar# dirs in crypto to build
145160814SsimonSDIRS=  \
146160814Ssimon	objects \
147238405Sjkim	md4 md5 sha mdc2 hmac ripemd whrlpool \
148238405Sjkim	des aes rc2 rc4 idea bf cast camellia seed modes \
149160814Ssimon	bn ec rsa dsa ecdsa dh ecdh dso engine \
150142425Snectar	buffer bio stack lhash rand err \
151160814Ssimon	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
152238405Sjkim	cms pqueue ts srp cmac
153160814Ssimon# keep in mind that the above list is adjusted by ./Configure
154160814Ssimon# according to no-xxx arguments...
155142425Snectar
156142425Snectar# tests to perform.  "alltests" is a special word indicating that all tests
157142425Snectar# should be performed.
158142425SnectarTESTS = alltests
159142425Snectar
160142425SnectarMAKEFILE= Makefile
161142425Snectar
162142425SnectarMANDIR=$(OPENSSLDIR)/man
163142425SnectarMAN1=1
164142425SnectarMAN3=3
165142425SnectarMANSUFFIX=
166238405SjkimHTMLSUFFIX=html
167238405SjkimHTMLDIR=$(OPENSSLDIR)/html
168142425SnectarSHELL=/bin/sh
169142425Snectar
170142425SnectarTOP=    .
171142425SnectarONEDIRS=out tmp
172142425SnectarEDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
173142425SnectarWDIRS=  windows
174142425SnectarLIBS=   libcrypto.a libssl.a
175142425SnectarSHARED_CRYPTO=libcrypto$(SHLIB_EXT)
176142425SnectarSHARED_SSL=libssl$(SHLIB_EXT)
177142425SnectarSHARED_LIBS=
178142425SnectarSHARED_LIBS_LINK_EXTS=
179142425SnectarSHARED_LDFLAGS=
180142425Snectar
181142425SnectarGENERAL=        Makefile
182142425SnectarBASENAME=       openssl
183142425SnectarNAME=           $(BASENAME)-$(VERSION)
184295016SjkimTARFILE=        ../$(NAME).tar
185142425SnectarEXHEADER=       e_os2.h
186142425SnectarHEADER=         e_os.h
187142425Snectar
188284285Sjkimall: Makefile build_all
189142425Snectar
190160814Ssimon# as we stick to -e, CLEARENV ensures that local variables in lower
191160814Ssimon# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
192160814Ssimon# shell, which [annoyingly enough] terminates unset with error if VAR
193160814Ssimon# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
194160814Ssimon# which terminates unset with error if no variable was present:-(
195160814SsimonCLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
196160814Ssimon		$${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}	\
197160814Ssimon		$${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}		\
198160814Ssimon		$${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL}	\
199160814Ssimon		$${EXHEADER+EXHEADER} $${HEADER+HEADER}		\
200160814Ssimon		$${GENERAL+GENERAL} $${CFLAGS+CFLAGS}		\
201160814Ssimon		$${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}		\
202238405Sjkim		$${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS}	\
203160814Ssimon		$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}	\
204160814Ssimon		$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
205142425Snectar
206238405SjkimBUILDENV=	PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
207238405Sjkim		CC='$(CC)' CFLAG='$(CFLAG)' 			\
208238405Sjkim		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
209238405Sjkim		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
210238405Sjkim		CROSS_COMPILE='$(CROSS_COMPILE)'	\
211238405Sjkim		PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'		\
212238405Sjkim		SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'	\
213238405Sjkim		INSTALL_PREFIX='$(INSTALL_PREFIX)'		\
214238405Sjkim		INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'	\
215238405Sjkim		LIBDIR='$(LIBDIR)'				\
216238405Sjkim		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
217238405Sjkim		DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'	\
218238405Sjkim		MAKEDEPPROG='$(MAKEDEPPROG)'			\
219238405Sjkim		SHARED_LDFLAGS='$(SHARED_LDFLAGS)'		\
220238405Sjkim		KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'	\
221238405Sjkim		ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'	\
222238405Sjkim		EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'	\
223238405Sjkim		SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)'	\
224238405Sjkim		PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'	\
225238405Sjkim		CPUID_OBJ='$(CPUID_OBJ)'			\
226238405Sjkim		BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' 	\
227238405Sjkim		AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'	\
228238405Sjkim		BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'	\
229238405Sjkim		RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'	\
230238405Sjkim		SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'			\
231238405Sjkim		MD5_ASM_OBJ='$(MD5_ASM_OBJ)'			\
232238405Sjkim		RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'		\
233238405Sjkim		WP_ASM_OBJ='$(WP_ASM_OBJ)'			\
234238405Sjkim		MODES_ASM_OBJ='$(MODES_ASM_OBJ)'		\
235238405Sjkim		ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)'		\
236238405Sjkim		PERLASM_SCHEME='$(PERLASM_SCHEME)'		\
237194206Ssimon		FIPSLIBDIR='${FIPSLIBDIR}'			\
238238405Sjkim		FIPSDIR='${FIPSDIR}'				\
239194206Ssimon		FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"	\
240160814Ssimon		THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
241160814Ssimon# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
242160814Ssimon# which in turn eliminates ambiguities in variable treatment with -e.
243160814Ssimon
244160814Ssimon# BUILD_CMD is a generic macro to build a given target in a given
245160814Ssimon# subdirectory.  The target must be given through the shell variable
246160814Ssimon# `target' and the subdirectory to build in must be given through `dir'.
247160814Ssimon# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
248160814Ssimon# BUILD_ONE_CMD instead.
249160814Ssimon#
250160814Ssimon# BUILD_ONE_CMD is a macro to build a given target in a given
251160814Ssimon# subdirectory if that subdirectory is part of $(DIRS).  It requires
252160814Ssimon# exactly the same shell variables as BUILD_CMD.
253160814Ssimon#
254160814Ssimon# RECURSIVE_BUILD_CMD is a macro to build a given target in all
255160814Ssimon# subdirectories defined in $(DIRS).  It requires that the target
256160814Ssimon# is given through the shell variable `target'.
257160814SsimonBUILD_CMD=  if [ -d "$$dir" ]; then \
258238405Sjkim	    (	cd $$dir && echo "making $$target in $$dir..." && \
259160814Ssimon		$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
260160814Ssimon	    ) || exit 1; \
261160814Ssimon	    fi
262160814SsimonRECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
263160814SsimonBUILD_ONE_CMD=\
264238405Sjkim	if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
265160814Ssimon		$(BUILD_CMD); \
266142425Snectar	fi
267142425Snectar
268160814Ssimonreflect:
269160814Ssimon	@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
270142425Snectar
271160814Ssimonsub_all: build_all
272285330Sjkim
273160814Ssimonbuild_all: build_libs build_apps build_tests build_tools
274142425Snectar
275284285Sjkimbuild_libs: build_libcrypto build_libssl openssl.pc
276160814Ssimon
277284285Sjkimbuild_libcrypto: build_crypto build_engines libcrypto.pc
278284285Sjkimbuild_libssl: build_ssl libssl.pc
279284285Sjkim
280160814Ssimonbuild_crypto:
281238405Sjkim	@dir=crypto; target=all; $(BUILD_ONE_CMD)
282285330Sjkimbuild_ssl: build_crypto
283160814Ssimon	@dir=ssl; target=all; $(BUILD_ONE_CMD)
284285330Sjkimbuild_engines: build_crypto
285160814Ssimon	@dir=engines; target=all; $(BUILD_ONE_CMD)
286285330Sjkimbuild_apps: build_libs
287160814Ssimon	@dir=apps; target=all; $(BUILD_ONE_CMD)
288285330Sjkimbuild_tests: build_libs
289160814Ssimon	@dir=test; target=all; $(BUILD_ONE_CMD)
290285330Sjkimbuild_tools: build_libs
291160814Ssimon	@dir=tools; target=all; $(BUILD_ONE_CMD)
292160814Ssimon
293160814Ssimonall_testapps: build_libs build_testapps
294160814Ssimonbuild_testapps:
295160814Ssimon	@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
296160814Ssimon
297238405Sjkimfips_premain_dso$(EXE_EXT): libcrypto.a
298238405Sjkim	[ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
299238405Sjkim		-DFINGERPRINT_PREMAIN_DSO_LOAD -o $@  \
300238405Sjkim		$(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
301238405Sjkim		libcrypto.a $(EX_LIBS)
302238405Sjkim
303238405Sjkimlibcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
304142425Snectar	@if [ "$(SHLIB_TARGET)" != "" ]; then \
305238405Sjkim		if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
306238405Sjkim			FIPSLD_LIBCRYPTO=libcrypto.a ; \
307238405Sjkim			FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
308238405Sjkim			export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
309238405Sjkim		fi; \
310264331Sjkim		$(MAKE) -e SHLIBDIRS=crypto  CC="$${CC:-$(CC)}" build-shared && \
311264331Sjkim		(touch -c fips_premain_dso$(EXE_EXT) || :); \
312142425Snectar	else \
313142425Snectar		echo "There's no support for shared libraries on this platform" >&2; \
314160814Ssimon		exit 1; \
315142425Snectar	fi
316142425Snectar
317142425Snectarlibssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
318142425Snectar	@if [ "$(SHLIB_TARGET)" != "" ]; then \
319238405Sjkim		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
320142425Snectar	else \
321142425Snectar		echo "There's no support for shared libraries on this platform" >&2; \
322160814Ssimon		exit 1; \
323142425Snectar	fi
324142425Snectar
325142425Snectarclean-shared:
326160814Ssimon	@set -e; for i in $(SHLIBDIRS); do \
327142425Snectar		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
328142425Snectar			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
329142425Snectar			for j in $${tmp:-x}; do \
330142425Snectar				( set -x; rm -f lib$$i$$j ); \
331142425Snectar			done; \
332142425Snectar		fi; \
333142425Snectar		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
334142425Snectar		if [ "$(PLATFORM)" = "Cygwin" ]; then \
335160814Ssimon			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
336142425Snectar		fi; \
337142425Snectar	done
338142425Snectar
339142425Snectarlink-shared:
340238405Sjkim	@ set -e; for i in $(SHLIBDIRS); do \
341160814Ssimon		$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
342238405Sjkim			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
343238405Sjkim			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
344160814Ssimon			symlink.$(SHLIB_TARGET); \
345160814Ssimon		libs="$$libs -l$$i"; \
346142425Snectar	done
347142425Snectar
348160814Ssimonbuild-shared: do_$(SHLIB_TARGET) link-shared
349142425Snectar
350160814Ssimondo_$(SHLIB_TARGET):
351238405Sjkim	@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
352238405Sjkim		if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
353142425Snectar			libs="$(LIBKRB5) $$libs"; \
354142425Snectar		fi; \
355160814Ssimon		$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
356238405Sjkim			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
357238405Sjkim			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
358160814Ssimon			LIBDEPS="$$libs $(EX_LIBS)" \
359160814Ssimon			link_a.$(SHLIB_TARGET); \
360142425Snectar		libs="-l$$i $$libs"; \
361142425Snectar	done
362142425Snectar
363160814Ssimonlibcrypto.pc: Makefile
364160814Ssimon	@ ( echo 'prefix=$(INSTALLTOP)'; \
365160814Ssimon	    echo 'exec_prefix=$${prefix}'; \
366205128Ssimon	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
367160814Ssimon	    echo 'includedir=$${prefix}/include'; \
368160814Ssimon	    echo ''; \
369160814Ssimon	    echo 'Name: OpenSSL-libcrypto'; \
370160814Ssimon	    echo 'Description: OpenSSL cryptography library'; \
371160814Ssimon	    echo 'Version: '$(VERSION); \
372160814Ssimon	    echo 'Requires: '; \
373238405Sjkim	    echo 'Libs: -L$${libdir} -lcrypto'; \
374238405Sjkim	    echo 'Libs.private: $(EX_LIBS)'; \
375160814Ssimon	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
376142425Snectar
377160814Ssimonlibssl.pc: Makefile
378160814Ssimon	@ ( echo 'prefix=$(INSTALLTOP)'; \
379160814Ssimon	    echo 'exec_prefix=$${prefix}'; \
380205128Ssimon	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
381160814Ssimon	    echo 'includedir=$${prefix}/include'; \
382160814Ssimon	    echo ''; \
383160814Ssimon	    echo 'Name: OpenSSL'; \
384160814Ssimon	    echo 'Description: Secure Sockets Layer and cryptography libraries'; \
385160814Ssimon	    echo 'Version: '$(VERSION); \
386160814Ssimon	    echo 'Requires: '; \
387238405Sjkim	    echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
388238405Sjkim	    echo 'Libs.private: $(EX_LIBS)'; \
389160814Ssimon	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
390142425Snectar
391142425Snectaropenssl.pc: Makefile
392142425Snectar	@ ( echo 'prefix=$(INSTALLTOP)'; \
393142425Snectar	    echo 'exec_prefix=$${prefix}'; \
394205128Ssimon	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
395142425Snectar	    echo 'includedir=$${prefix}/include'; \
396142425Snectar	    echo ''; \
397142425Snectar	    echo 'Name: OpenSSL'; \
398142425Snectar	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
399142425Snectar	    echo 'Version: '$(VERSION); \
400142425Snectar	    echo 'Requires: '; \
401238405Sjkim	    echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
402238405Sjkim	    echo 'Libs.private: $(EX_LIBS)'; \
403142425Snectar	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
404142425Snectar
405160814SsimonMakefile: Makefile.org Configure config
406160814Ssimon	@echo "Makefile is older than Makefile.org, Configure or config."
407142425Snectar	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
408142425Snectar	@false
409142425Snectar
410142425Snectarlibclean:
411238405Sjkim	rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
412142425Snectar
413142425Snectarclean:	libclean
414142425Snectar	rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
415160814Ssimon	@set -e; target=clean; $(RECURSIVE_BUILD_CMD)
416160814Ssimon	rm -f $(LIBS)
417160814Ssimon	rm -f openssl.pc libssl.pc libcrypto.pc
418142425Snectar	rm -f speed.* .pure
419142425Snectar	rm -f $(TARFILE)
420160814Ssimon	@set -e; for i in $(ONEDIRS) ;\
421142425Snectar	do \
422142425Snectar	rm -fr $$i/*; \
423142425Snectar	done
424142425Snectar
425142425Snectarmakefile.one: files
426142425Snectar	$(PERL) util/mk1mf.pl >makefile.one; \
427142425Snectar	sh util/do_ms.sh
428142425Snectar
429142425Snectarfiles:
430142425Snectar	$(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
431160814Ssimon	@set -e; target=files; $(RECURSIVE_BUILD_CMD)
432142425Snectar
433142425Snectarlinks:
434142425Snectar	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
435142425Snectar	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
436160814Ssimon	@set -e; target=links; $(RECURSIVE_BUILD_CMD)
437142425Snectar
438142425Snectargentests:
439142425Snectar	@(cd test && echo "generating dummy tests (if needed)..." && \
440238405Sjkim	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
441142425Snectar
442142425Snectardclean:
443238405Sjkim	rm -rf *.bak include/openssl certs/.0
444160814Ssimon	@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
445142425Snectar
446142425Snectarrehash: rehash.time
447205128Ssimonrehash.time: certs apps
448205128Ssimon	@if [ -z "$(CROSS_COMPILE)" ]; then \
449205128Ssimon		(OPENSSL="`pwd`/util/opensslwrap.sh"; \
450238405Sjkim		[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
451205128Ssimon		OPENSSL_DEBUG_MEMORY=on; \
452205128Ssimon		export OPENSSL OPENSSL_DEBUG_MEMORY; \
453246772Sjkim		$(PERL) tools/c_rehash certs/demo) && \
454205128Ssimon		touch rehash.time; \
455238405Sjkim	else :; fi
456142425Snectar
457142425Snectartest:   tests
458142425Snectar
459142425Snectartests: rehash
460142425Snectar	@(cd test && echo "testing..." && \
461238405Sjkim	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
462238405Sjkim	OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
463142425Snectar
464142425Snectarreport:
465142425Snectar	@$(PERL) util/selftest.pl
466142425Snectar
467284285Sjkimupdate: errors stacks util/libeay.num util/ssleay.num TABLE
468284285Sjkim	@set -e; target=update; $(RECURSIVE_BUILD_CMD)
469284285Sjkim
470142425Snectardepend:
471160814Ssimon	@set -e; target=depend; $(RECURSIVE_BUILD_CMD)
472142425Snectar
473142425Snectarlint:
474160814Ssimon	@set -e; target=lint; $(RECURSIVE_BUILD_CMD)
475142425Snectar
476142425Snectartags:
477142425Snectar	rm -f TAGS
478142425Snectar	find . -name '[^.]*.[ch]' | xargs etags -a
479142425Snectar
480142425Snectarerrors:
481238405Sjkim	$(PERL) util/ck_errf.pl -strict */*.c */*/*.c
482142425Snectar	$(PERL) util/mkerr.pl -recurse -write
483160814Ssimon	(cd engines; $(MAKE) PERL=$(PERL) errors)
484142425Snectar
485142425Snectarstacks:
486142425Snectar	$(PERL) util/mkstack.pl -write
487142425Snectar
488142425Snectarutil/libeay.num::
489142425Snectar	$(PERL) util/mkdef.pl crypto update
490142425Snectar
491142425Snectarutil/ssleay.num::
492142425Snectar	$(PERL) util/mkdef.pl ssl update
493142425Snectar
494142425SnectarTABLE: Configure
495142425Snectar	(echo 'Output of `Configure TABLE'"':"; \
496142425Snectar	$(PERL) Configure TABLE) > TABLE
497142425Snectar
498142425Snectar# Build distribution tar-file. As the list of files returned by "find" is
499142425Snectar# pretty long, on several platforms a "too many arguments" error or similar
500142425Snectar# would occur. Therefore the list of files is temporarily stored into a file
501142425Snectar# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
502142425Snectar# tar does not support the --files-from option.
503295016SjkimTAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
504295016Sjkim	                       --owner 0 --group 0 \
505295016Sjkim			       --transform 's|^|$(NAME)/|' \
506291721Sjkim			       -cvf -
507291721Sjkim
508295016Sjkim$(TARFILE).list:
509291721Sjkim	find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \
510291721Sjkim	       \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \
511295016Sjkim	       \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \
512295016Sjkim	       \! -name '.#*' \! -name '*~' \! -type l \
513295016Sjkim	    | sort > $(TARFILE).list
514291721Sjkim
515295016Sjkimtar: $(TARFILE).list
516142425Snectar	find . -type d -print | xargs chmod 755
517142425Snectar	find . -type f -print | xargs chmod a+r
518142425Snectar	find . -type f -perm -0100 -print | xargs chmod a+x
519295016Sjkim	$(TAR_COMMAND) | gzip --best > $(TARFILE).gz
520295016Sjkim	rm -f $(TARFILE).list
521295016Sjkim	ls -l $(TARFILE).gz
522142425Snectar
523295016Sjkimtar-snap: $(TARFILE).list
524295016Sjkim	$(TAR_COMMAND) > $(TARFILE)
525295016Sjkim	rm -f $(TARFILE).list
526295016Sjkim	ls -l $(TARFILE)
527142425Snectar
528142425Snectardist:   
529142425Snectar	$(PERL) Configure dist
530238405Sjkim	@$(MAKE) SDIRS='$(SDIRS)' clean
531295016Sjkim	@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
532142425Snectar
533142425Snectarinstall: all install_docs install_sw
534142425Snectar
535142425Snectarinstall_sw:
536142425Snectar	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
537205128Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
538205128Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
539205128Ssimon		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
540142425Snectar		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
541142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
542142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
543142425Snectar		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
544160814Ssimon	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
545142425Snectar	do \
546142425Snectar	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
547142425Snectar	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
548142425Snectar	done;
549160814Ssimon	@set -e; target=install; $(RECURSIVE_BUILD_CMD)
550238405Sjkim	@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
551142425Snectar	do \
552142425Snectar		if [ -f "$$i" ]; then \
553142425Snectar		(       echo installing $$i; \
554205128Ssimon			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
555205128Ssimon			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
556205128Ssimon			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
557205128Ssimon			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
558142425Snectar		fi; \
559142425Snectar	done;
560160814Ssimon	@set -e; if [ -n "$(SHARED_LIBS)" ]; then \
561142425Snectar		tmp="$(SHARED_LIBS)"; \
562142425Snectar		for i in $${tmp:-x}; \
563142425Snectar		do \
564142425Snectar			if [ -f "$$i" -o -f "$$i.a" ]; then \
565142425Snectar			(       echo installing $$i; \
566142425Snectar				if [ "$(PLATFORM)" != "Cygwin" ]; then \
567205128Ssimon					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
568205128Ssimon					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
569205128Ssimon					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
570142425Snectar				else \
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; \
578142425Snectar				fi ); \
579238405Sjkim				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
580238405Sjkim				(	case $$i in \
581238405Sjkim						*crypto*) i=libeay32.dll;; \
582238405Sjkim						*ssl*)    i=ssleay32.dll;; \
583238405Sjkim					esac; \
584238405Sjkim					echo installing $$i; \
585238405Sjkim	 				cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
586238405Sjkim	 				chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
587238405Sjkim	 				mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
588238405Sjkim				fi; \
589142425Snectar			fi; \
590142425Snectar		done; \
591142425Snectar		(	here="`pwd`"; \
592205128Ssimon			cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
593160814Ssimon			$(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
594142425Snectar		if [ "$(INSTALLTOP)" != "/usr" ]; then \
595142425Snectar			echo 'OpenSSL shared libraries have been installed in:'; \
596142425Snectar			echo '  $(INSTALLTOP)'; \
597142425Snectar			echo ''; \
598142425Snectar			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
599142425Snectar		fi; \
600142425Snectar	fi
601205128Ssimon	cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
602205128Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
603205128Ssimon	cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
604205128Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
605205128Ssimon	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
606205128Ssimon	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
607142425Snectar
608238405Sjkiminstall_html_docs:
609238405Sjkim	here="`pwd`"; \
610238405Sjkim	for subdir in apps crypto ssl; do \
611238405Sjkim		mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
612238405Sjkim		for i in doc/$$subdir/*.pod; do \
613238405Sjkim			fn=`basename $$i .pod`; \
614238405Sjkim			echo "installing html/$$fn.$(HTMLSUFFIX)"; \
615238405Sjkim			cat $$i \
616238405Sjkim			| sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
617238405Sjkim			| pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
618238405Sjkim			| sed -r 's/<!DOCTYPE.*//g' \
619238405Sjkim			> $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
620238405Sjkim			$(PERL) util/extract-names.pl < $$i | \
621238405Sjkim				grep -v $$filecase "^$$fn\$$" | \
622238405Sjkim				(cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
623238405Sjkim				 while read n; do \
624238405Sjkim					PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
625238405Sjkim				 done); \
626238405Sjkim		done; \
627238405Sjkim	done
628238405Sjkim
629142425Snectarinstall_docs:
630142425Snectar	@$(PERL) $(TOP)/util/mkdir-p.pl \
631142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man1 \
632142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man3 \
633142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man5 \
634142425Snectar		$(INSTALL_PREFIX)$(MANDIR)/man7
635205128Ssimon	@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
636142425Snectar	here="`pwd`"; \
637142425Snectar	filecase=; \
638160814Ssimon	if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
639142425Snectar		filecase=-i; \
640142425Snectar	fi; \
641160814Ssimon	set -e; for i in doc/apps/*.pod; do \
642142425Snectar		fn=`basename $$i .pod`; \
643160814Ssimon		sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
644142425Snectar		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
645142425Snectar		(cd `$(PERL) util/dirname.pl $$i`; \
646142425Snectar		sh -c "$$pod2man \
647142425Snectar			--section=$$sec --center=OpenSSL \
648142425Snectar			--release=$(VERSION) `basename $$i`") \
649142425Snectar			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
650142425Snectar		$(PERL) util/extract-names.pl < $$i | \
651160814Ssimon			(grep -v $$filecase "^$$fn\$$"; true) | \
652160814Ssimon			(grep -v "[	]"; true) | \
653142425Snectar			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
654142425Snectar			 while read n; do \
655238405Sjkim				PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
656142425Snectar			 done); \
657142425Snectar	done; \
658160814Ssimon	set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
659142425Snectar		fn=`basename $$i .pod`; \
660160814Ssimon		sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
661142425Snectar		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
662142425Snectar		(cd `$(PERL) util/dirname.pl $$i`; \
663142425Snectar		sh -c "$$pod2man \
664142425Snectar			--section=$$sec --center=OpenSSL \
665142425Snectar			--release=$(VERSION) `basename $$i`") \
666142425Snectar			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
667142425Snectar		$(PERL) util/extract-names.pl < $$i | \
668160814Ssimon			(grep -v $$filecase "^$$fn\$$"; true) | \
669160814Ssimon			(grep -v "[	]"; true) | \
670142425Snectar			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
671142425Snectar			 while read n; do \
672238405Sjkim				PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
673142425Snectar			 done); \
674142425Snectar	done
675142425Snectar
676142425Snectar# DO NOT DELETE THIS LINE -- make depend depends on it.
677