2 ## Makefile for OpenSSL
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.
22 INSTALLTOP=/usr/local/ssl
24 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
25 OPENSSLDIR=/usr/local/ssl
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.
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
53 # PKCS1_CHECK - pkcs1 tests.
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
59 PEX_LIBS= -L. -L.. -L../.. -L../../..
65 TARFLAGS= --no-recursion
67 # Set BN_ASM to bn_asm.o if you want to use the C version
70 #BN_ASM= asm/bn86-elf.o # elf, linux-elf
71 #BN_ASM= asm/bn86-sol.o # solaris
72 #BN_ASM= asm/bn86-out.o # a.out, FreeBSD
73 #BN_ASM= asm/bn86bsdi.o # bsdi
74 #BN_ASM= asm/alpha.o # DEC Alpha
75 #BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
76 #BN_ASM= asm/r3000.o # SGI MIPS cpu
77 #BN_ASM= asm/sparc.o # Sun solaris/SunOS
78 #BN_ASM= asm/bn-win32.o # Windows 95/NT
79 #BN_ASM= asm/x86w16.o # 16 bit code for Windows 3.1/DOS
80 #BN_ASM= asm/x86w32.o # 32 bit code for Windows 3.1
82 # For x86 assembler: Set PROCESSOR to 386 if you want to support
86 # Set DES_ENC to des_enc.o if you want to use the C version
87 #There are 4 x86 assember options.
88 DES_ENC= asm/dx86-out.o asm/yx86-out.o
89 #DES_ENC= des_enc.o fcrypt_b.o # C
90 #DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
91 #DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
92 #DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
93 #DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
95 # Set BF_ENC to bf_enc.o if you want to use the C version
96 #There are 4 x86 assember options.
97 BF_ENC= asm/bx86-out.o
99 #BF_ENC= asm/bx86-elf.o # elf
100 #BF_ENC= asm/bx86-sol.o # solaris
101 #BF_ENC= asm/bx86-out.o # a.out, FreeBSD
102 #BF_ENC= asm/bx86bsdi.o # bsdi
104 # Set CAST_ENC to c_enc.o if you want to use the C version
105 #There are 4 x86 assember options.
106 CAST_ENC= asm/cx86-out.o
108 #CAST_ENC= asm/cx86-elf.o # elf
109 #CAST_ENC= asm/cx86-sol.o # solaris
110 #CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
111 #CAST_ENC= asm/cx86bsdi.o # bsdi
113 # Set RC4_ENC to rc4_enc.o if you want to use the C version
114 #There are 4 x86 assember options.
115 RC4_ENC= asm/rx86-out.o
117 #RC4_ENC= asm/rx86-elf.o # elf
118 #RC4_ENC= asm/rx86-sol.o # solaris
119 #RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
120 #RC4_ENC= asm/rx86bsdi.o # bsdi
122 # Set RC5_ENC to rc5_enc.o if you want to use the C version
123 #There are 4 x86 assember options.
124 RC5_ENC= asm/r586-out.o
126 #RC5_ENC= asm/r586-elf.o # elf
127 #RC5_ENC= asm/r586-sol.o # solaris
128 #RC5_ENC= asm/r586-out.o # a.out, FreeBSD
129 #RC5_ENC= asm/r586bsdi.o # bsdi
131 # Also need MD5_ASM defined
132 MD5_ASM_OBJ= asm/mx86-out.o
133 #MD5_ASM_OBJ= asm/mx86-elf.o # elf
134 #MD5_ASM_OBJ= asm/mx86-sol.o # solaris
135 #MD5_ASM_OBJ= asm/mx86-out.o # a.out, FreeBSD
136 #MD5_ASM_OBJ= asm/mx86bsdi.o # bsdi
138 # Also need SHA1_ASM defined
139 SHA1_ASM_OBJ= asm/sx86-out.o
140 #SHA1_ASM_OBJ= asm/sx86-elf.o # elf
141 #SHA1_ASM_OBJ= asm/sx86-sol.o # solaris
142 #SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD
143 #SHA1_ASM_OBJ= asm/sx86bsdi.o # bsdi
145 # Also need RMD160_ASM defined
146 RMD160_ASM_OBJ= asm/rm86-out.o
147 #RMD160_ASM_OBJ= asm/rm86-elf.o # elf
148 #RMD160_ASM_OBJ= asm/rm86-sol.o # solaris
149 #RMD160_ASM_OBJ= asm/rm86-out.o # a.out, FreeBSD
150 #RMD160_ASM_OBJ= asm/rm86bsdi.o # bsdi
152 # When we're prepared to use shared libraries in the programs we link here
153 # we might set SHLIB_MARK to '$(SHARED_LIBS)'.
156 DIRS= crypto ssl $(SHLIB_MARK) apps test tools
157 SHLIBDIRS= crypto ssl
159 # dirs in crypto to build
161 md2 md4 md5 sha mdc2 hmac ripemd \
162 des rc2 rc4 rc5 idea bf cast \
163 bn rsa dsa dh dso engine rijndael \
164 buffer bio stack lhash rand err objects \
165 evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp
167 # tests to perform. "alltests" is a special word indicating that all tests
168 # should be performed.
171 MAKEFILE= Makefile.ssl
172 MAKE= make -f Makefile.ssl
174 MANDIR=$(OPENSSLDIR)/man
181 EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS
183 LIBS= libcrypto.a libssl.a
184 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
185 SHARED_SSL=libssl$(SHLIB_EXT)
187 SHARED_LIBS_LINK_EXTS=
191 NAME= $(BASENAME)-$(VERSION)
193 WTARFILE= $(NAME)-win.tar
194 EXHEADER= e_os.h e_os2.h
197 # When we're prepared to use shared libraries in the programs we link here
198 # we might remove 'clean-shared' from the targets to perform at this stage
200 all: clean-shared Makefile.ssl sub_all
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}' all ) || exit 1; \
212 if echo "$(DIRS)" | \
213 egrep '(^| )(crypto|ssl)( |$$)' > /dev/null 2>&1 && \
214 [ -n "$(SHARED_LIBS)" ]; then \
215 $(MAKE) $(SHARED_LIBS); \
218 libcrypto$(SHLIB_EXT): libcrypto.a
219 @if [ "$(SHLIB_TARGET)" != "" ]; then \
220 $(MAKE) SHLIBDIRS=crypto build-shared; \
222 echo "There's no support for shared libraries on this platform" >&2; \
224 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
225 @if [ "$(SHLIB_TARGET)" != "" ]; then \
226 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-L. -lcrypto' build-shared; \
228 echo "There's no support for shared libraries on this platform" >&2; \
232 @for i in $(SHLIBDIRS); do \
233 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
234 tmp="$(SHARED_LIBS_LINK_EXTS)"; \
235 for j in $${tmp:-x}; do \
236 ( set -x; rm -f lib$$i$$j ); \
239 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
243 @for i in $(SHLIBDIRS); do \
244 prev=lib$$i$(SHLIB_EXT); \
245 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
246 tmp="$(SHARED_LIBS_LINK_EXTS)"; \
247 for j in $${tmp:-x}; do \
248 ( set -x; ln -s -f $$prev lib$$i$$j ); \
254 build-shared: clean-shared do_$(SHLIB_TARGET) link-shared
256 do_bsd-gcc-shared: linux-shared
258 libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
259 ( set -x; ${CC} -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
260 -Wl,-S,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
261 -Wl,--whole-archive lib$$i.a \
262 -Wl,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
263 libs="$$libs -L. -l$$i"; \
266 # This assumes that GNU utilities are *not* used
268 libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
269 ( set -x; ${CC} -shared -no_archive -o lib$$i.so \
270 -set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
271 -all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
272 libs="$$libs -L. -l$$i"; \
275 # This assumes that GNU utilities are *not* used
277 libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
278 ( set -x; ${CC} -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
279 -h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
280 -z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
281 libs="$$libs -L. -l$$i"; \
284 # This assumes that GNU utilities are *not* used
286 libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
287 ( set -x; ${CC} -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
288 -Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
289 -all lib$$i.a $$libs ${EX_LIBS} -lc) || exit 1; \
290 libs="$$libs -L. -l$$i"; \
293 # This assumes that GNU utilities are *not* used
295 libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
296 ( set -x; /usr/ccs/bin/ld +vnocompatwarnings \
297 -b -z -o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
298 +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
299 -Fl lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
300 libs="$$libs -L. -l$$i"; \
303 # This assumes that GNU utilities are *not* used
305 libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
306 ( set -x; /usr/ccs/bin/ld -b -z -o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
307 +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
308 +forceload lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
309 libs="$$libs -L. -l$$i"; \
312 Makefile.ssl: Makefile.org
313 @echo "Makefile.ssl is older than Makefile.org."
314 @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
318 rm -f *.a */lib */*/lib
321 rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
324 if [ -d "$$i" ]; then \
325 (cd $$i && echo "making clean in $$i..." && \
326 $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
330 rm -f *.a *.o speed.* *.map *.so .pure core
332 @for i in $(ONEDIRS) ;\
338 $(PERL) util/mk1mf.pl >makefile.one; \
342 $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
345 if [ -d "$$i" ]; then \
346 (cd $$i && echo "making 'files' in $$i..." && \
347 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
352 @$(TOP)/util/point.sh Makefile.ssl Makefile
353 @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
354 @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
355 @for i in $(DIRS); do \
356 if [ -d "$$i" ]; then \
357 (cd $$i && echo "making links in $$i..." && \
358 $(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; \
366 if [ -d "$$i" ]; then \
367 (cd $$i && echo "making dclean in $$i..." && \
368 $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
374 @(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)
380 @(cd test && echo "testing..." && \
381 $(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='${TESTS}' tests );
382 @apps/openssl version -a
385 @$(PERL) util/selftest.pl
390 if [ -d "$$i" ]; then \
391 (cd $$i && echo "making dependencies $$i..." && \
392 $(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' depend ) || exit 1; \
399 if [ -d "$$i" ]; then \
400 (cd $$i && echo "making lint $$i..." && \
401 $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
408 if [ -d "$$i" ]; then \
409 (cd $$i && echo "making tags $$i..." && \
410 $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
415 perl util/mkerr.pl -recurse -write
418 perl util/mkstack.pl -write
421 perl util/mkdef.pl crypto update
424 perl util/mkdef.pl ssl update
426 crypto/objects/obj_dat.h: crypto/objects/obj_mac.h crypto/objects/obj_dat.pl
427 perl crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
428 crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt
429 perl crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
432 (echo 'Output of `Configure TABLE'"':"; \
433 perl Configure TABLE) > TABLE
435 update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
438 @$(TAR) $(TARFLAGS) -cvf - \
439 `find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort` |\
440 tardy --user_number=0 --user_name=openssl \
441 --group_number=0 --group_name=openssl \
442 --prefix=openssl-$(VERSION) - |\
443 gzip --best >../$(TARFILE).gz; \
444 ls -l ../$(TARFILE).gz
447 $(PERL) Configure dist
449 @$(MAKE) SDIRS='${SDIRS}' clean
453 (cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
455 install: all install_docs
456 @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
457 $(INSTALL_PREFIX)$(INSTALLTOP)/lib \
458 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
459 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
460 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
461 $(INSTALL_PREFIX)$(OPENSSLDIR)/private \
462 $(INSTALL_PREFIX)$(OPENSSLDIR)/lib
463 @for i in $(EXHEADER) ;\
465 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
466 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
470 if [ -d "$$i" ]; then \
471 (cd $$i; echo "installing $$i..."; \
472 $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
477 if [ -f "$$i" ]; then \
478 ( echo installing $$i; \
479 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
480 $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
481 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
484 @if [ -n "$(SHARED_LIBS)" ]; then \
485 tmp="$(SHARED_LIBS)"; \
486 for i in $${tmp:-x}; \
488 if [ -f "$$i" ]; then \
489 ( echo installing $$i; \
490 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
491 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
495 cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
496 make -f $$here/Makefile link-shared ); \
500 @$(PERL) $(TOP)/util/mkdir-p.pl \
501 $(INSTALL_PREFIX)$(MANDIR)/man1 \
502 $(INSTALL_PREFIX)$(MANDIR)/man3 \
503 $(INSTALL_PREFIX)$(MANDIR)/man5 \
504 $(INSTALL_PREFIX)$(MANDIR)/man7
505 @for i in doc/apps/*.pod; do \
506 fn=`basename $$i .pod`; \
507 sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
508 echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
510 $(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
511 --release=$(VERSION) `basename $$i`) \
512 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
514 @for i in doc/crypto/*.pod doc/ssl/*.pod; do \
515 fn=`basename $$i .pod`; \
516 sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
517 echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
519 $(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
520 --release=$(VERSION) `basename $$i`) \
521 > $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
524 # DO NOT DELETE THIS LINE -- make depend depends on it.