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