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