Makefile.shared needs to know how it can reach itself.
[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 # INSTALL_PREFIX is for package builders so that they can configure
19 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
20 # Normally it is left empty.
21 INSTALL_PREFIX=
22 INSTALLTOP=/usr/local/ssl
23
24 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
25 OPENSSLDIR=/usr/local/ssl
26
27 # NO_IDEA - Define to build without the IDEA algorithm
28 # NO_RC4  - Define to build without the RC4 algorithm
29 # NO_RC2  - Define to build without the RC2 algorithm
30 # THREADS - Define when building with threads, you will probably also need any
31 #           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
32 # TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
33 # TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
34 # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
35 # DEVRANDOM - Give this the value of the 'random device' if your OS supports
36 #           one.  32 bytes will be read from this when the random
37 #           number generator is initalised.
38 # SSL_FORBID_ENULL - define if you want the server to be not able to use the
39 #           NULL encryption ciphers.
40 #
41 # LOCK_DEBUG - turns on lots of lock debug output :-)
42 # REF_CHECK - turn on some xyz_free() assertions.
43 # REF_PRINT - prints some stuff on structure free.
44 # CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
45 # MFUNC - Make all Malloc/Free/Realloc calls call
46 #       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
47 #       call application defined callbacks via CRYPTO_set_mem_functions()
48 # MD5_ASM needs to be defined to use the x86 assembler for MD5
49 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1
50 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
51 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
52 # equal 4.
53 # PKCS1_CHECK - pkcs1 tests.
54
55 CC= gcc
56 #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
57 CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
58 DEPFLAG= 
59 PEX_LIBS= 
60 EX_LIBS= 
61 EXE_EXT= 
62 ARFLAGS=
63 AR=ar $(ARFLAGS) r
64 RANLIB= ranlib
65 PERL= perl
66 TAR= tar
67 TARFLAGS= --no-recursion
68 MAKEDEPPROG=makedepend
69
70 # Set BN_ASM to bn_asm.o if you want to use the C version
71 BN_ASM= bn_asm.o
72 #BN_ASM= bn_asm.o
73 #BN_ASM= asm/bn86-elf.o # elf, linux-elf
74 #BN_ASM= asm/bn86-sol.o # solaris
75 #BN_ASM= asm/bn86-out.o # a.out, FreeBSD
76 #BN_ASM= asm/bn86bsdi.o # bsdi
77 #BN_ASM= asm/alpha.o    # DEC Alpha
78 #BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
79 #BN_ASM= asm/r3000.o    # SGI MIPS cpu
80 #BN_ASM= asm/sparc.o    # Sun solaris/SunOS
81 #BN_ASM= asm/bn-win32.o # Windows 95/NT
82 #BN_ASM= asm/x86w16.o   # 16 bit code for Windows 3.1/DOS
83 #BN_ASM= asm/x86w32.o   # 32 bit code for Windows 3.1
84
85 # For x86 assembler: Set PROCESSOR to 386 if you want to support
86 # the 80386.
87 PROCESSOR=
88
89 # Set DES_ENC to des_enc.o if you want to use the C version
90 #There are 4 x86 assember options.
91 DES_ENC= asm/dx86-out.o asm/yx86-out.o
92 #DES_ENC= des_enc.o fcrypt_b.o          # C
93 #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
94 #DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
95 #DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
96 #DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
97
98 # Set BF_ENC to bf_enc.o if you want to use the C version
99 #There are 4 x86 assember options.
100 BF_ENC= asm/bx86-out.o
101 #BF_ENC= bf_enc.o
102 #BF_ENC= asm/bx86-elf.o # elf
103 #BF_ENC= asm/bx86-sol.o # solaris
104 #BF_ENC= asm/bx86-out.o # a.out, FreeBSD
105 #BF_ENC= asm/bx86bsdi.o # bsdi
106
107 # Set CAST_ENC to c_enc.o if you want to use the C version
108 #There are 4 x86 assember options.
109 CAST_ENC= asm/cx86-out.o
110 #CAST_ENC= c_enc.o
111 #CAST_ENC= asm/cx86-elf.o # elf
112 #CAST_ENC= asm/cx86-sol.o # solaris
113 #CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
114 #CAST_ENC= asm/cx86bsdi.o # bsdi
115
116 # Set RC4_ENC to rc4_enc.o if you want to use the C version
117 #There are 4 x86 assember options.
118 RC4_ENC= asm/rx86-out.o
119 #RC4_ENC= rc4_enc.o
120 #RC4_ENC= asm/rx86-elf.o # elf
121 #RC4_ENC= asm/rx86-sol.o # solaris
122 #RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
123 #RC4_ENC= asm/rx86bsdi.o # bsdi
124
125 # Set RC5_ENC to rc5_enc.o if you want to use the C version
126 #There are 4 x86 assember options.
127 RC5_ENC= asm/r586-out.o
128 #RC5_ENC= rc5_enc.o
129 #RC5_ENC= asm/r586-elf.o # elf
130 #RC5_ENC= asm/r586-sol.o # solaris
131 #RC5_ENC= asm/r586-out.o # a.out, FreeBSD
132 #RC5_ENC= asm/r586bsdi.o # bsdi
133
134 # Also need MD5_ASM defined
135 MD5_ASM_OBJ= asm/mx86-out.o
136 #MD5_ASM_OBJ= asm/mx86-elf.o        # elf
137 #MD5_ASM_OBJ= asm/mx86-sol.o        # solaris
138 #MD5_ASM_OBJ= asm/mx86-out.o        # a.out, FreeBSD
139 #MD5_ASM_OBJ= asm/mx86bsdi.o        # bsdi
140
141 # Also need SHA1_ASM defined
142 SHA1_ASM_OBJ= asm/sx86-out.o
143 #SHA1_ASM_OBJ= asm/sx86-elf.o       # elf
144 #SHA1_ASM_OBJ= asm/sx86-sol.o       # solaris
145 #SHA1_ASM_OBJ= asm/sx86-out.o       # a.out, FreeBSD
146 #SHA1_ASM_OBJ= asm/sx86bsdi.o       # bsdi
147
148 # Also need RMD160_ASM defined
149 RMD160_ASM_OBJ= asm/rm86-out.o
150 #RMD160_ASM_OBJ= asm/rm86-elf.o       # elf
151 #RMD160_ASM_OBJ= asm/rm86-sol.o       # solaris
152 #RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
153 #RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi
154
155 # KRB5 stuff
156 KRB5_INCLUDES=
157 LIBKRB5=
158
159 DIRS=   crypto ssl engines apps test tools
160 SHLIBDIRS= crypto ssl
161
162 # dirs in crypto to build
163 SDIRS=  \
164         md2 md4 md5 sha mdc2 hmac ripemd \
165         des rc2 rc4 rc5 idea bf cast \
166         bn ec rsa dsa ecdsa dh ecdh dso engine aes \
167         buffer bio stack lhash rand err objects \
168         evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
169
170 # tests to perform.  "alltests" is a special word indicating that all tests
171 # should be performed.
172 TESTS = alltests
173
174 MAKEFILE= Makefile.ssl
175 NEWMAKE=  make
176 MAKE=     $(NEWMAKE) -f Makefile.ssl
177
178 MANDIR=$(OPENSSLDIR)/man
179 MAN1=1
180 MAN3=3
181 SHELL=/bin/sh
182
183 TOP=    .
184 ONEDIRS=out tmp
185 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
186 WDIRS=  windows
187 LIBS=   libcrypto.a libssl.a
188 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
189 SHARED_SSL=libssl$(SHLIB_EXT)
190 SHARED_LIBS=
191 SHARED_LIBS_LINK_EXTS=
192 SHARED_LDFLAGS=
193
194 GENERAL=        Makefile
195 BASENAME=       openssl
196 NAME=           $(BASENAME)-$(VERSION)
197 TARFILE=        $(NAME).tar
198 WTARFILE=       $(NAME)-win.tar
199 EXHEADER=       e_os2.h
200 HEADER=         e_os.h
201
202 all: Makefile.ssl build_all
203
204 BUILD_CMD=if echo " $(DIRS) " | grep " $$i " >/dev/null 2>/dev/null; then \
205         if [ -d "$$i" ]; then \
206                 (cd $$i && echo "making all in $$i..." && \
207                 $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \
208         else \
209                 $(MAKE) $$i; \
210         fi; fi
211
212 sub_all: build_all
213 build_all: build_libs build_apps build_tests build_tools
214
215 build_libs: build_crypto build_ssl build_engines
216
217 build_crypto:
218         @i=crypto; $(BUILD_CMD)
219 build_ssl:
220         @i=ssl; $(BUILD_CMD)
221 build_engines:
222         @i=engines; $(BUILD_CMD)
223 build_apps:
224         @i=apps; $(BUILD_CMD)
225 build_tests:
226         @i=test; $(BUILD_CMD)
227 build_tools:
228         @i=tools; $(BUILD_CMD)
229
230 libcrypto$(SHLIB_EXT): libcrypto.a
231         @if [ "$(SHLIB_TARGET)" != "" ]; then \
232                 $(MAKE) SHLIBDIRS=crypto build-shared; \
233         else \
234                 echo "There's no support for shared libraries on this platform" >&2; \
235         fi
236
237 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
238         @if [ "$(SHLIB_TARGET)" != "" ]; then \
239                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
240         else \
241                 echo "There's no support for shared libraries on this platform" >&2; \
242         fi
243
244 clean-shared:
245         @for i in $(SHLIBDIRS); do \
246                 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
247                         tmp="$(SHARED_LIBS_LINK_EXTS)"; \
248                         for j in $${tmp:-x}; do \
249                                 ( set -x; rm -f lib$$i$$j ); \
250                         done; \
251                 fi; \
252                 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
253                 if [ "$(PLATFORM)" = "Cygwin" ]; then \
254                         ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
255                 fi; \
256         done
257
258 link-shared:
259         @ for i in ${SHLIBDIRS}; do \
260                 $(NEWMAKE) -f Makefile.shared \
261                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
262                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
263                         symlink.$(SHLIB_TARGET); \
264                 libs="$$libs -l$$i"; \
265         done
266
267 build-shared: do_$(SHLIB_TARGET) link-shared
268
269 do_$(SHLIB_TARGET):
270         @ libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
271                 $(NEWMAKE) -f Makefile.shared \
272                         SHARED_MAKEFILE=Makefile.shared \
273                         CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
274                         SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
275                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
276                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
277                         LIBDEPS="$$libs $(EX_LIBS)" \
278                         link_a.$(SHLIB_TARGET); \
279                 libs="$$libs -l$$i"; \
280         done
281
282 Makefile.ssl: Makefile.org
283         @echo "Makefile.ssl is older than Makefile.org."
284         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
285         @false
286
287 libclean:
288         rm -f *.so *.so.* engines/*.so *.a */lib */*/lib
289
290 clean:
291         rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
292         @for i in $(DIRS) ;\
293         do \
294         if [ -d "$$i" ]; then \
295                 (cd $$i && echo "making clean in $$i..." && \
296                 $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
297                 rm -f $(LIBS); \
298         fi; \
299         done;
300         rm -f *.a *.o speed.* *.map *.so .pure core
301         rm -f $(TARFILE)
302         @for i in $(ONEDIRS) ;\
303         do \
304         rm -fr $$i/*; \
305         done
306
307 makefile.one: files
308         $(PERL) util/mk1mf.pl >makefile.one; \
309         sh util/do_ms.sh
310
311 files:
312         $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
313         @for i in $(DIRS) ;\
314         do \
315         if [ -d "$$i" ]; then \
316                 (cd $$i && echo "making 'files' in $$i..." && \
317                 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
318         fi; \
319         done;
320
321 links:
322         @$(TOP)/util/point.sh Makefile.ssl Makefile
323         @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
324         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
325         @for i in $(DIRS); do \
326         if [ -d "$$i" ]; then \
327                 (cd $$i && echo "making links in $$i..." && \
328                 $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' links ) || exit 1; \
329         fi; \
330         done;
331
332 gentests:
333         @(cd test && echo "generating dummy tests (if needed)..." && \
334         $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
335
336 dclean:
337         rm -f *.bak
338         @for i in $(DIRS) ;\
339         do \
340         if [ -d "$$i" ]; then \
341                 (cd $$i && echo "making dclean in $$i..." && \
342                 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
343         fi; \
344         done;
345
346 rehash: rehash.time
347 rehash.time: certs
348         @(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
349                 export OPENSSL OPENSSL_DEBUG_MEMORY; \
350                 LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
351                 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
352                 $(PERL) tools/c_rehash certs)
353         touch rehash.time
354
355 test:   tests
356
357 tests: rehash
358         @(cd test && echo "testing..." && \
359         $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
360         @LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
361                 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
362                 apps/openssl version -a
363
364 report:
365         @$(PERL) util/selftest.pl
366
367 depend:
368         @for i in $(DIRS) ;\
369         do \
370         if [ -d "$$i" ]; then \
371                 (cd $$i && echo "making dependencies $$i..." && \
372                 $(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
373         fi; \
374         done;
375
376 lint:
377         @for i in $(DIRS) ;\
378         do \
379         if [ -d "$$i" ]; then \
380                 (cd $$i && echo "making lint $$i..." && \
381                 $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
382         fi; \
383         done;
384
385 tags:
386         @for i in $(DIRS) ;\
387         do \
388         if [ -d "$$i" ]; then \
389                 (cd $$i && echo "making tags $$i..." && \
390                 $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
391         fi; \
392         done;
393
394 errors:
395         $(PERL) util/mkerr.pl -recurse -write
396         (cd engines; $(MAKE) PERL=$(PERL) errors)
397
398 stacks:
399         $(PERL) util/mkstack.pl -write
400
401 util/libeay.num::
402         $(PERL) util/mkdef.pl crypto update
403
404 util/ssleay.num::
405         $(PERL) util/mkdef.pl ssl update
406
407 crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
408         $(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
409 crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
410         $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
411
412 TABLE: Configure
413         (echo 'Output of `Configure TABLE'"':"; \
414         $(PERL) Configure TABLE) > TABLE
415
416 update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
417
418 # Build distribution tar-file. As the list of files returned by "find" is
419 # pretty long, on several platforms a "too many arguments" error or similar
420 # would occur. Therefore the list of files is temporarily stored into a file
421 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
422 # tar does not support the --files-from option.
423 tar:
424         find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
425         $(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
426         tardy --user_number=0  --user_name=openssl \
427               --group_number=0 --group_name=openssl \
428               --prefix=openssl-$(VERSION) - |\
429         gzip --best >../$(TARFILE).gz; \
430         rm -f ../$(TARFILE).list; \
431         ls -l ../$(TARFILE).gz
432
433 tar-snap:
434         @$(TAR) $(TARFLAGS) -cvf - \
435                 `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` |\
436         tardy --user_number=0  --user_name=openssl \
437               --group_number=0 --group_name=openssl \
438               --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
439         ls -l ../$(TARFILE)
440
441 dist:   
442         $(PERL) Configure dist
443         @$(MAKE) dist_pem_h
444         @$(MAKE) SDIRS='${SDIRS}' clean
445         @$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
446
447 dist_pem_h:
448         (cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
449
450 install: all install_docs
451         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
452                 $(INSTALL_PREFIX)$(INSTALLTOP)/lib \
453                 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
454                 $(INSTALL_PREFIX)$(OPENSSLDIR)/engines \
455                 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
456                 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
457                 $(INSTALL_PREFIX)$(OPENSSLDIR)/private \
458                 $(INSTALL_PREFIX)$(OPENSSLDIR)/lib
459         @for i in $(EXHEADER) ;\
460         do \
461         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
462         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
463         done;
464         @for i in $(DIRS) ;\
465         do \
466         if [ -d "$$i" ]; then \
467                 (cd $$i; echo "installing $$i..."; \
468                 $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' EXE_EXT='${EXE_EXT}' install ); \
469         fi; \
470         done
471         @for i in $(LIBS) ;\
472         do \
473                 if [ -f "$$i" ]; then \
474                 (       echo installing $$i; \
475                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
476                         $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
477                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
478                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
479                 fi; \
480         done;
481         @if [ -n "$(SHARED_LIBS)" ]; then \
482                 tmp="$(SHARED_LIBS)"; \
483                 for i in $${tmp:-x}; \
484                 do \
485                         if [ -f "$$i" -o -f "$$i.a" ]; then \
486                         (       echo installing $$i; \
487                                 if [ "$(PLATFORM)" != "Cygwin" ]; then \
488                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
489                                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
490                                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
491                                 else \
492                                         c=`echo $$i | sed 's/^lib/cyg/'`; \
493                                         cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
494                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
495                                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
496                                         cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
497                                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
498                                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
499                                 fi ); \
500                         fi; \
501                 done; \
502                 (       here="`pwd`"; \
503                         cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
504                         $(NEWMAKE) -f $$here/Makefile link-shared ); \
505         fi
506
507 install_docs:
508         @$(PERL) $(TOP)/util/mkdir-p.pl \
509                 $(INSTALL_PREFIX)$(MANDIR)/man1 \
510                 $(INSTALL_PREFIX)$(MANDIR)/man3 \
511                 $(INSTALL_PREFIX)$(MANDIR)/man5 \
512                 $(INSTALL_PREFIX)$(MANDIR)/man7
513         @pod2man="`cd util; ./pod2mantest $(PERL)`"; \
514         for i in doc/apps/*.pod; do \
515                 fn=`basename $$i .pod`; \
516                 if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
517                 echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
518                 (cd `$(PERL) util/dirname.pl $$i`; \
519                 sh -c "$$pod2man \
520                         --section=$$sec --center=OpenSSL \
521                         --release=$(VERSION) `basename $$i`") \
522                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
523         done; \
524         for i in doc/crypto/*.pod doc/ssl/*.pod; do \
525                 fn=`basename $$i .pod`; \
526                 if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
527                 echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
528                 (cd `$(PERL) util/dirname.pl $$i`; \
529                 sh -c "$$pod2man \
530                         --section=$$sec --center=OpenSSL \
531                         --release=$(VERSION) `basename $$i`") \
532                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
533         done
534
535 # DO NOT DELETE THIS LINE -- make depend depends on it.