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