]> CyberLeo.Net >> Repos - FreeBSD/releng/9.3.git/blob - crypto/openssl/Makefile
Fix multiple OpenSSL vulnerabilities.
[FreeBSD/releng/9.3.git] / crypto / openssl / Makefile
1 ### Generated automatically from Makefile.org by Configure.
2
3 ##
4 ## Makefile for OpenSSL
5 ##
6
7 VERSION=0.9.8zh
8 MAJOR=0
9 MINOR=9.8
10 SHLIB_VERSION_NUMBER=0.9.8
11 SHLIB_VERSION_HISTORY=
12 SHLIB_MAJOR=0
13 SHLIB_MINOR=9.8
14 SHLIB_EXT=
15 PLATFORM=dist
16 OPTIONS= no-camellia no-capieng no-cms no-gmp no-jpake no-krb5 no-mdc2 no-montasm no-rc5 no-rfc3779 no-seed no-shared no-zlib no-zlib-dynamic
17 CONFIGURE_ARGS=dist
18 SHLIB_TARGET=
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.
23 HERE=.
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.
28 INSTALL_PREFIX=
29 INSTALLTOP=/usr/local/ssl
30
31 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
32 OPENSSLDIR=/usr/local/ssl
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
62 CC= cc
63 CFLAG= -O
64 DEPFLAG= -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED
65 PEX_LIBS= 
66 EX_LIBS= 
67 EXE_EXT= 
68 ARFLAGS= 
69 AR= ar $(ARFLAGS) r
70 ARD=ar $(ARFLAGS) d
71 RANLIB= /usr/bin/ranlib
72 PERL= /usr/bin/perl
73 TAR= tar
74 TARFLAGS= --no-recursion --record-size=10240
75 MAKEDEPPROG=makedepend
76 LIBDIR=lib
77
78 # We let the C compiler driver to take care of .s files. This is done in
79 # order to be excused from maintaining a separate set of architecture
80 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
81 # gcc, then the driver will automatically translate it to -xarch=v8plus
82 # and pass it down to assembler.
83 AS=$(CC) -c
84 ASFLAG=$(CFLAG)
85
86 # For x86 assembler: Set PROCESSOR to 386 if you want to support
87 # the 80386.
88 PROCESSOR= 
89
90 # CPUID module collects small commonly used assembler snippets
91 CPUID_OBJ= 
92 BN_ASM= bn_asm.o
93 DES_ENC= des_enc.o fcrypt_b.o
94 AES_ASM_OBJ= aes_core.o aes_cbc.o
95 BF_ENC= bf_enc.o
96 CAST_ENC= c_enc.o
97 RC4_ENC= rc4_enc.o rc4_skey.o
98 RC5_ENC= rc5_enc.o
99 MD5_ASM_OBJ= 
100 SHA1_ASM_OBJ= 
101 RMD160_ASM_OBJ= 
102
103 # KRB5 stuff
104 KRB5_INCLUDES=
105 LIBKRB5=
106
107 # Zlib stuff
108 ZLIB_INCLUDE=
109 LIBZLIB=
110
111 # This is the location of fipscanister.o and friends.
112 # The FIPS module build will place it $(INSTALLTOP)/lib
113 # but since $(INSTALLTOP) can only take the default value
114 # when the module is built it will be in /usr/local/ssl/lib
115 # $(INSTALLTOP) for this build make be different so hard
116 # code the path.
117
118 FIPSLIBDIR=/usr/local/ssl/fips-1.0/lib/
119
120 # This is set to "y" if fipscanister.o is compiled internally as
121 # opposed to coming from an external validated location.
122
123 FIPSCANISTERINTERNAL=n
124
125 # The location of the library which contains fipscanister.o
126 # normally it will be libcrypto unless fipsdso is set in which
127 # case it will be libfips. If not compiling in FIPS mode at all
128 # this is empty making it a useful test for a FIPS compile.
129
130 FIPSCANLIB=
131
132 # Shared library base address. Currently only used on Windows.
133 #
134
135 BASEADDR=0xFB00000
136
137 DIRS=   crypto ssl engines apps test tools
138 SHLIBDIRS= crypto ssl
139
140 # dirs in crypto to build
141 SDIRS=  \
142         objects \
143         md2 md4 md5 sha hmac ripemd \
144         des aes rc2 rc4 idea bf cast \
145         bn ec rsa dsa ecdsa dh ecdh dso engine \
146         buffer bio stack lhash rand err \
147         evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
148         store pqueue
149 # keep in mind that the above list is adjusted by ./Configure
150 # according to no-xxx arguments...
151
152 # tests to perform.  "alltests" is a special word indicating that all tests
153 # should be performed.
154 TESTS = alltests
155
156 MAKEFILE= Makefile
157
158 MANDIR=$(OPENSSLDIR)/man
159 MAN1=1
160 MAN3=3
161 MANSUFFIX=
162 SHELL=/bin/sh
163
164 TOP=    .
165 ONEDIRS=out tmp
166 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
167 WDIRS=  windows
168 LIBS=   libcrypto.a libssl.a
169 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
170 SHARED_SSL=libssl$(SHLIB_EXT)
171 SHARED_FIPS=
172 SHARED_LIBS=
173 SHARED_LIBS_LINK_EXTS=
174 SHARED_LDFLAGS=
175
176 GENERAL=        Makefile
177 BASENAME=       openssl
178 NAME=           $(BASENAME)-$(VERSION)
179 TARFILE=        $(NAME).tar
180 WTARFILE=       $(NAME)-win.tar
181 EXHEADER=       e_os2.h
182 HEADER=         e_os.h
183
184 all: Makefile build_all openssl.pc libssl.pc libcrypto.pc
185
186 # as we stick to -e, CLEARENV ensures that local variables in lower
187 # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
188 # shell, which [annoyingly enough] terminates unset with error if VAR
189 # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
190 # which terminates unset with error if no variable was present:-(
191 CLEARENV=       TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}     \
192                 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}       \
193                 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}           \
194                 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
195                 $${EXHEADER+EXHEADER} $${HEADER+HEADER}         \
196                 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS}           \
197                 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}           \
198                 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS}             \
199                 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}     \
200                 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
201
202 BUILDENV=       PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
203                 CC='${CC}' CFLAG='${CFLAG}'                     \
204                 AS='${CC}' ASFLAG='${CFLAG} -c'                 \
205                 AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'    \
206                 SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/$(LIBDIR)'     \
207                 INSTALL_PREFIX='${INSTALL_PREFIX}'              \
208                 INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'   \
209                 LIBDIR='${LIBDIR}' \
210                 MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
211                 DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}'    \
212                 MAKEDEPPROG='${MAKEDEPPROG}'                    \
213                 SHARED_LDFLAGS='${SHARED_LDFLAGS}'              \
214                 KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'   \
215                 EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'       \
216                 SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
217                 PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}'     \
218                 CPUID_OBJ='${CPUID_OBJ}'                        \
219                 BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}'         \
220                 AES_ASM_OBJ='${AES_ASM_OBJ}'                    \
221                 BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}'       \
222                 RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}'       \
223                 SHA1_ASM_OBJ='${SHA1_ASM_OBJ}'                  \
224                 MD5_ASM_OBJ='${MD5_ASM_OBJ}'                    \
225                 RMD160_ASM_OBJ='${RMD160_ASM_OBJ}'              \
226                 FIPSLIBDIR='${FIPSLIBDIR}'                      \
227                 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"      \
228                 FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}'  \
229                 FIPS_EX_OBJ='${FIPS_EX_OBJ}'    \
230                 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
231 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
232 # which in turn eliminates ambiguities in variable treatment with -e.
233
234 # BUILD_CMD is a generic macro to build a given target in a given
235 # subdirectory.  The target must be given through the shell variable
236 # `target' and the subdirectory to build in must be given through `dir'.
237 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
238 # BUILD_ONE_CMD instead.
239 #
240 # BUILD_ONE_CMD is a macro to build a given target in a given
241 # subdirectory if that subdirectory is part of $(DIRS).  It requires
242 # exactly the same shell variables as BUILD_CMD.
243 #
244 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
245 # subdirectories defined in $(DIRS).  It requires that the target
246 # is given through the shell variable `target'.
247 BUILD_CMD=  if [ -d "$$dir" ]; then \
248             (   [ $$target != all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=/dev/null; \
249                 cd $$dir && echo "making $$target in $$dir..." && \
250                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
251             ) || exit 1; \
252             fi
253 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
254 BUILD_ONE_CMD=\
255         if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
256                 $(BUILD_CMD); \
257         fi
258
259 reflect:
260         @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
261
262 FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
263         ../crypto/aes/aes_ecb.o \
264         ../crypto/aes/aes_ofb.o \
265         ../crypto/bn/bn_add.o \
266         ../crypto/bn/bn_blind.o \
267         ../crypto/bn/bn_ctx.o \
268         ../crypto/bn/bn_div.o \
269         ../crypto/bn/bn_exp2.o \
270         ../crypto/bn/bn_exp.o \
271         ../crypto/bn/bn_gcd.o \
272         ../crypto/bn/bn_lib.o \
273         ../crypto/bn/bn_mod.o \
274         ../crypto/bn/bn_mont.o \
275         ../crypto/bn/bn_mul.o \
276         ../crypto/bn/bn_prime.o \
277         ../crypto/bn/bn_rand.o \
278         ../crypto/bn/bn_recp.o \
279         ../crypto/bn/bn_shift.o \
280         ../crypto/bn/bn_sqr.o \
281         ../crypto/bn/bn_word.o \
282         ../crypto/bn/bn_x931p.o \
283         ../crypto/buffer/buf_str.o \
284         ../crypto/cryptlib.o \
285         ../crypto/des/cfb64ede.o \
286         ../crypto/des/cfb64enc.o \
287         ../crypto/des/cfb_enc.o \
288         ../crypto/des/ecb3_enc.o \
289         ../crypto/des/ecb_enc.o \
290         ../crypto/des/ofb64ede.o \
291         ../crypto/des/ofb64enc.o \
292         ../crypto/des/fcrypt.o \
293         ../crypto/des/set_key.o \
294         ../crypto/dsa/dsa_utl.o \
295         ../crypto/dsa/dsa_sign.o \
296         ../crypto/dsa/dsa_vrf.o \
297         ../crypto/err/err.o \
298         ../crypto/evp/digest.o \
299         ../crypto/evp/enc_min.o \
300         ../crypto/evp/e_aes.o \
301         ../crypto/evp/e_des3.o \
302         ../crypto/evp/p_sign.o \
303         ../crypto/evp/p_verify.o \
304         ../crypto/mem_clr.o \
305         ../crypto/mem.o \
306         ../crypto/rand/md_rand.o \
307         ../crypto/rand/rand_egd.o \
308         ../crypto/rand/randfile.o \
309         ../crypto/rand/rand_lib.o \
310         ../crypto/rand/rand_os2.o \
311         ../crypto/rand/rand_unix.o \
312         ../crypto/rand/rand_win.o \
313         ../crypto/rsa/rsa_lib.o \
314         ../crypto/rsa/rsa_none.o \
315         ../crypto/rsa/rsa_oaep.o \
316         ../crypto/rsa/rsa_pk1.o \
317         ../crypto/rsa/rsa_pss.o \
318         ../crypto/rsa/rsa_ssl.o \
319         ../crypto/rsa/rsa_x931.o \
320         ../crypto/sha/sha1dgst.o \
321         ../crypto/sha/sha256.o \
322         ../crypto/sha/sha512.o \
323         ../crypto/uid.o
324
325 sub_all: build_all
326 build_all: build_libs build_apps build_tests build_tools
327
328 build_libs: build_crypto build_fips build_ssl build_shared build_engines
329
330 build_crypto:
331         if [ -n "$(FIPSCANLIB)" ]; then \
332                 EXCL_OBJ='$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
333                 ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
334         else \
335                 ARX='${AR}' ; \
336         fi ; export ARX ; \
337                 dir=crypto; target=all; $(BUILD_ONE_CMD)
338 build_fips:
339         @dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
340 build_ssl: build_crypto
341         @dir=ssl; target=all; $(BUILD_ONE_CMD)
342 build_engines: build_crypto
343         @dir=engines; target=all; $(BUILD_ONE_CMD)
344 build_apps: build_libs
345         @dir=apps; target=all; $(BUILD_ONE_CMD)
346 build_tests: build_libs
347         @dir=test; target=all; $(BUILD_ONE_CMD)
348 build_tools: build_libs
349         @dir=tools; target=all; $(BUILD_ONE_CMD)
350
351 all_testapps: build_libs build_testapps
352 build_testapps:
353         @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
354
355 build_shared:   $(SHARED_LIBS)
356 libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
357         @if [ "$(SHLIB_TARGET)" != "" ]; then \
358                 if [ "$(FIPSCANLIB)" = "libfips" ]; then \
359                         $(ARD) libcrypto.a fipscanister.o ; \
360                         $(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
361                         $(AR) libcrypto.a fips/fipscanister.o ; \
362                 else \
363                         if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
364                                 FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
365                                 export CC FIPSLD_CC; \
366                         fi; \
367                         $(MAKE) -e SHLIBDIRS='crypto' build-shared; \
368                 fi \
369         else \
370                 echo "There's no support for shared libraries on this platform" >&2; \
371                 exit 1; \
372         fi
373
374 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
375         @if [ "$(SHLIB_TARGET)" != "" ]; then \
376                 shlibdeps=-lcrypto; \
377                 [ "$(FIPSCANLIB)" = "libfips" ] && shlibdeps="$$shlibdeps -lfips"; \
378                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS="$$shlibdeps" build-shared; \
379         else \
380                 echo "There's no support for shared libraries on this platform" >&2 ; \
381                 exit 1; \
382         fi
383
384 fips/fipscanister.o:    build_fips
385 libfips$(SHLIB_EXT):            fips/fipscanister.o
386         @if [ "$(SHLIB_TARGET)" != "" ]; then \
387                 FIPSLD_CC="$(CC)"; CC=fips/fipsld; export CC FIPSLD_CC; \
388                 $(MAKE) -f Makefile.shared -e $(BUILDENV) \
389                         CC=$${CC} LIBNAME=fips THIS=$@ \
390                         LIBEXTRAS=fips/fipscanister.o \
391                         LIBDEPS="$(EX_LIBS)" \
392                         LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
393                         link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
394         else \
395                 echo "There's no support for shared libraries on this platform" >&2; \
396                 exit 1; \
397         fi
398
399 libfips.a:
400         dir=fips; target=all; $(BUILD_ONE_CMD)
401
402 clean-shared:
403         @set -e; for i in $(SHLIBDIRS); do \
404                 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
405                         tmp="$(SHARED_LIBS_LINK_EXTS)"; \
406                         for j in $${tmp:-x}; do \
407                                 ( set -x; rm -f lib$$i$$j ); \
408                         done; \
409                 fi; \
410                 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
411                 if [ "$(PLATFORM)" = "Cygwin" ]; then \
412                         ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
413                 fi; \
414         done
415
416 link-shared:
417         @ set -e; for i in ${SHLIBDIRS}; do \
418                 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
419                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
420                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
421                         symlink.$(SHLIB_TARGET); \
422                 libs="$$libs -l$$i"; \
423         done
424
425 build-shared: do_$(SHLIB_TARGET) link-shared
426
427 do_$(SHLIB_TARGET):
428         @ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
429                 if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
430                         libs="$(LIBKRB5) $$libs"; \
431                 fi; \
432                 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
433                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
434                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
435                         LIBDEPS="$$libs $(EX_LIBS)" \
436                         link_a.$(SHLIB_TARGET); \
437                 libs="-l$$i $$libs"; \
438         done
439
440 libcrypto.pc: Makefile
441         @ ( echo 'prefix=$(INSTALLTOP)'; \
442             echo 'exec_prefix=$${prefix}'; \
443             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
444             echo 'includedir=$${prefix}/include'; \
445             echo ''; \
446             echo 'Name: OpenSSL-libcrypto'; \
447             echo 'Description: OpenSSL cryptography library'; \
448             echo 'Version: '$(VERSION); \
449             echo 'Requires: '; \
450             echo 'Libs: -L$${libdir} -lcrypto $(EX_LIBS)'; \
451             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
452
453 libssl.pc: Makefile
454         @ ( echo 'prefix=$(INSTALLTOP)'; \
455             echo 'exec_prefix=$${prefix}'; \
456             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
457             echo 'includedir=$${prefix}/include'; \
458             echo ''; \
459             echo 'Name: OpenSSL'; \
460             echo 'Description: Secure Sockets Layer and cryptography libraries'; \
461             echo 'Version: '$(VERSION); \
462             echo 'Requires: '; \
463             echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
464             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
465
466 openssl.pc: Makefile
467         @ ( echo 'prefix=$(INSTALLTOP)'; \
468             echo 'exec_prefix=$${prefix}'; \
469             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
470             echo 'includedir=$${prefix}/include'; \
471             echo ''; \
472             echo 'Name: OpenSSL'; \
473             echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
474             echo 'Version: '$(VERSION); \
475             echo 'Requires: '; \
476             echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
477             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
478
479 Makefile: Makefile.org Configure config
480         @echo "Makefile is older than Makefile.org, Configure or config."
481         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
482         @false
483
484 libclean:
485         rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib
486
487 clean:  libclean
488         rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
489         @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
490         rm -f $(LIBS)
491         rm -f openssl.pc libssl.pc libcrypto.pc
492         rm -f speed.* .pure
493         rm -f $(TARFILE)
494         @set -e; for i in $(ONEDIRS) ;\
495         do \
496         rm -fr $$i/*; \
497         done
498
499 makefile.one: files
500         $(PERL) util/mk1mf.pl >makefile.one; \
501         sh util/do_ms.sh
502
503 files:
504         $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
505         @set -e; target=files; $(RECURSIVE_BUILD_CMD)
506
507 links:
508         @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
509         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
510         @set -e; target=links; $(RECURSIVE_BUILD_CMD)
511         @if [ -z "$(FIPSCANLIB)" ]; then \
512                 set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
513         fi
514
515 gentests:
516         @(cd test && echo "generating dummy tests (if needed)..." && \
517         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
518
519 dclean:
520         rm -f *.bak
521         @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
522
523 rehash: rehash.time
524 rehash.time: certs apps
525         @if [ -z "$(CROSS_COMPILE)" ]; then \
526                 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
527                 OPENSSL_DEBUG_MEMORY=on; \
528                 export OPENSSL OPENSSL_DEBUG_MEMORY; \
529                 $(PERL) tools/c_rehash certs) && \
530                 touch rehash.time; \
531         fi
532
533 test:   tests
534
535 tests: rehash
536         @(cd test && echo "testing..." && \
537         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
538         util/opensslwrap.sh version -a
539
540 report:
541         @$(PERL) util/selftest.pl
542
543 depend:
544         @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
545
546 lint:
547         @set -e; target=lint; $(RECURSIVE_BUILD_CMD)
548
549 tags:
550         rm -f TAGS
551         find . -name '[^.]*.[ch]' | xargs etags -a
552
553 errors:
554         $(PERL) util/mkerr.pl -recurse -write
555         (cd engines; $(MAKE) PERL=$(PERL) errors)
556         $(PERL) util/ck_errf.pl */*.c */*/*.c
557
558 stacks:
559         $(PERL) util/mkstack.pl -write
560
561 util/libeay.num::
562         $(PERL) util/mkdef.pl crypto update
563
564 util/ssleay.num::
565         $(PERL) util/mkdef.pl ssl update
566
567 crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
568         $(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
569 crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
570         $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
571
572 apps/openssl-vms.cnf: apps/openssl.cnf
573         $(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
574
575 crypto/bn/bn_prime.h: crypto/bn/bn_prime.pl
576         $(PERL) crypto/bn/bn_prime.pl >crypto/bn/bn_prime.h
577
578
579 TABLE: Configure
580         (echo 'Output of `Configure TABLE'"':"; \
581         $(PERL) Configure TABLE) > TABLE
582
583 update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
584
585 # Build distribution tar-file. As the list of files returned by "find" is
586 # pretty long, on several platforms a "too many arguments" error or similar
587 # would occur. Therefore the list of files is temporarily stored into a file
588 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
589 # tar does not support the --files-from option.
590 TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list \
591                                --owner openssl:0 --group openssl:0 \
592                                --transform 's|^|openssl-$(VERSION)/|' \
593                                -cvf -
594
595 ../$(TARFILE).list:
596         find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \
597                \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \
598                \! -name '*test' \! -name '.#*' \! -name '*~' \
599             | sort > ../$(TARFILE).list
600
601 tar: ../$(TARFILE).list
602         find . -type d -print | xargs chmod 755
603         find . -type f -print | xargs chmod a+r
604         find . -type f -perm -0100 -print | xargs chmod a+x
605         $(TAR_COMMAND) | gzip --best >../$(TARFILE).gz
606         rm -f ../$(TARFILE).list
607         ls -l ../$(TARFILE).gz
608
609 tar-snap: ../$(TARFILE).list
610         $(TAR_COMMAND) > ../$(TARFILE)
611         rm -f ../$(TARFILE).list
612         ls -l ../$(TARFILE)
613
614 dist:   
615         $(PERL) Configure dist
616         @$(MAKE) dist_pem_h
617         @$(MAKE) SDIRS='${SDIRS}' clean
618         @$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
619
620 dist_pem_h:
621         (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
622
623 install: all install_docs install_sw
624
625 install_sw:
626         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
627                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
628                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
629                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
630                 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
631                 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
632                 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
633                 $(INSTALL_PREFIX)$(OPENSSLDIR)/private
634         @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
635         do \
636         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
637         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
638         done;
639         @set -e; target=install; $(RECURSIVE_BUILD_CMD)
640         @set -e; for i in $(LIBS) ;\
641         do \
642                 if [ -f "$$i" ]; then \
643                 (       echo installing $$i; \
644                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
645                         $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
646                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
647                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
648                 fi; \
649         done;
650         @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
651                 tmp="$(SHARED_LIBS)"; \
652                 for i in $${tmp:-x}; \
653                 do \
654                         if [ -f "$$i" -o -f "$$i.a" ]; then \
655                         (       echo installing $$i; \
656                                 if [ "$(PLATFORM)" != "Cygwin" ]; then \
657                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
658                                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
659                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
660                                 else \
661                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
662                                         cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
663                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
664                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
665                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
666                                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
667                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
668                                 fi ); \
669                         fi; \
670                 done; \
671                 (       here="`pwd`"; \
672                         cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
673                         $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
674                 if [ "$(INSTALLTOP)" != "/usr" ]; then \
675                         echo 'OpenSSL shared libraries have been installed in:'; \
676                         echo '  $(INSTALLTOP)'; \
677                         echo ''; \
678                         sed -e '1,/^$$/d' doc/openssl-shared.txt; \
679                 fi; \
680         fi
681         cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
682         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
683         cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
684         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
685         cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
686         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
687
688 install_docs:
689         @$(PERL) $(TOP)/util/mkdir-p.pl \
690                 $(INSTALL_PREFIX)$(MANDIR)/man1 \
691                 $(INSTALL_PREFIX)$(MANDIR)/man3 \
692                 $(INSTALL_PREFIX)$(MANDIR)/man5 \
693                 $(INSTALL_PREFIX)$(MANDIR)/man7
694         @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
695         here="`pwd`"; \
696         filecase=; \
697         if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
698                 filecase=-i; \
699         fi; \
700         set -e; for i in doc/apps/*.pod; do \
701                 fn=`basename $$i .pod`; \
702                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
703                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
704                 (cd `$(PERL) util/dirname.pl $$i`; \
705                 sh -c "$$pod2man \
706                         --section=$$sec --center=OpenSSL \
707                         --release=$(VERSION) `basename $$i`") \
708                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
709                 $(PERL) util/extract-names.pl < $$i | \
710                         (grep -v $$filecase "^$$fn\$$"; true) | \
711                         (grep -v "[     ]"; true) | \
712                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
713                          while read n; do \
714                                 $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
715                          done); \
716         done; \
717         set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
718                 fn=`basename $$i .pod`; \
719                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
720                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
721                 (cd `$(PERL) util/dirname.pl $$i`; \
722                 sh -c "$$pod2man \
723                         --section=$$sec --center=OpenSSL \
724                         --release=$(VERSION) `basename $$i`") \
725                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
726                 $(PERL) util/extract-names.pl < $$i | \
727                         (grep -v $$filecase "^$$fn\$$"; true) | \
728                         (grep -v "[     ]"; true) | \
729                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
730                          while read n; do \
731                                 $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
732                          done); \
733         done
734
735 # DO NOT DELETE THIS LINE -- make depend depends on it.