97bf3cf3fe5e5f4293ca35e63b268c9331eccccb
[openssl.git] / Makefile.org
1 ##
2 ## Makefile for OpenSSL
3 ##
4
5 VERSION=
6 MAJOR=
7 MINOR=
8 PLATFORM=dist
9 INSTALLTOP=/usr/local/ssl
10
11 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
12 OPENSSLDIR=/usr/local/ssl
13
14 # RSAref  - Define if we are to link with RSAref.
15 # NO_IDEA - Define to build without the IDEA algorithm
16 # NO_RC4  - Define to build without the RC4 algorithm
17 # NO_RC2  - Define to build without the RC2 algorithm
18 # THREADS - Define when building with threads, you will probably also need any
19 #           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
20 # TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
21 # TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
22 # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
23 # DEVRANDOM - Give this the value of the 'random device' if your OS supports
24 #           one.  32 bytes will be read from this when the random
25 #           number generator is initalised.
26 # SSL_ALLOW_ADH - define if you want the server to be able to use the
27 #           SSLv3 anon-DH ciphers.
28 # SSL_FORBID_ENULL - define if you want the server to be not able to use the
29 #           NULL encryption ciphers.
30 #
31 # LOCK_DEBUG - turns on lots of lock debug output :-)
32 # REF_CHECK - turn on some xyz_free() assertions.
33 # REF_PRINT - prints some stuff on structure free.
34 # CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
35 # MFUNC - Make all Malloc/Free/Realloc calls call
36 #       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
37 #       call application defined callbacks via CRYPTO_set_mem_functions()
38 # MD5_ASM needs to be defined to use the x86 assembler for MD5
39 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1
40 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
41 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
42 # equal 4.
43 # PKCS1_CHECK - pkcs1 tests.
44
45 CC= gcc
46 #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
47 CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
48 DEPFLAG= 
49 PEX_LIBS= -L. -L.. -L../.. -L../../..
50 EX_LIBS= 
51 AR=ar r
52 RANLIB= ranlib
53 PERL= perl
54
55 # Set BN_ASM to bn_asm.o if you want to use the C version
56 BN_ASM= bn_asm.o
57 #BN_ASM= bn_asm.o
58 #BN_ASM= asm/bn86-elf.o # elf, linux-elf
59 #BN_ASM= asm/bn86-sol.o # solaris
60 #BN_ASM= asm/bn86-out.o # a.out, FreeBSD
61 #BN_ASM= asm/bn86bsdi.o # bsdi
62 #BN_ASM= asm/alpha.o    # DEC Alpha
63 #BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
64 #BN_ASM= asm/r3000.o    # SGI MIPS cpu
65 #BN_ASM= asm/sparc.o    # Sun solaris/SunOS
66 #BN_ASM= asm/bn-win32.o # Windows 95/NT
67 #BN_ASM= asm/x86w16.o   # 16 bit code for Windows 3.1/DOS
68 #BN_ASM= asm/x86w32.o   # 32 bit code for Windows 3.1
69
70 # For x86 assembler: Set PROCESSOR to 386 if you want to support
71 # the 80386.
72 PROCESSOR=
73
74 # Set DES_ENC to des_enc.o if you want to use the C version
75 #There are 4 x86 assember options.
76 DES_ENC= asm/dx86-out.o asm/yx86-out.o
77 #DES_ENC= des_enc.o fcrypt_b.o          # C
78 #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
79 #DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
80 #DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
81 #DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
82
83 # Set BF_ENC to bf_enc.o if you want to use the C version
84 #There are 4 x86 assember options.
85 BF_ENC= asm/bx86-out.o
86 #BF_ENC= bf_enc.o
87 #BF_ENC= asm/bx86-elf.o # elf
88 #BF_ENC= asm/bx86-sol.o # solaris
89 #BF_ENC= asm/bx86-out.o # a.out, FreeBSD
90 #BF_ENC= asm/bx86bsdi.o # bsdi
91
92 # Set CAST_ENC to c_enc.o if you want to use the C version
93 #There are 4 x86 assember options.
94 CAST_ENC= asm/cx86-out.o
95 #CAST_ENC= c_enc.o
96 #CAST_ENC= asm/cx86-elf.o # elf
97 #CAST_ENC= asm/cx86-sol.o # solaris
98 #CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
99 #CAST_ENC= asm/cx86bsdi.o # bsdi
100
101 # Set RC4_ENC to rc4_enc.o if you want to use the C version
102 #There are 4 x86 assember options.
103 RC4_ENC= asm/rx86-out.o
104 #RC4_ENC= rc4_enc.o
105 #RC4_ENC= asm/rx86-elf.o # elf
106 #RC4_ENC= asm/rx86-sol.o # solaris
107 #RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
108 #RC4_ENC= asm/rx86bsdi.o # bsdi
109
110 # Set RC5_ENC to rc5_enc.o if you want to use the C version
111 #There are 4 x86 assember options.
112 RC5_ENC= asm/r586-out.o
113 #RC5_ENC= rc5_enc.o
114 #RC5_ENC= asm/r586-elf.o # elf
115 #RC5_ENC= asm/r586-sol.o # solaris
116 #RC5_ENC= asm/r586-out.o # a.out, FreeBSD
117 #RC5_ENC= asm/r586bsdi.o # bsdi
118
119 # Also need MD5_ASM defined
120 MD5_ASM_OBJ= asm/mx86-out.o
121 #MD5_ASM_OBJ= asm/mx86-elf.o        # elf
122 #MD5_ASM_OBJ= asm/mx86-sol.o        # solaris
123 #MD5_ASM_OBJ= asm/mx86-out.o        # a.out, FreeBSD
124 #MD5_ASM_OBJ= asm/mx86bsdi.o        # bsdi
125
126 # Also need SHA1_ASM defined
127 SHA1_ASM_OBJ= asm/sx86-out.o
128 #SHA1_ASM_OBJ= asm/sx86-elf.o       # elf
129 #SHA1_ASM_OBJ= asm/sx86-sol.o       # solaris
130 #SHA1_ASM_OBJ= asm/sx86-out.o       # a.out, FreeBSD
131 #SHA1_ASM_OBJ= asm/sx86bsdi.o       # bsdi
132
133 # Also need RMD160_ASM defined
134 RMD160_ASM_OBJ= asm/rm86-out.o
135 #RMD160_ASM_OBJ= asm/rm86-elf.o       # elf
136 #RMD160_ASM_OBJ= asm/rm86-sol.o       # solaris
137 #RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
138 #RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi
139
140 DIRS=   crypto ssl rsaref apps test tools
141 SHLIBDIRS= crypto ssl
142
143 # dirs in crypto to build
144 SDIRS=  \
145         md2 md5 sha mdc2 hmac ripemd \
146         des rc2 rc4 rc5 idea bf cast \
147         bn rsa dsa dh \
148         buffer bio stack lhash rand err objects \
149         evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
150
151 MAKEFILE= Makefile.ssl
152 MAKE=     make -f Makefile.ssl
153
154 MAN1=1
155 MAN3=3
156 SHELL=/bin/sh
157
158 TOP=    .
159 ONEDIRS=out tmp
160 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep
161 WDIRS=  windows
162 LIBS=   libcrypto.a libssl.a 
163
164 GENERAL=        Makefile
165 BASENAME=       openssl
166 NAME=           $(BASENAME)-$(VERSION)
167 TARFILE=        $(NAME).tar
168 WTARFILE=       $(NAME)-win.tar
169 EXHEADER=       e_os.h
170 HEADER=         e_os.h
171
172 all: Makefile.ssl
173         @for i in $(DIRS) ;\
174         do \
175         (cd $$i && echo "making all in $$i..." && \
176         $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' 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}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
177         done;
178
179 sub_all:
180         @for i in $(DIRS) ;\
181         do \
182         (cd $$i && echo "making all in $$i..." && \
183         $(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}' all ) || exit 1; \
184         done;
185
186 linux-shared:
187         for i in ${SHLIBDIRS}; do \
188         rm -f lib$$i.a lib$$i.so \
189                 lib$$i.so.${MAJOR} lib$$i.so.${MAJOR}.${MINOR}; \
190         ${MAKE} CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='-fPIC ${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}' DIRS=$$i clean all || exit 1; \
191         ( set -x; ${CC}  -shared -o lib$$i.so.${MAJOR}.${MINOR} \
192                 -Wl,-S,-soname=lib$$i.so.${MAJOR} \
193                 -Wl,--whole-archive lib$$i.a \
194                 -Wl,--no-whole-archive -lc ) || exit 1; \
195         rm -f lib$$i.a; make -C $$i clean || exit 1 ;\
196         done;
197         @set -x; \
198         for i in ${SHLIBDIRS}; do \
199         ln -s lib$$i.so.${MAJOR}.${MINOR} lib$$i.so.${MAJOR}; \
200         ln -s lib$$i.so.${MAJOR} lib$$i.so; \
201         done;
202
203 Makefile.ssl: Makefile.org
204         @echo "Makefile.ssl is older than Makefile.org."
205         @echo "Reconfigure the source tree (via 'perl Configure' or 'sh config')"
206         @echo "and update the error lists (via 'make errors'), please."
207         @false
208
209 libclean:
210         rm -f *.a */lib */*/lib
211
212 clean:
213         rm -f shlib/*.o *.o core a.out fluff *.map
214         @for i in $(DIRS) ;\
215         do \
216         (cd $$i && echo "making clean in $$i..." && \
217         $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
218         rm -f $(LIBS); \
219         done;
220         rm -f *.a *.o speed.* *.map *.so .pure core
221         rm -f $(TARFILE)
222         @for i in $(ONEDIRS) ;\
223         do \
224         rm -fr $$i/*; \
225         done
226
227 makefile.one: files
228         $(PERL) util/mk1mf.pl >makefile.one; \
229         sh util/do_ms.sh
230
231 files:
232         $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
233         @for i in $(DIRS) ;\
234         do \
235         (cd $$i && echo "making 'files' in $$i..." && \
236         $(MAKE) SDIRS='${SDIRS}' files ) || exit 1; \
237         done;
238
239 links:
240         @$(TOP)/util/point.sh Makefile.ssl Makefile
241         @-mkdir -p include/openssl 2>/dev/null
242         @$(TOP)/util/mklink.sh include/openssl $(EXHEADER)
243         @for i in $(DIRS); do \
244         (cd $$i && echo "making links in $$i..." && \
245         $(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}' links ) || exit 1; \
246         done;
247         @(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
248
249 dclean:
250         rm -f *.bak
251         @for i in $(DIRS) ;\
252         do \
253         (cd $$i && echo "making dclean in $$i..." && \
254         $(MAKE) SDIRS='${SDIRS}' dclean ) || exit 1; \
255         done;
256
257 rehash:
258         @(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
259
260 test:   tests
261
262 tests: rehash
263         @(cd test && echo "testing..." && \
264         $(MAKE) CC='${CC}' CFLAG='${CFLAG}' 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}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' tests );
265         @apps/openssl version -a
266
267 depend:
268         @for i in $(DIRS) ;\
269         do \
270         (cd $$i && echo "making dependancies $$i..." && \
271         $(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' depend ) || exit 1; \
272         done;
273
274 lint:
275         @for i in $(DIRS) ;\
276         do \
277         (cd $$i && echo "making lint $$i..." && \
278         $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
279         done;
280
281 tags:
282         @for i in $(DIRS) ;\
283         do \
284         (cd $$i && echo "making tags $$i..." && \
285         $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
286         done;
287
288 errors:
289         perl util/mkerr.pl -recurse -write
290
291 tar:
292         @gtar --no-recursion -cvf - \
293                 `find * -depth -print | grep -v CVS | grep -v .cvsignore | grep -v STATUS | sort` |\
294         tardy --user_number=0  --user_name=openssl \
295               --group_number=0 --group_name=openssl \
296               --prefix=openssl-$(VERSION) - |\
297         gzip --best >../$(TARFILE).gz; \
298         ls -l ../$(TARFILE).gz
299
300 dist:   
301         $(PERL) Configure dist
302         @$(MAKE) dist_pem_h
303         @$(MAKE) SDIRS='${SDIRS}' clean
304         @$(MAKE) tar
305
306 dist_pem_h:
307         (cd crypto/pem; $(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
308
309 install: all
310         @-mkdir -p $(INSTALLTOP)/bin 2>/dev/null
311         @-mkdir -p $(INSTALLTOP)/lib 2>/dev/null
312         @-mkdir -p $(INSTALLTOP)/include/openssl 2>/dev/null
313         @-mkdir -p $(OPENSSLDIR)/certs 2>/dev/null
314         @-mkdir -p $(OPENSSLDIR)/private 2>/dev/null
315         @-mkdir -p $(OPENSSLDIR)/lib 2>/dev/null
316         @for i in $(DIRS) ;\
317         do \
318         (cd $$i; echo "installing $$i..."; \
319         $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
320         done
321         @for i in $(LIBS) ;\
322         do \
323         (       echo installing $$i; \
324                 cp $$i $(INSTALLTOP)/lib; \
325                 $(RANLIB) $(INSTALLTOP)/lib/$$i; \
326                 chmod 644 $(INSTALLTOP)/lib/$$i ); \
327         done
328
329 # DO NOT DELETE THIS LINE -- make depend depends on it.