]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
Import OpenSSL 1.0.2p.
[FreeBSD/FreeBSD.git] / Makefile
1 ### Generated automatically from Makefile.org by Configure.
2
3 ##
4 ## Makefile for OpenSSL
5 ##
6
7 VERSION=1.0.2p
8 MAJOR=1
9 MINOR=0.2
10 SHLIB_VERSION_NUMBER=1.0.0
11 SHLIB_VERSION_HISTORY=
12 SHLIB_MAJOR=1
13 SHLIB_MINOR=0.0
14 SHLIB_EXT=
15 PLATFORM=dist
16 OPTIONS= no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-libunbound no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-ssl-trace no-ssl2 no-store no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic static-engine
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_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
65 PEX_LIBS= 
66 EX_LIBS= 
67 EXE_EXT= 
68 ARFLAGS= 
69 AR= ar $(ARFLAGS) r
70 RANLIB= /usr/bin/ranlib
71 RC= windres
72 NM= nm
73 PERL= /usr/bin/perl
74 TAR= tar
75 TARFLAGS= --no-recursion
76 MAKEDEPPROG= cc
77 LIBDIR=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.
84 AS=$(CC) -c
85 ASFLAG=$(CFLAG)
86
87 # For x86 assembler: Set PROCESSOR to 386 if you want to support
88 # the 80386.
89 PROCESSOR= 
90
91 # CPUID module collects small commonly used assembler snippets
92 CPUID_OBJ= mem_clr.o
93 BN_ASM= bn_asm.o
94 EC_ASM= 
95 DES_ENC= des_enc.o fcrypt_b.o
96 AES_ENC= aes_core.o aes_cbc.o
97 BF_ENC= bf_enc.o
98 CAST_ENC= c_enc.o
99 RC4_ENC= rc4_enc.o rc4_skey.o
100 RC5_ENC= rc5_enc.o
101 MD5_ASM_OBJ= 
102 SHA1_ASM_OBJ= 
103 RMD160_ASM_OBJ= 
104 WP_ASM_OBJ= wp_block.o
105 CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o
106 MODES_ASM_OBJ= 
107 ENGINES_ASM_OBJ= 
108 PERLASM_SCHEME= 
109
110 # KRB5 stuff
111 KRB5_INCLUDES=
112 LIBKRB5=
113
114 # Zlib stuff
115 ZLIB_INCLUDE=
116 LIBZLIB=
117
118 # TOP level FIPS install directory.
119 FIPSDIR=/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
128 FIPSLIBDIR=
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
135 FIPSCANLIB=
136
137 # Shared library base address. Currently only used on Windows.
138 #
139
140 BASEADDR=0xFB00000
141
142 DIRS=   crypto ssl engines apps test tools
143 ENGDIRS= ccgost
144 SHLIBDIRS= crypto ssl
145
146 # dirs in crypto to build
147 SDIRS=  \
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.
160 TESTS = alltests
161
162 MAKEFILE= Makefile
163
164 MANDIR=$(OPENSSLDIR)/man
165 MAN1=1
166 MAN3=3
167 MANSUFFIX=
168 HTMLSUFFIX=html
169 HTMLDIR=$(OPENSSLDIR)/html
170 SHELL=/bin/sh
171
172 TOP=    .
173 ONEDIRS=out tmp
174 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
175 WDIRS=  windows
176 LIBS=   libcrypto.a libssl.a
177 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
178 SHARED_SSL=libssl$(SHLIB_EXT)
179 SHARED_LIBS=
180 SHARED_LIBS_LINK_EXTS=
181 SHARED_LDFLAGS=
182
183 GENERAL=        Makefile
184 BASENAME=       openssl
185 NAME=           $(BASENAME)-$(VERSION)
186 TARFILE=        ../$(NAME).tar
187 EXHEADER=       e_os2.h
188 HEADER=         e_os.h
189
190 all: 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:-(
197 CLEARENV=       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                 $${APPS+APPS}
208
209 # LC_ALL=C ensures that error [and other] messages are delivered in
210 # same language for uniform treatment.
211 BUILDENV=       LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
212                 CC='$(CC)' CFLAG='$(CFLAG)'                     \
213                 AS='$(CC)' ASFLAG='$(CFLAG) -c'                 \
214                 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'        \
215                 RC='$(RC)'                                      \
216                 CROSS_COMPILE='$(CROSS_COMPILE)'        \
217                 PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'             \
218                 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'     \
219                 INSTALL_PREFIX='$(INSTALL_PREFIX)'              \
220                 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'   \
221                 LIBDIR='$(LIBDIR)'                              \
222                 MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
223                 DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'    \
224                 MAKEDEPPROG='$(MAKEDEPPROG)'                    \
225                 SHARED_LDFLAGS='$(SHARED_LDFLAGS)'              \
226                 KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'   \
227                 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
228                 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
229                 SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
230                 PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'     \
231                 CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)'     \
232                 EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)'         \
233                 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'     \
234                 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'       \
235                 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'       \
236                 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'                  \
237                 MD5_ASM_OBJ='$(MD5_ASM_OBJ)'                    \
238                 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'              \
239                 WP_ASM_OBJ='$(WP_ASM_OBJ)'                      \
240                 MODES_ASM_OBJ='$(MODES_ASM_OBJ)'                \
241                 ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)'            \
242                 PERLASM_SCHEME='$(PERLASM_SCHEME)'              \
243                 FIPSLIBDIR='${FIPSLIBDIR}'                      \
244                 FIPSDIR='${FIPSDIR}'                            \
245                 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"      \
246                 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
247 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
248 # which in turn eliminates ambiguities in variable treatment with -e.
249
250 # BUILD_CMD is a generic macro to build a given target in a given
251 # subdirectory.  The target must be given through the shell variable
252 # `target' and the subdirectory to build in must be given through `dir'.
253 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
254 # BUILD_ONE_CMD instead.
255 #
256 # BUILD_ONE_CMD is a macro to build a given target in a given
257 # subdirectory if that subdirectory is part of $(DIRS).  It requires
258 # exactly the same shell variables as BUILD_CMD.
259 #
260 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
261 # subdirectories defined in $(DIRS).  It requires that the target
262 # is given through the shell variable `target'.
263 BUILD_CMD=  if [ -d "$$dir" ]; then \
264             (   cd $$dir && echo "making $$target in $$dir..." && \
265                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
266             ) || exit 1; \
267             fi
268 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
269 BUILD_ONE_CMD=\
270         if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
271                 $(BUILD_CMD); \
272         fi
273
274 reflect:
275         @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
276
277 sub_all: build_all
278
279 build_all: build_libs build_apps build_tests build_tools
280
281 build_libs: build_libcrypto build_libssl openssl.pc
282
283 build_libcrypto: build_crypto build_engines libcrypto.pc
284 build_libssl: build_ssl libssl.pc
285
286 build_crypto:
287         @dir=crypto; target=all; $(BUILD_ONE_CMD)
288 build_ssl: build_crypto
289         @dir=ssl; target=all; $(BUILD_ONE_CMD)
290 build_engines: build_crypto
291         @dir=engines; target=all; $(BUILD_ONE_CMD)
292 build_apps: build_libs
293         @dir=apps; target=all; $(BUILD_ONE_CMD)
294 build_tests: build_libs
295         @dir=test; target=all; $(BUILD_ONE_CMD)
296 build_tools: build_libs
297         @dir=tools; target=all; $(BUILD_ONE_CMD)
298
299 all_testapps: build_libs build_testapps
300 build_testapps:
301         @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
302
303 fips_premain_dso$(EXE_EXT): libcrypto.a
304         [ -z "$(FIPSCANLIB)" ] || $(CC) $(CFLAG) -Iinclude \
305                 -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@  \
306                 $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fipscanister.o \
307                 libcrypto.a $(EX_LIBS)
308
309 libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
310         @if [ "$(SHLIB_TARGET)" != "" ]; then \
311                 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
312                         FIPSLD_LIBCRYPTO=libcrypto.a ; \
313                         FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
314                         export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
315                 fi; \
316                 $(MAKE) -e SHLIBDIRS=crypto  CC="$${CC:-$(CC)}" build-shared && \
317                 (touch -c fips_premain_dso$(EXE_EXT) || :); \
318         else \
319                 echo "There's no support for shared libraries on this platform" >&2; \
320                 exit 1; \
321         fi
322
323 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
324         @if [ "$(SHLIB_TARGET)" != "" ]; then \
325                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
326         else \
327                 echo "There's no support for shared libraries on this platform" >&2; \
328                 exit 1; \
329         fi
330
331 clean-shared:
332         @set -e; for i in $(SHLIBDIRS); do \
333                 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
334                         tmp="$(SHARED_LIBS_LINK_EXTS)"; \
335                         for j in $${tmp:-x}; do \
336                                 ( set -x; rm -f lib$$i$$j ); \
337                         done; \
338                 fi; \
339                 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
340                 if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
341                         ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
342                 fi; \
343         done
344
345 link-shared:
346         @ set -e; for i in $(SHLIBDIRS); do \
347                 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
348                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
349                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
350                         symlink.$(SHLIB_TARGET); \
351                 libs="$$libs -l$$i"; \
352         done
353
354 build-shared: do_$(SHLIB_TARGET) link-shared
355
356 do_$(SHLIB_TARGET):
357         @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
358                 if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
359                         libs="$(LIBKRB5) $$libs"; \
360                 fi; \
361                 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
362                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
363                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
364                         LIBDEPS="$$libs $(EX_LIBS)" \
365                         link_a.$(SHLIB_TARGET); \
366                 libs="-l$$i $$libs"; \
367         done
368
369 libcrypto.pc: Makefile
370         @ ( echo 'prefix=$(INSTALLTOP)'; \
371             echo 'exec_prefix=$${prefix}'; \
372             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
373             echo 'includedir=$${prefix}/include'; \
374             echo 'enginesdir=$${libdir}/engines'; \
375             echo ''; \
376             echo 'Name: OpenSSL-libcrypto'; \
377             echo 'Description: OpenSSL cryptography library'; \
378             echo 'Version: '$(VERSION); \
379             echo 'Requires: '; \
380             echo 'Libs: -L$${libdir} -lcrypto'; \
381             echo 'Libs.private: $(EX_LIBS)'; \
382             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
383
384 libssl.pc: Makefile
385         @ ( echo 'prefix=$(INSTALLTOP)'; \
386             echo 'exec_prefix=$${prefix}'; \
387             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
388             echo 'includedir=$${prefix}/include'; \
389             echo ''; \
390             echo 'Name: OpenSSL-libssl'; \
391             echo 'Description: Secure Sockets Layer and cryptography libraries'; \
392             echo 'Version: '$(VERSION); \
393             echo 'Requires.private: libcrypto'; \
394             echo 'Libs: -L$${libdir} -lssl'; \
395             echo 'Libs.private: $(EX_LIBS)'; \
396             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
397
398 openssl.pc: Makefile
399         @ ( echo 'prefix=$(INSTALLTOP)'; \
400             echo 'exec_prefix=$${prefix}'; \
401             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
402             echo 'includedir=$${prefix}/include'; \
403             echo ''; \
404             echo 'Name: OpenSSL'; \
405             echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
406             echo 'Version: '$(VERSION); \
407             echo 'Requires: libssl libcrypto' ) > openssl.pc
408
409 Makefile: Makefile.org Configure config
410         @echo "Makefile is older than Makefile.org, Configure or config."
411         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
412         @false
413
414 libclean:
415         rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
416
417 clean:  libclean
418         rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
419         @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
420         rm -f $(LIBS)
421         rm -f openssl.pc libssl.pc libcrypto.pc
422         rm -f speed.* .pure
423         rm -f $(TARFILE)
424         @set -e; for i in $(ONEDIRS) ;\
425         do \
426         rm -fr $$i/*; \
427         done
428
429 distclean: clean
430         -$(RM) `find . -name .git -prune -o -type l -print`
431         $(RM) apps/CA.pl
432         $(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
433         $(RM) tools/c_rehash
434         $(RM) crypto/opensslconf.h
435         $(RM) Makefile Makefile.bak
436
437 makefile.one: files
438         $(PERL) util/mk1mf.pl >makefile.one; \
439         sh util/do_ms.sh
440
441 files:
442         $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
443         @set -e; target=files; $(RECURSIVE_BUILD_CMD)
444
445 links:
446         @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
447         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
448         @set -e; target=links; $(RECURSIVE_BUILD_CMD)
449
450 gentests:
451         @(cd test && echo "generating dummy tests (if needed)..." && \
452         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
453
454 dclean:
455         rm -rf *.bak include/openssl certs/.0
456         @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
457
458 rehash: rehash.time
459 rehash.time: certs apps
460         @if [ -z "$(CROSS_COMPILE)" ]; then \
461                 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
462                 [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
463                 OPENSSL_DEBUG_MEMORY=on; \
464                 export OPENSSL OPENSSL_DEBUG_MEMORY; \
465                 $(PERL) tools/c_rehash certs/demo) && \
466                 touch rehash.time; \
467         else :; fi
468
469 test:   tests
470
471 tests: rehash
472         @(cd test && echo "testing..." && \
473         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
474         OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
475
476 report:
477         @$(PERL) util/selftest.pl
478
479 update: errors stacks util/libeay.num util/ssleay.num TABLE
480         @set -e; target=update; $(RECURSIVE_BUILD_CMD)
481
482 depend:
483         @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
484
485 lint:
486         @set -e; target=lint; $(RECURSIVE_BUILD_CMD)
487
488 tags:
489         rm -f TAGS
490         find . -name '[^.]*.[ch]' | xargs etags -a
491
492 errors:
493         $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
494         $(PERL) util/mkerr.pl -recurse -write
495         (cd engines; $(MAKE) PERL=$(PERL) errors)
496
497 stacks:
498         $(PERL) util/mkstack.pl -write
499
500 util/libeay.num::
501         $(PERL) util/mkdef.pl crypto update
502
503 util/ssleay.num::
504         $(PERL) util/mkdef.pl ssl update
505
506 TABLE: Configure
507         (echo 'Output of `Configure TABLE'"':"; \
508         $(PERL) Configure TABLE) > TABLE
509
510 # Build distribution tar-file. As the list of files returned by "find" is
511 # pretty long, on several platforms a "too many arguments" error or similar
512 # would occur. Therefore the list of files is temporarily stored into a file
513 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
514 # tar does not support the --files-from option.
515 TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
516                                --owner 0 --group 0 \
517                                --transform 's|^|$(NAME)/|' \
518                                -cvf -
519
520 $(TARFILE).list:
521         find * \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \
522                \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \
523                \( \! -name '*test' -o -name bctest -o -name pod2mantest \) \
524                \! -name '.#*' \! -name '*~' \! -type l \
525             | sort > $(TARFILE).list
526
527 tar: $(TARFILE).list
528         find . -type d -print | xargs chmod 755
529         find . -type f -print | xargs chmod a+r
530         find . -type f -perm -0100 -print | xargs chmod a+x
531         $(TAR_COMMAND) | gzip --best > $(TARFILE).gz
532         rm -f $(TARFILE).list
533         ls -l $(TARFILE).gz
534
535 tar-snap: $(TARFILE).list
536         $(TAR_COMMAND) > $(TARFILE)
537         rm -f $(TARFILE).list
538         ls -l $(TARFILE)
539
540 dist:   
541         $(PERL) Configure dist
542         @$(MAKE) SDIRS='$(SDIRS)' clean
543         @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
544
545 install: all install_docs install_sw
546
547 install_sw:
548         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
549                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
550                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
551                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
552                 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
553                 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
554                 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
555                 $(INSTALL_PREFIX)$(OPENSSLDIR)/private
556         @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
557         do \
558         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
559         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
560         done;
561         @set -e; target=install; $(RECURSIVE_BUILD_CMD)
562         @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
563         do \
564                 if [ -f "$$i" ]; then \
565                 (       echo installing $$i; \
566                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
567                         $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
568                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
569                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
570                 fi; \
571         done;
572         @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
573                 tmp="$(SHARED_LIBS)"; \
574                 for i in $${tmp:-x}; \
575                 do \
576                         if [ -f "$$i" -o -f "$$i.a" ]; then \
577                         (       echo installing $$i; \
578                                 if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
579                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
580                                         cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
581                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
582                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
583                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
584                                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
585                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
586                                 else \
587                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
588                                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
589                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
590                                 fi ); \
591                                 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
592                                 (       case $$i in \
593                                                 *crypto*) i=libeay32.dll;; \
594                                                 *ssl*)    i=ssleay32.dll;; \
595                                         esac; \
596                                         echo installing $$i; \
597                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
598                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
599                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
600                                 fi; \
601                         fi; \
602                 done; \
603                 (       here="`pwd`"; \
604                         cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
605                         $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
606                 if [ "$(INSTALLTOP)" != "/usr" ]; then \
607                         echo 'OpenSSL shared libraries have been installed in:'; \
608                         echo '  $(INSTALLTOP)'; \
609                         echo ''; \
610                         sed -e '1,/^$$/d' doc/openssl-shared.txt; \
611                 fi; \
612         fi
613         cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
614         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
615         cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
616         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
617         cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
618         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
619
620 install_html_docs:
621         here="`pwd`"; \
622         filecase=; \
623         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
624                 filecase=-i; \
625         esac; \
626         for subdir in apps crypto ssl; do \
627                 mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
628                 for i in doc/$$subdir/*.pod; do \
629                         fn=`basename $$i .pod`; \
630                         echo "installing html/$$fn.$(HTMLSUFFIX)"; \
631                         cat $$i \
632                         | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
633                         | pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
634                         | sed -r 's/<!DOCTYPE.*//g' \
635                         > $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
636                         $(PERL) util/extract-names.pl < $$i | \
637                                 grep -v $$filecase "^$$fn\$$" | \
638                                 (cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
639                                  while read n; do \
640                                         PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
641                                  done); \
642                 done; \
643         done
644
645 install_docs:
646         @$(PERL) $(TOP)/util/mkdir-p.pl \
647                 $(INSTALL_PREFIX)$(MANDIR)/man1 \
648                 $(INSTALL_PREFIX)$(MANDIR)/man3 \
649                 $(INSTALL_PREFIX)$(MANDIR)/man5 \
650                 $(INSTALL_PREFIX)$(MANDIR)/man7
651         @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
652         here="`pwd`"; \
653         filecase=; \
654         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
655                 filecase=-i; \
656         esac; \
657         set -e; for i in doc/apps/*.pod; do \
658                 fn=`basename $$i .pod`; \
659                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
660                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
661                 (cd `$(PERL) util/dirname.pl $$i`; \
662                 sh -c "$$pod2man \
663                         --section=$$sec --center=OpenSSL \
664                         --release=$(VERSION) `basename $$i`") \
665                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
666                 $(PERL) util/extract-names.pl < $$i | \
667                         (grep -v $$filecase "^$$fn\$$"; true) | \
668                         (grep -v "[     ]"; true) | \
669                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
670                          while read n; do \
671                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
672                          done); \
673         done; \
674         set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
675                 fn=`basename $$i .pod`; \
676                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
677                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
678                 (cd `$(PERL) util/dirname.pl $$i`; \
679                 sh -c "$$pod2man \
680                         --section=$$sec --center=OpenSSL \
681                         --release=$(VERSION) `basename $$i`") \
682                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
683                 $(PERL) util/extract-names.pl < $$i | \
684                         (grep -v $$filecase "^$$fn\$$"; true) | \
685                         (grep -v "[     ]"; true) | \
686                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
687                          while read n; do \
688                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
689                          done); \
690         done
691
692 # DO NOT DELETE THIS LINE -- make depend depends on it.