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