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