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