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