DJGPP patches.
[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 openssl.pc
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                         CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
273                         SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
274                         LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
275                         LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
276                         LIBDEPS="$$libs $(EX_LIBS)" \
277                         link_a.$(SHLIB_TARGET); \
278                 libs="$$libs -l$$i"; \
279         done
280
281 openssl.pc:
282         @ ( echo 'prefix=$(INSTALLTOP)'; \
283             echo 'exec_prefix=$${prefix}'; \
284             echo 'libdir=$${exec_prefix}/lib'; \
285             echo 'includedir=$${prefix}/include'; \
286             echo ''; \
287             echo 'Name: OpenSSL'; \
288             echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
289             echo 'Version: '$(VERSION); \
290             echo 'Requires: '; \
291             echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
292             echo 'Cflags: -I$${includedir}' ) > openssl.pc
293
294 Makefile.ssl: Makefile.org
295         @echo "Makefile.ssl is older than Makefile.org."
296         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
297         @false
298
299 libclean:
300         rm -f *.so *.so.* engines/*.so *.a */lib */*/lib
301
302 clean:
303         rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
304         @for i in $(DIRS) ;\
305         do \
306         if [ -d "$$i" ]; then \
307                 (cd $$i && echo "making clean in $$i..." && \
308                 $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
309                 rm -f $(LIBS); \
310         fi; \
311         done;
312         rm -f openssl.pc
313         rm -f *.a *.o speed.* *.map *.so .pure core
314         rm -f $(TARFILE)
315         @for i in $(ONEDIRS) ;\
316         do \
317         rm -fr $$i/*; \
318         done
319
320 makefile.one: files
321         $(PERL) util/mk1mf.pl >makefile.one; \
322         sh util/do_ms.sh
323
324 files:
325         $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
326         @for i in $(DIRS) ;\
327         do \
328         if [ -d "$$i" ]; then \
329                 (cd $$i && echo "making 'files' in $$i..." && \
330                 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
331         fi; \
332         done;
333
334 links:
335         @$(TOP)/util/point.sh Makefile.ssl Makefile
336         @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
337         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
338         @for i in $(DIRS); do \
339         if [ -d "$$i" ]; then \
340                 (cd $$i && echo "making links in $$i..." && \
341                 $(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; \
342         fi; \
343         done;
344
345 gentests:
346         @(cd test && echo "generating dummy tests (if needed)..." && \
347         $(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 );
348
349 dclean:
350         rm -f *.bak
351         @for i in $(DIRS) ;\
352         do \
353         if [ -d "$$i" ]; then \
354                 (cd $$i && echo "making dclean in $$i..." && \
355                 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
356         fi; \
357         done;
358
359 rehash: rehash.time
360 rehash.time: certs
361         @(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; 
362                 export OPENSSL OPENSSL_DEBUG_MEMORY; \
363                 LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
364                 if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
365                 if [ "$(PLATFORM)" != "DJGPP" ]; then PATH="`pwd`\;$$PATH"; fi; \
366                 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
367                 $(PERL) tools/c_rehash certs)
368         touch rehash.time
369
370 test:   tests
371
372 tests: rehash
373         @(cd test && echo "testing..." && \
374         $(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 );
375         @LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
376                 if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
377                 if [ "$(PLATFORM)" != "DJGPP" ]; then PATH="`pwd`\;$$PATH"; fi; \
378                 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
379                 apps/openssl version -a
380 endif
381
382 report:
383         @$(PERL) util/selftest.pl
384
385 depend:
386         @for i in $(DIRS) ;\
387         do \
388         if [ -d "$$i" ]; then \
389                 (cd $$i && echo "making dependencies $$i..." && \
390                 $(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
391         fi; \
392         done;
393
394 lint:
395         @for i in $(DIRS) ;\
396         do \
397         if [ -d "$$i" ]; then \
398                 (cd $$i && echo "making lint $$i..." && \
399                 $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
400         fi; \
401         done;
402
403 tags:
404         @for i in $(DIRS) ;\
405         do \
406         if [ -d "$$i" ]; then \
407                 (cd $$i && echo "making tags $$i..." && \
408                 $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
409         fi; \
410         done;
411
412 errors:
413         $(PERL) util/mkerr.pl -recurse -write
414         (cd engines; $(MAKE) PERL=$(PERL) errors)
415
416 stacks:
417         $(PERL) util/mkstack.pl -write
418
419 util/libeay.num::
420         $(PERL) util/mkdef.pl crypto update
421
422 util/ssleay.num::
423         $(PERL) util/mkdef.pl ssl update
424
425 crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
426         $(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
427 crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
428         $(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
429
430 TABLE: Configure
431         (echo 'Output of `Configure TABLE'"':"; \
432         $(PERL) Configure TABLE) > TABLE
433
434 update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
435
436 # Build distribution tar-file. As the list of files returned by "find" is
437 # pretty long, on several platforms a "too many arguments" error or similar
438 # would occur. Therefore the list of files is temporarily stored into a file
439 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
440 # tar does not support the --files-from option.
441 tar:
442         find . -type d -print | xargs chmod 755
443         find . -type f -print | xargs chmod a+r
444         find . -type f -perm -0100 -print | xargs chmod a+x
445         find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
446         $(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
447         tardy --user_number=0  --user_name=openssl \
448               --group_number=0 --group_name=openssl \
449               --prefix=openssl-$(VERSION) - |\
450         gzip --best >../$(TARFILE).gz; \
451         rm -f ../$(TARFILE).list; \
452         ls -l ../$(TARFILE).gz
453
454 tar-snap:
455         @$(TAR) $(TARFLAGS) -cvf - \
456                 `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` |\
457         tardy --user_number=0  --user_name=openssl \
458               --group_number=0 --group_name=openssl \
459               --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
460         ls -l ../$(TARFILE)
461
462 dist:   
463         $(PERL) Configure dist
464         @$(MAKE) dist_pem_h
465         @$(MAKE) SDIRS='${SDIRS}' clean
466         @$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
467
468 dist_pem_h:
469         (cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
470
471 install: all install_docs
472         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
473                 $(INSTALL_PREFIX)$(INSTALLTOP)/lib \
474                 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo \
475                 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
476                 $(INSTALL_PREFIX)$(OPENSSLDIR)/engines \
477                 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
478                 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
479                 $(INSTALL_PREFIX)$(OPENSSLDIR)/private \
480                 $(INSTALL_PREFIX)$(OPENSSLDIR)/lib
481         @for i in $(EXHEADER) ;\
482         do \
483         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
484         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
485         done;
486         @for i in $(DIRS) ;\
487         do \
488         if [ -d "$$i" ]; then \
489                 (cd $$i; echo "installing $$i..."; \
490                 $(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 ); \
491         fi; \
492         done
493         @for i in $(LIBS) ;\
494         do \
495                 if [ -f "$$i" ]; then \
496                 (       echo installing $$i; \
497                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
498                         $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
499                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
500                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
501                 fi; \
502         done;
503         @if [ -n "$(SHARED_LIBS)" ]; then \
504                 tmp="$(SHARED_LIBS)"; \
505                 for i in $${tmp:-x}; \
506                 do \
507                         if [ -f "$$i" -o -f "$$i.a" ]; then \
508                         (       echo installing $$i; \
509                                 if [ "$(PLATFORM)" != "Cygwin" ]; then \
510                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
511                                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
512                                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
513                                 else \
514                                         c=`echo $$i | sed 's/^lib/cyg/'`; \
515                                         cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
516                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
517                                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
518                                         cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
519                                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
520                                         mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
521                                 fi ); \
522                         fi; \
523                 done; \
524                 (       here="`pwd`"; \
525                         cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
526                         $(NEWMAKE) -f $$here/Makefile link-shared ); \
527         fi
528         cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo
529
530 install_docs:
531         @$(PERL) $(TOP)/util/mkdir-p.pl \
532                 $(INSTALL_PREFIX)$(MANDIR)/man1 \
533                 $(INSTALL_PREFIX)$(MANDIR)/man3 \
534                 $(INSTALL_PREFIX)$(MANDIR)/man5 \
535                 $(INSTALL_PREFIX)$(MANDIR)/man7
536         @pod2man="`cd util; ./pod2mantest $(PERL)`"; \
537         for i in doc/apps/*.pod; do \
538                 fn=`basename $$i .pod`; \
539                 if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
540                 echo "installing man$$sec/$$fn.$$sec"; \
541                 (cd `$(PERL) util/dirname.pl $$i`; \
542                 sh -c "$$pod2man \
543                         --section=$$sec --center=OpenSSL \
544                         --release=$(VERSION) `basename $$i`") \
545                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
546                 $(PERL) util/extract-names.pl < $$i | grep -v "^$$fn" | \
547                         while read n; do \
548                                 util/point.sh $$fn.$$sec $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$n.$$sec; \
549                         done; \
550         done; \
551         for i in doc/crypto/*.pod doc/ssl/*.pod; do \
552                 fn=`basename $$i .pod`; \
553                 if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
554                 echo "installing man$$sec/$$fn.$$sec"; \
555                 (cd `$(PERL) util/dirname.pl $$i`; \
556                 sh -c "$$pod2man \
557                         --section=$$sec --center=OpenSSL \
558                         --release=$(VERSION) `basename $$i`") \
559                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
560                 $(PERL) util/extract-names.pl < $$i | grep -v "^$$fn" | \
561                         while read n; do \
562                                 util/point.sh $$fn.$$sec $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$n.$$sec; \
563                         done; \
564         done
565
566 # DO NOT DELETE THIS LINE -- make depend depends on it.