2 ## Makefile for OpenSSL
10 # INSTALL_PREFIX is for package builders so that they can configure
11 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
12 # Normally it is left empty.
14 INSTALLTOP=/usr/local/ssl
16 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
17 OPENSSLDIR=/usr/local/ssl
19 # RSAref - Define if we are to link with RSAref.
20 # NO_IDEA - Define to build without the IDEA algorithm
21 # NO_RC4 - Define to build without the RC4 algorithm
22 # NO_RC2 - Define to build without the RC2 algorithm
23 # THREADS - Define when building with threads, you will probably also need any
24 # system defines as well, i.e. _REENTERANT for Solaris 2.[34]
25 # TERMIO - Define the termio terminal subsystem, needed if sgtty is missing.
26 # TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
27 # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
28 # DEVRANDOM - Give this the value of the 'random device' if your OS supports
29 # one. 32 bytes will be read from this when the random
30 # number generator is initalised.
31 # SSL_FORBID_ENULL - define if you want the server to be not able to use the
32 # NULL encryption ciphers.
34 # LOCK_DEBUG - turns on lots of lock debug output :-)
35 # REF_CHECK - turn on some xyz_free() assertions.
36 # REF_PRINT - prints some stuff on structure free.
37 # CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
38 # MFUNC - Make all Malloc/Free/Realloc calls call
39 # CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
40 # call application defined callbacks via CRYPTO_set_mem_functions()
41 # MD5_ASM needs to be defined to use the x86 assembler for MD5
42 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1
43 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
44 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8. It must
46 # PKCS1_CHECK - pkcs1 tests.
49 #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
50 CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
52 PEX_LIBS= -L. -L.. -L../.. -L../../..
60 # Set BN_ASM to bn_asm.o if you want to use the C version
63 #BN_ASM= asm/bn86-elf.o # elf, linux-elf
64 #BN_ASM= asm/bn86-sol.o # solaris
65 #BN_ASM= asm/bn86-out.o # a.out, FreeBSD
66 #BN_ASM= asm/bn86bsdi.o # bsdi
67 #BN_ASM= asm/alpha.o # DEC Alpha
68 #BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
69 #BN_ASM= asm/r3000.o # SGI MIPS cpu
70 #BN_ASM= asm/sparc.o # Sun solaris/SunOS
71 #BN_ASM= asm/bn-win32.o # Windows 95/NT
72 #BN_ASM= asm/x86w16.o # 16 bit code for Windows 3.1/DOS
73 #BN_ASM= asm/x86w32.o # 32 bit code for Windows 3.1
75 # For x86 assembler: Set PROCESSOR to 386 if you want to support
79 # Set DES_ENC to des_enc.o if you want to use the C version
80 #There are 4 x86 assember options.
81 DES_ENC= asm/dx86-out.o asm/yx86-out.o
82 #DES_ENC= des_enc.o fcrypt_b.o # C
83 #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
84 #DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
85 #DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
86 #DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
88 # Set BF_ENC to bf_enc.o if you want to use the C version
89 #There are 4 x86 assember options.
90 BF_ENC= asm/bx86-out.o
92 #BF_ENC= asm/bx86-elf.o # elf
93 #BF_ENC= asm/bx86-sol.o # solaris
94 #BF_ENC= asm/bx86-out.o # a.out, FreeBSD
95 #BF_ENC= asm/bx86bsdi.o # bsdi
97 # Set CAST_ENC to c_enc.o if you want to use the C version
98 #There are 4 x86 assember options.
99 CAST_ENC= asm/cx86-out.o
101 #CAST_ENC= asm/cx86-elf.o # elf
102 #CAST_ENC= asm/cx86-sol.o # solaris
103 #CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
104 #CAST_ENC= asm/cx86bsdi.o # bsdi
106 # Set RC4_ENC to rc4_enc.o if you want to use the C version
107 #There are 4 x86 assember options.
108 RC4_ENC= asm/rx86-out.o
110 #RC4_ENC= asm/rx86-elf.o # elf
111 #RC4_ENC= asm/rx86-sol.o # solaris
112 #RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
113 #RC4_ENC= asm/rx86bsdi.o # bsdi
115 # Set RC5_ENC to rc5_enc.o if you want to use the C version
116 #There are 4 x86 assember options.
117 RC5_ENC= asm/r586-out.o
119 #RC5_ENC= asm/r586-elf.o # elf
120 #RC5_ENC= asm/r586-sol.o # solaris
121 #RC5_ENC= asm/r586-out.o # a.out, FreeBSD
122 #RC5_ENC= asm/r586bsdi.o # bsdi
124 # Also need MD5_ASM defined
125 MD5_ASM_OBJ= asm/mx86-out.o
126 #MD5_ASM_OBJ= asm/mx86-elf.o # elf
127 #MD5_ASM_OBJ= asm/mx86-sol.o # solaris
128 #MD5_ASM_OBJ= asm/mx86-out.o # a.out, FreeBSD
129 #MD5_ASM_OBJ= asm/mx86bsdi.o # bsdi
131 # Also need SHA1_ASM defined
132 SHA1_ASM_OBJ= asm/sx86-out.o
133 #SHA1_ASM_OBJ= asm/sx86-elf.o # elf
134 #SHA1_ASM_OBJ= asm/sx86-sol.o # solaris
135 #SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD
136 #SHA1_ASM_OBJ= asm/sx86bsdi.o # bsdi
138 # Also need RMD160_ASM defined
139 RMD160_ASM_OBJ= asm/rm86-out.o
140 #RMD160_ASM_OBJ= asm/rm86-elf.o # elf
141 #RMD160_ASM_OBJ= asm/rm86-sol.o # solaris
142 #RMD160_ASM_OBJ= asm/rm86-out.o # a.out, FreeBSD
143 #RMD160_ASM_OBJ= asm/rm86bsdi.o # bsdi
145 DIRS= crypto ssl rsaref apps test tools
146 SHLIBDIRS= crypto ssl
148 # dirs in crypto to build
150 md2 md5 sha mdc2 hmac ripemd \
151 des rc2 rc4 rc5 idea bf cast \
153 buffer bio stack lhash rand err objects \
154 evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
156 MAKEFILE= Makefile.ssl
157 MAKE= make -f Makefile.ssl
159 MANDIR=$(OPENSSLDIR)/man
166 EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS
168 LIBS= libcrypto.a libssl.a
172 NAME= $(BASENAME)-$(VERSION)
174 WTARFILE= $(NAME)-win.tar
175 EXHEADER= e_os.h e_os2.h
181 (cd $$i && echo "making all in $$i..." && \
182 $(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; \
184 -@# cd crypto; $(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}' testapps
185 -@# cd perl; $(PERL) Makefile.PL; make
190 (cd $$i && echo "making all in $$i..." && \
191 $(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; \
195 for i in ${SHLIBDIRS}; do \
196 rm -f lib$$i.a lib$$i.so \
197 lib$$i.so.${MAJOR} lib$$i.so.${MAJOR}.${MINOR}; \
198 ${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; \
199 ( set -x; ${CC} -shared -o lib$$i.so.${MAJOR}.${MINOR} \
200 -Wl,-S,-soname=lib$$i.so.${MAJOR} \
201 -Wl,--whole-archive lib$$i.a \
202 -Wl,--no-whole-archive -lc ) || exit 1; \
203 rm -f lib$$i.a; make -C $$i clean || exit 1 ;\
206 for i in ${SHLIBDIRS}; do \
207 ln -s lib$$i.so.${MAJOR}.${MINOR} lib$$i.so.${MAJOR}; \
208 ln -s lib$$i.so.${MAJOR} lib$$i.so; \
211 Makefile.ssl: Makefile.org
212 @echo "Makefile.ssl is older than Makefile.org."
213 @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
217 rm -f *.a */lib */*/lib
220 rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
223 (cd $$i && echo "making clean in $$i..." && \
224 $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
227 rm -f *.a *.o speed.* *.map *.so .pure core
229 @for i in $(ONEDIRS) ;\
235 $(PERL) util/mk1mf.pl >makefile.one; \
239 $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
242 (cd $$i && echo "making 'files' in $$i..." && \
243 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
247 @$(TOP)/util/point.sh Makefile.ssl Makefile
248 @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
249 @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
250 @for i in $(DIRS); do \
251 (cd $$i && echo "making links in $$i..." && \
252 $(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; \
259 (cd $$i && echo "making dclean in $$i..." && \
260 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
265 @(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)
271 @(cd test && echo "testing..." && \
272 $(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 );
273 @apps/openssl version -a
276 @$(PERL) util/selftest.pl
281 (cd $$i && echo "making dependencies $$i..." && \
282 $(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' depend ) || exit 1; \
288 (cd $$i && echo "making lint $$i..." && \
289 $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
295 (cd $$i && echo "making tags $$i..." && \
296 $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
300 perl util/mkerr.pl -recurse -write
303 perl util/mkdef.pl crypto update
306 perl util/mkdef.pl ssl update
308 crypto/objects/obj_dat.h: crypto/objects/objects.h crypto/objects/obj_dat.pl
309 perl crypto/objects/obj_dat.pl crypto/objects/objects.h crypto/objects/obj_dat.h
312 (echo 'Output of `Configure TABLE'"':"; \
313 perl Configure TABLE) > TABLE
315 update: depend errors util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
318 @$(TAR) $(TARFLAGS) -cvf - \
319 `find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort` |\
320 tardy --user_number=0 --user_name=openssl \
321 --group_number=0 --group_name=openssl \
322 --prefix=openssl-$(VERSION) - |\
323 gzip --best >../$(TARFILE).gz; \
324 ls -l ../$(TARFILE).gz
327 $(PERL) Configure dist
329 @$(MAKE) SDIRS='${SDIRS}' clean
333 (cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
335 install: all install_docs
336 @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
337 $(INSTALL_PREFIX)$(INSTALLTOP)/lib \
338 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
339 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
340 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
341 $(INSTALL_PREFIX)$(OPENSSLDIR)/private \
342 $(INSTALL_PREFIX)$(OPENSSLDIR)/lib
343 @for i in $(EXHEADER) ;\
345 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
346 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
350 (cd $$i; echo "installing $$i..."; \
351 $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
355 ( echo installing $$i; \
356 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
357 $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
358 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
362 @$(PERL) $(TOP)/util/mkdir-p.pl \
363 $(INSTALL_PREFIX)$(MANDIR)/man1 \
364 $(INSTALL_PREFIX)$(MANDIR)/man3 \
365 $(INSTALL_PREFIX)$(MANDIR)/man5 \
366 $(INSTALL_PREFIX)$(MANDIR)/man7
367 @echo installing man 1 and man 5
368 @for i in doc/apps/*.pod; do \
369 fn=`basename $$i .pod`; \
370 sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
372 $(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
373 --release=$(VERSION) `basename $$i`) \
374 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
376 @echo installing man 3 and man 7
377 @for i in doc/crypto/*.pod doc/ssl/*.pod; do \
378 fn=`basename $$i .pod`; \
379 sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
381 $(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
382 --release=$(VERSION) `basename $$i`) \
383 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
387 if [ ! -d shlib_dir ] ; then mkdir shlib_dir ; else rm -f shlib_dir/* ; fi
388 cd shlib_dir ; ar -x ../libcrypto.a && $(CC) -shared ./*.o -Wl,-soname -Wl,libcrypto.so.0.9 \
389 -o ./libcrypto.so.0.9.4 && rm *.o
390 cd shlib_dir ; ar -x ../libssl.a && $(CC) -shared ./*.o -Wl,-soname -Wl,libssl.so.0.9 \
391 -o ./libssl.so.0.9.4 && rm *.o
393 # DO NOT DELETE THIS LINE -- make depend depends on it.