Build-n-link new IA-64 modules on Linux and HP-UX.
[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= gcc
61 #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
62 CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
63 DEPFLAG= 
64 PEX_LIBS= 
65 EX_LIBS= 
66 EXE_EXT= 
67 ARFLAGS=
68 AR=ar $(ARFLAGS) r
69 RANLIB= ranlib
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 # Set BN_ASM to bn_asm.o if you want to use the C version
84 BN_ASM= bn_asm.o
85 #BN_ASM= bn_asm.o
86 #BN_ASM= asm/bn86-elf.o # elf, linux-elf
87 #BN_ASM= asm/bn86-sol.o # solaris
88 #BN_ASM= asm/bn86-out.o # a.out, FreeBSD
89 #BN_ASM= asm/bn86bsdi.o # bsdi
90 #BN_ASM= asm/alpha.o    # DEC Alpha
91 #BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
92 #BN_ASM= asm/r3000.o    # SGI MIPS cpu
93 #BN_ASM= asm/sparc.o    # Sun solaris/SunOS
94 #BN_ASM= asm/bn-win32.o # Windows 95/NT
95 #BN_ASM= asm/x86w16.o   # 16 bit code for Windows 3.1/DOS
96 #BN_ASM= asm/x86w32.o   # 32 bit code for Windows 3.1
97
98 # For x86 assembler: Set PROCESSOR to 386 if you want to support
99 # the 80386.
100 PROCESSOR=
101
102 # Set DES_ENC to des_enc.o if you want to use the C version
103 #There are 4 x86 assember options.
104 DES_ENC= asm/dx86-out.o asm/yx86-out.o
105 #DES_ENC= des_enc.o fcrypt_b.o          # C
106 #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
107 #DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
108 #DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
109 #DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
110
111 AES_ASM_OBJ=
112
113 # Set BF_ENC to bf_enc.o if you want to use the C version
114 #There are 4 x86 assember options.
115 BF_ENC= asm/bx86-out.o
116 #BF_ENC= bf_enc.o
117 #BF_ENC= asm/bx86-elf.o # elf
118 #BF_ENC= asm/bx86-sol.o # solaris
119 #BF_ENC= asm/bx86-out.o # a.out, FreeBSD
120 #BF_ENC= asm/bx86bsdi.o # bsdi
121
122 # Set CAST_ENC to c_enc.o if you want to use the C version
123 #There are 4 x86 assember options.
124 CAST_ENC= asm/cx86-out.o
125 #CAST_ENC= c_enc.o
126 #CAST_ENC= asm/cx86-elf.o # elf
127 #CAST_ENC= asm/cx86-sol.o # solaris
128 #CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
129 #CAST_ENC= asm/cx86bsdi.o # bsdi
130
131 # Set RC4_ENC to rc4_enc.o if you want to use the C version
132 #There are 4 x86 assember options.
133 RC4_ENC= asm/rx86-out.o
134 #RC4_ENC= rc4_enc.o
135 #RC4_ENC= asm/rx86-elf.o # elf
136 #RC4_ENC= asm/rx86-sol.o # solaris
137 #RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
138 #RC4_ENC= asm/rx86bsdi.o # bsdi
139
140 # Set RC5_ENC to rc5_enc.o if you want to use the C version
141 #There are 4 x86 assember options.
142 RC5_ENC= asm/r586-out.o
143 #RC5_ENC= rc5_enc.o
144 #RC5_ENC= asm/r586-elf.o # elf
145 #RC5_ENC= asm/r586-sol.o # solaris
146 #RC5_ENC= asm/r586-out.o # a.out, FreeBSD
147 #RC5_ENC= asm/r586bsdi.o # bsdi
148
149 # Also need MD5_ASM defined
150 MD5_ASM_OBJ= asm/mx86-out.o
151 #MD5_ASM_OBJ= asm/mx86-elf.o        # elf
152 #MD5_ASM_OBJ= asm/mx86-sol.o        # solaris
153 #MD5_ASM_OBJ= asm/mx86-out.o        # a.out, FreeBSD
154 #MD5_ASM_OBJ= asm/mx86bsdi.o        # bsdi
155
156 # Also need SHA1_ASM defined
157 SHA1_ASM_OBJ= asm/sx86-out.o
158 #SHA1_ASM_OBJ= asm/sx86-elf.o       # elf
159 #SHA1_ASM_OBJ= asm/sx86-sol.o       # solaris
160 #SHA1_ASM_OBJ= asm/sx86-out.o       # a.out, FreeBSD
161 #SHA1_ASM_OBJ= asm/sx86bsdi.o       # bsdi
162
163 # Also need RMD160_ASM defined
164 RMD160_ASM_OBJ= asm/rm86-out.o
165 #RMD160_ASM_OBJ= asm/rm86-elf.o       # elf
166 #RMD160_ASM_OBJ= asm/rm86-sol.o       # solaris
167 #RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
168 #RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi
169
170 # KRB5 stuff
171 KRB5_INCLUDES=
172 LIBKRB5=
173
174 DIRS=   crypto ssl engines apps test tools
175 SHLIBDIRS= crypto ssl
176
177 # dirs in crypto to build
178 SDIRS=  \
179         objects \
180         md2 md4 md5 sha mdc2 hmac ripemd \
181         des rc2 rc4 rc5 idea bf cast \
182         bn ec rsa dsa ecdsa dh ecdh dso engine aes \
183         buffer bio stack lhash rand err \
184         evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
185         store
186
187 # tests to perform.  "alltests" is a special word indicating that all tests
188 # should be performed.
189 TESTS = alltests
190
191 MAKEFILE= Makefile.ssl
192 NEWMAKE=  make
193 MAKE=     $(NEWMAKE) -f Makefile.ssl
194
195 MANDIR=$(OPENSSLDIR)/man
196 MAN1=1
197 MAN3=3
198 MANSUFFIX=
199 SHELL=/bin/sh
200
201 TOP=    .
202 ONEDIRS=out tmp
203 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
204 WDIRS=  windows
205 LIBS=   libcrypto.a libssl.a
206 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
207 SHARED_SSL=libssl$(SHLIB_EXT)
208 SHARED_LIBS=
209 SHARED_LIBS_LINK_EXTS=
210 SHARED_LDFLAGS=
211
212 GENERAL=        Makefile
213 BASENAME=       openssl
214 NAME=           $(BASENAME)-$(VERSION)
215 TARFILE=        $(NAME).tar
216 WTARFILE=       $(NAME)-win.tar
217 EXHEADER=       e_os2.h
218 HEADER=         e_os.h
219
220 all: Makefile.ssl build_all openssl.pc
221
222 BUILDENV=       PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
223                 SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}'     \
224                 CC='${CC}' CFLAG='${CFLAG}'                     \
225                 AS='${CC}' ASFLAG='${CFLAG} -c'                 \
226                 AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'    \
227                 LDFLAGS="$(LDFLAGS)" SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
228                 KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'   \
229                 EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'       \
230                 SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
231                 PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}'     \
232                 BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}'         \
233                 AES_ASM_OBJ='${AES_ASM_OBJ}'                    \
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
240 BUILD_CMD=if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
241         if [ -d "$$dir" ]; then \
242                 (cd $$dir && echo "making $$target in $$dir..." && \
243                 $(MAKE) $(BUILDENV) $$target ) || exit 1; \
244         else \
245                 $(MAKE) $$dir; \
246         fi; fi
247
248 sub_all: build_all
249 build_all: build_libs build_apps build_tests build_tools
250
251 build_libs: build_crypto build_ssl build_engines
252
253 build_crypto:
254         @dir=crypto; target=all; $(BUILD_CMD)
255 build_ssl:
256         @dir=ssl; target=all; $(BUILD_CMD)
257 build_engines:
258         @dir=engines; target=all; $(BUILD_CMD)
259 build_apps:
260         @dir=apps; target=all; $(BUILD_CMD)
261 build_tests:
262         @dir=test; target=all; $(BUILD_CMD)
263 build_tools:
264         @dir=tools; target=all; $(BUILD_CMD)
265
266 all_testapps: build_libs build_testapps
267 build_testapps:
268         @dir=crypto; target=testapps; $(BUILD_CMD)
269
270 libcrypto$(SHLIB_EXT): libcrypto.a
271         @if [ "$(SHLIB_TARGET)" != "" ]; then \
272                 $(MAKE) SHLIBDIRS=crypto build-shared; \
273         else \
274                 echo "There's no support for shared libraries on this platform" >&2; \
275                 exit 1; \
276         fi
277
278 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
279         @if [ "$(SHLIB_TARGET)" != "" ]; then \
280                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
281         else \
282                 echo "There's no support for shared libraries on this platform" >&2; \
283                 exit 1; \
284         fi
285
286 clean-shared:
287         @set -e; for i in $(SHLIBDIRS); do \
288                 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
289                         tmp="$(SHARED_LIBS_LINK_EXTS)"; \
290                         for j in $${tmp:-x}; do \
291                                 ( set -x; rm -f lib$$i$$j ); \
292                         done; \
293                 fi; \
294                 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
295                 if [ "$(PLATFORM)" = "Cygwin" ]; then \
296                         ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
297                 fi; \
298         done
299
300 link-shared:
301         @ set -e; for i in ${SHLIBDIRS}; do \
302                 $(NEWMAKE) -f $(HERE)/Makefile.shared \
303                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
304                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
305                         symlink.$(SHLIB_TARGET); \
306                 libs="$$libs -l$$i"; \
307         done
308
309 build-shared: do_$(SHLIB_TARGET) link-shared
310
311 do_$(SHLIB_TARGET):
312         @ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
313                 if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
314                         libs="$(LIBKRB5) $$libs"; \
315                 fi; \
316                 $(NEWMAKE) -f Makefile.shared \
317                         $(BUILDENV) \
318                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
319                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
320                         LIBDEPS="$$libs $(EX_LIBS)" \
321                         LIBRPATH="$(INSTALLTOP)/lib" \
322                         link_a.$(SHLIB_TARGET); \
323                 libs="-l$$i $$libs"; \
324         done
325
326 openssl.pc: Makefile.ssl
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 and tools'; \
334             echo 'Version: '$(VERSION); \
335             echo 'Requires: '; \
336             echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
337             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
338
339 Makefile.ssl: Makefile.org
340         @echo "Makefile.ssl is older than Makefile.org."
341         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
342         @false
343
344 libclean:
345         rm -f *.map *.so *.so.* engines/*.so *.a */lib */*/lib
346
347 clean:  libclean
348         rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
349         @set -e; for i in $(DIRS) ;\
350         do \
351         if [ -d "$$i" ]; then \
352                 (cd $$i && echo "making clean in $$i..." && \
353                 $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
354                 rm -f $(LIBS); \
355         fi; \
356         done;
357         rm -f openssl.pc
358         rm -f speed.* .pure
359         rm -f $(TARFILE)
360         @set -e; for i in $(ONEDIRS) ;\
361         do \
362         rm -fr $$i/*; \
363         done
364
365 makefile.one: files
366         $(PERL) util/mk1mf.pl >makefile.one; \
367         sh util/do_ms.sh
368
369 files:
370         $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
371         @set -e; for i in $(DIRS) ;\
372         do \
373         if [ -d "$$i" ]; then \
374                 (cd $$i && echo "making 'files' in $$i..." && \
375                 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
376         fi; \
377         done;
378
379 links:
380         @$(TOP)/util/point.sh Makefile.ssl Makefile
381         @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
382         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
383         @set -e; target=links; for dir in $(DIRS); do $(BUILD_CMD); done
384
385 gentests:
386         @(cd test && echo "generating dummy tests (if needed)..." && \
387         $(MAKE) $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
388
389 dclean:
390         rm -f *.bak
391         @set -e; for i in $(DIRS) ;\
392         do \
393         if [ -d "$$i" ]; then \
394                 (cd $$i && echo "making dclean in $$i..." && \
395                 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
396         fi; \
397         done;
398
399 rehash: rehash.time
400 rehash.time: certs
401         @(OPENSSL="`pwd`/apps/openssl$(EXE_EXT)"; OPENSSL_DEBUG_MEMORY=on; \
402                 export OPENSSL OPENSSL_DEBUG_MEMORY; \
403                 LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
404                 DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
405                 SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \
406                 LIBPATH="`pwd`:$$LIBPATH"; \
407                 if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
408                 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
409                 $(PERL) tools/c_rehash certs)
410         touch rehash.time
411
412 test:   tests
413
414 tests: rehash
415         @(cd test && echo "testing..." && \
416         $(MAKE) $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
417         @LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
418         DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
419         SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \
420         LIBPATH="`pwd`:$$LIBPATH"; \
421         if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
422         export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
423         apps/openssl version -a
424
425 report:
426         @$(PERL) util/selftest.pl
427
428 depend:
429         @set -e; for i in $(DIRS) ;\
430         do \
431         if [ -d "$$i" ]; then \
432                 (cd $$i && echo "making dependencies $$i..." && \
433                 $(MAKE) SDIRS='${SDIRS}' CFLAG='-DOPENSSL_NO_DEPRECATED ${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
434         fi; \
435         done;
436
437 lint:
438         @set -e; for i in $(DIRS) ;\
439         do \
440         if [ -d "$$i" ]; then \
441                 (cd $$i && echo "making lint $$i..." && \
442                 $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
443         fi; \
444         done;
445
446 tags:
447         @set -e; for i in $(DIRS) ;\
448         do \
449         if [ -d "$$i" ]; then \
450                 (cd $$i && echo "making tags $$i..." && \
451                 $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
452         fi; \
453         done;
454
455 errors:
456         $(PERL) util/mkerr.pl -recurse -write
457         (cd engines; $(MAKE) PERL=$(PERL) errors)
458
459 stacks:
460         $(PERL) util/mkstack.pl -write
461
462 util/libeay.num::
463         $(PERL) util/mkdef.pl crypto update
464
465 util/ssleay.num::
466         $(PERL) util/mkdef.pl ssl update
467
468 crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
469         $(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
470 crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
471         $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
472
473 apps/openssl-vms.cnf: apps/openssl.cnf
474         $(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
475
476 TABLE: Configure
477         (echo 'Output of `Configure TABLE'"':"; \
478         $(PERL) Configure TABLE) > TABLE
479
480 update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf TABLE
481
482 # Build distribution tar-file. As the list of files returned by "find" is
483 # pretty long, on several platforms a "too many arguments" error or similar
484 # would occur. Therefore the list of files is temporarily stored into a file
485 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
486 # tar does not support the --files-from option.
487 tar:
488         find . -type d -print | xargs chmod 755
489         find . -type f -print | xargs chmod a+r
490         find . -type f -perm -0100 -print | xargs chmod a+x
491         find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
492         $(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
493         tardy --user_number=0  --user_name=openssl \
494               --group_number=0 --group_name=openssl \
495               --prefix=openssl-$(VERSION) - |\
496         gzip --best >../$(TARFILE).gz; \
497         rm -f ../$(TARFILE).list; \
498         ls -l ../$(TARFILE).gz
499
500 tar-snap:
501         @$(TAR) $(TARFLAGS) -cvf - \
502                 `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` |\
503         tardy --user_number=0  --user_name=openssl \
504               --group_number=0 --group_name=openssl \
505               --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
506         ls -l ../$(TARFILE)
507
508 dist:   
509         $(PERL) Configure dist
510         @$(MAKE) dist_pem_h
511         @$(MAKE) SDIRS='${SDIRS}' clean
512         @$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
513
514 dist_pem_h:
515         (cd crypto/pem; $(MAKE) $(BUILDENV) pem.h; $(MAKE) clean)
516
517 install: all install_docs install_sw
518
519 install_sw:
520         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
521                 $(INSTALL_PREFIX)$(INSTALLTOP)/lib \
522                 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines \
523                 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \
524                 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
525                 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
526                 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
527                 $(INSTALL_PREFIX)$(OPENSSLDIR)/private
528         @set -e; for i in $(EXHEADER) ;\
529         do \
530         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
531         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
532         done;
533         @set -e; for i in $(DIRS) ;\
534         do \
535         if [ -d "$$i" ]; then \
536                 (cd $$i; echo "installing $$i..."; \
537                 $(MAKE) $(BUILDENV) INSTALL_PREFIX='${INSTALL_PREFIX}' OPENSSLDIR='${OPENSSLDIR}' install ); \
538         fi; \
539         done
540         @set -e; for i in $(LIBS) ;\
541         do \
542                 if [ -f "$$i" ]; then \
543                 (       echo installing $$i; \
544                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
545                         $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
546                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
547                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
548                 fi; \
549         done;
550         @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
551                 tmp="$(SHARED_LIBS)"; \
552                 for i in $${tmp:-x}; \
553                 do \
554                         if [ -f "$$i" -o -f "$$i.a" ]; then \
555                         (       echo installing $$i; \
556                                 if [ "$(PLATFORM)" != "Cygwin" ]; then \
557                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
558                                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
559                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
560                                 else \
561                                         c=`echo $$i | sed 's/^lib/cyg/'`; \
562                                         cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
563                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
564                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
565                                         cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
566                                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
567                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
568                                 fi ); \
569                         fi; \
570                 done; \
571                 (       here="`pwd`"; \
572                         cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
573                         $(NEWMAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
574                 if [ "$(INSTALLTOP)" != "/usr" ]; then \
575                         echo 'OpenSSL shared libraries have been installed in:'; \
576                         echo '  $(INSTALLTOP)'; \
577                         echo ''; \
578                         sed -e '1,/^$$/d' doc/openssl-shared.txt; \
579                 fi; \
580         fi
581         cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
582         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc
583
584 install_docs:
585         @$(PERL) $(TOP)/util/mkdir-p.pl \
586                 $(INSTALL_PREFIX)$(MANDIR)/man1 \
587                 $(INSTALL_PREFIX)$(MANDIR)/man3 \
588                 $(INSTALL_PREFIX)$(MANDIR)/man5 \
589                 $(INSTALL_PREFIX)$(MANDIR)/man7
590         @pod2man="`cd util; ./pod2mantest $(PERL)`"; \
591         here="`pwd`"; \
592         filecase=; \
593         if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" ]; then \
594                 filecase=-i; \
595         fi; \
596         set -e; for i in doc/apps/*.pod; do \
597                 fn=`basename $$i .pod`; \
598                 if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
599                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
600                 (cd `$(PERL) util/dirname.pl $$i`; \
601                 sh -c "$$pod2man \
602                         --section=$$sec --center=OpenSSL \
603                         --release=$(VERSION) `basename $$i`") \
604                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
605                 $(PERL) util/extract-names.pl < $$i | \
606                         grep -v $$filecase "^$$fn\$$" | \
607                         grep -v "[      ]" | \
608                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
609                          while read n; do \
610                                 $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
611                          done); \
612         done; \
613         set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
614                 fn=`basename $$i .pod`; \
615                 if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
616                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
617                 (cd `$(PERL) util/dirname.pl $$i`; \
618                 sh -c "$$pod2man \
619                         --section=$$sec --center=OpenSSL \
620                         --release=$(VERSION) `basename $$i`") \
621                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
622                 $(PERL) util/extract-names.pl < $$i | \
623                         grep -v $$filecase "^$$fn\$$" | \
624                         grep -v "[      ]" | \
625                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
626                          while read n; do \
627                                 $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
628                          done); \
629         done
630
631 # DO NOT DELETE THIS LINE -- make depend depends on it.