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