Makefile.org revision 100928
1196200Sscottl##
2196200Sscottl## Makefile for OpenSSL
3196200Sscottl##
4196200Sscottl
5196200SscottlVERSION=
6196200SscottlMAJOR=
7196200SscottlMINOR=
8196200SscottlSHLIB_VERSION_NUMBER=
9196200SscottlSHLIB_VERSION_HISTORY=
10196200SscottlSHLIB_MAJOR=
11196200SscottlSHLIB_MINOR=
12196200SscottlSHLIB_EXT=
13196200SscottlPLATFORM=dist
14196200SscottlOPTIONS=
15196200SscottlCONFIGURE_ARGS=
16196200SscottlSHLIB_TARGET=
17196200Sscottl
18196200Sscottl# INSTALL_PREFIX is for package builders so that they can configure
19196200Sscottl# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
20196200Sscottl# Normally it is left empty.
21196200SscottlINSTALL_PREFIX=
22196200SscottlINSTALLTOP=/usr/local/ssl
23196200Sscottl
24196200Sscottl# Do not edit this manually. Use Configure --openssldir=DIR do change this!
25196200SscottlOPENSSLDIR=/usr/local/ssl
26196200Sscottl
27196200Sscottl# RSAref  - Define if we are to link with RSAref.
28196200Sscottl# NO_IDEA - Define to build without the IDEA algorithm
29196200Sscottl# NO_RC4  - Define to build without the RC4 algorithm
30196200Sscottl# NO_RC2  - Define to build without the RC2 algorithm
31196200Sscottl# THREADS - Define when building with threads, you will probably also need any
32196200Sscottl#           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
33196200Sscottl# TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
34196200Sscottl# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
35196200Sscottl# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
36237259Seadler# DEVRANDOM - Give this the value of the 'random device' if your OS supports
37196200Sscottl#           one.  32 bytes will be read from this when the random
38196200Sscottl#           number generator is initalised.
39196200Sscottl# SSL_FORBID_ENULL - define if you want the server to be not able to use the
40196200Sscottl#           NULL encryption ciphers.
41196200Sscottl#
42196200Sscottl# LOCK_DEBUG - turns on lots of lock debug output :-)
43196200Sscottl# REF_CHECK - turn on some xyz_free() assertions.
44196200Sscottl# REF_PRINT - prints some stuff on structure free.
45196200Sscottl# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
46196200Sscottl# MFUNC - Make all Malloc/Free/Realloc calls call
47196200Sscottl#       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
48196200Sscottl#       call application defined callbacks via CRYPTO_set_mem_functions()
49223345Sbz# MD5_ASM needs to be defined to use the x86 assembler for MD5
50223345Sbz# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
51223345Sbz# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
52223345Sbz# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
53223345Sbz# equal 4.
54223345Sbz# PKCS1_CHECK - pkcs1 tests.
55196200Sscottl
56223345SbzCC= gcc
57223345Sbz#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
58223345SbzCFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
59223345SbzDEPFLAG= 
60223345SbzPEX_LIBS= 
61223345SbzEX_LIBS= 
62223345SbzEXE_EXT= 
63223345SbzAR=ar r
64223345SbzRANLIB= ranlib
65223345SbzPERL= perl
66223345SbzTAR= tar
67223345SbzTARFLAGS= --no-recursion
68223345Sbz
69223345Sbz# Set BN_ASM to bn_asm.o if you want to use the C version
70223345SbzBN_ASM= bn_asm.o
71223345Sbz#BN_ASM= bn_asm.o
72223345Sbz#BN_ASM= asm/bn86-elf.o	# elf, linux-elf
73223345Sbz#BN_ASM= asm/bn86-sol.o # solaris
74223345Sbz#BN_ASM= asm/bn86-out.o # a.out, FreeBSD
75237259Seadler#BN_ASM= asm/bn86bsdi.o # bsdi
76223345Sbz#BN_ASM= asm/alpha.o    # DEC Alpha
77223345Sbz#BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
78223345Sbz#BN_ASM= asm/r3000.o    # SGI MIPS cpu
79223345Sbz#BN_ASM= asm/sparc.o    # Sun solaris/SunOS
80223345Sbz#BN_ASM= asm/bn-win32.o # Windows 95/NT
81223345Sbz#BN_ASM= asm/x86w16.o   # 16 bit code for Windows 3.1/DOS
82223345Sbz#BN_ASM= asm/x86w32.o   # 32 bit code for Windows 3.1
83223345Sbz
84223345Sbz# For x86 assembler: Set PROCESSOR to 386 if you want to support
85223345Sbz# the 80386.
86223345SbzPROCESSOR=
87223345Sbz
88223345Sbz# Set DES_ENC to des_enc.o if you want to use the C version
89223345Sbz#There are 4 x86 assember options.
90223345SbzDES_ENC= asm/dx86-out.o asm/yx86-out.o
91223345Sbz#DES_ENC= des_enc.o fcrypt_b.o          # C
92223345Sbz#DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
93223345Sbz#DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
94223345Sbz#DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
95223345Sbz#DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
96223345Sbz
97223345Sbz# Set BF_ENC to bf_enc.o if you want to use the C version
98223345Sbz#There are 4 x86 assember options.
99223345SbzBF_ENC= asm/bx86-out.o
100223345Sbz#BF_ENC= bf_enc.o
101223345Sbz#BF_ENC= asm/bx86-elf.o # elf
102223345Sbz#BF_ENC= asm/bx86-sol.o # solaris
103223345Sbz#BF_ENC= asm/bx86-out.o # a.out, FreeBSD
104223345Sbz#BF_ENC= asm/bx86bsdi.o # bsdi
105223345Sbz
106223345Sbz# Set CAST_ENC to c_enc.o if you want to use the C version
107223345Sbz#There are 4 x86 assember options.
108223345SbzCAST_ENC= asm/cx86-out.o
109223345Sbz#CAST_ENC= c_enc.o
110223345Sbz#CAST_ENC= asm/cx86-elf.o # elf
111223345Sbz#CAST_ENC= asm/cx86-sol.o # solaris
112223345Sbz#CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
113223345Sbz#CAST_ENC= asm/cx86bsdi.o # bsdi
114223345Sbz
115223345Sbz# Set RC4_ENC to rc4_enc.o if you want to use the C version
116223345Sbz#There are 4 x86 assember options.
117223345SbzRC4_ENC= asm/rx86-out.o
118223345Sbz#RC4_ENC= rc4_enc.o
119223345Sbz#RC4_ENC= asm/rx86-elf.o # elf
120223345Sbz#RC4_ENC= asm/rx86-sol.o # solaris
121223345Sbz#RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
122223345Sbz#RC4_ENC= asm/rx86bsdi.o # bsdi
123223345Sbz
124223345Sbz# Set RC5_ENC to rc5_enc.o if you want to use the C version
125223345Sbz#There are 4 x86 assember options.
126223345SbzRC5_ENC= asm/r586-out.o
127223345Sbz#RC5_ENC= rc5_enc.o
128223345Sbz#RC5_ENC= asm/r586-elf.o # elf
129223345Sbz#RC5_ENC= asm/r586-sol.o # solaris
130223345Sbz#RC5_ENC= asm/r586-out.o # a.out, FreeBSD
131196200Sscottl#RC5_ENC= asm/r586bsdi.o # bsdi
132196200Sscottl
133196200Sscottl# Also need MD5_ASM defined
134196200SscottlMD5_ASM_OBJ= asm/mx86-out.o
135196200Sscottl#MD5_ASM_OBJ= asm/mx86-elf.o        # elf
136196200Sscottl#MD5_ASM_OBJ= asm/mx86-sol.o        # solaris
137196200Sscottl#MD5_ASM_OBJ= asm/mx86-out.o        # a.out, FreeBSD
138196200Sscottl#MD5_ASM_OBJ= asm/mx86bsdi.o        # bsdi
139196200Sscottl
140196200Sscottl# Also need SHA1_ASM defined
141196200SscottlSHA1_ASM_OBJ= asm/sx86-out.o
142196200Sscottl#SHA1_ASM_OBJ= asm/sx86-elf.o       # elf
143196200Sscottl#SHA1_ASM_OBJ= asm/sx86-sol.o       # solaris
144196200Sscottl#SHA1_ASM_OBJ= asm/sx86-out.o       # a.out, FreeBSD
145196200Sscottl#SHA1_ASM_OBJ= asm/sx86bsdi.o       # bsdi
146196200Sscottl
147196200Sscottl# Also need RMD160_ASM defined
148196200SscottlRMD160_ASM_OBJ= asm/rm86-out.o
149196200Sscottl#RMD160_ASM_OBJ= asm/rm86-elf.o       # elf
150214131Spluknet#RMD160_ASM_OBJ= asm/rm86-sol.o       # solaris
151214131Spluknet#RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
152214131Spluknet#RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi
153233713Sambrisko
154196200Sscottl# When we're prepared to use shared libraries in the programs we link here
155196200Sscottl# we might set SHLIB_MARK to '$(SHARED_LIBS)'.
156196200SscottlSHLIB_MARK=
157196200Sscottl
158196200SscottlDIRS=   crypto ssl rsaref $(SHLIB_MARK) apps test tools
159196200SscottlSHLIBDIRS= crypto ssl
160196200Sscottl
161196200Sscottl# dirs in crypto to build
162196200SscottlSDIRS=  \
163196200Sscottl	md2 md4 md5 sha mdc2 hmac ripemd \
164196200Sscottl	des rc2 rc4 rc5 idea bf cast \
165214396Sjhb	bn rsa dsa dh dso \
166196211Sscottl	buffer bio stack lhash rand err objects \
167196200Sscottl	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
168214396Sjhb
169196200SscottlMAKEFILE= Makefile.ssl
170196200SscottlMAKE=     make -f Makefile.ssl
171196200Sscottl
172196200SscottlMANDIR=$(OPENSSLDIR)/man
173196200SscottlMAN1=1
174196200SscottlMAN3=3
175196200SscottlSHELL=/bin/sh
176196200Sscottl
177196200SscottlTOP=    .
178196200SscottlONEDIRS=out tmp
179196200SscottlEDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
180196200SscottlWDIRS=  windows
181196200SscottlLIBS=   libcrypto.a libssl.a
182196200SscottlSHARED_CRYPTO=libcrypto$(SHLIB_EXT)
183196200SscottlSHARED_SSL=libssl$(SHLIB_EXT)
184196200SscottlSHARED_LIBS=
185196200SscottlSHARED_LIBS_LINK_EXTS=
186196200SscottlSHARED_LDFLAGS=
187196200Sscottl
188196200SscottlGENERAL=        Makefile
189196200SscottlBASENAME=       openssl
190196200SscottlNAME=           $(BASENAME)-$(VERSION)
191196200SscottlTARFILE=        $(NAME).tar
192196200SscottlWTARFILE=       $(NAME)-win.tar
193196200SscottlEXHEADER=       e_os.h e_os2.h
194196200SscottlHEADER=         e_os.h
195196200Sscottl
196196200Sscottl# When we're prepared to use shared libraries in the programs we link here
197196200Sscottl# we might remove 'clean-shared' from the targets to perform at this stage
198196200Sscottl
199196200Sscottlall: clean-shared Makefile.ssl sub_all
200196200Sscottl
201196200Sscottlsub_all:
202196200Sscottl	@for i in $(DIRS); \
203196200Sscottl	do \
204214396Sjhb	if [ -d "$$i" ]; then \
205196200Sscottl		(cd $$i && echo "making all in $$i..." && \
206214396Sjhb		$(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}' EXE_EXT='${EXE_EXT}' all ) || exit 1; \
207196200Sscottl	else \
208196200Sscottl		$(MAKE) $$i; \
209196211Sscottl	fi; \
210196211Sscottl	done; \
211196200Sscottl	if echo "$(DIRS)" | \
212196200Sscottl	    egrep '(^| )(crypto|ssl)( |$$)' > /dev/null 2>&1 && \
213196200Sscottl	   [ -n "$(SHARED_LIBS)" ]; then \
214196211Sscottl		$(MAKE) $(SHARED_LIBS); \
215196211Sscottl	fi
216196211Sscottl
217196211Sscottllibcrypto$(SHLIB_EXT): libcrypto.a
218196200Sscottl	@if [ "$(SHLIB_TARGET)" != "" ]; then \
219196200Sscottl		$(MAKE) SHLIBDIRS=crypto build-shared; \
220196200Sscottl	else \
221196200Sscottl		echo "There's no support for shared libraries on this platform" >&2; \
222196200Sscottl	fi
223196200Sscottllibssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
224196200Sscottl	@if [ "$(SHLIB_TARGET)" != "" ]; then \
225196200Sscottl		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
226196200Sscottl	else \
227196200Sscottl		echo "There's no support for shared libraries on this platform" >&2; \
228196200Sscottl	fi
229196200Sscottl
230196200Sscottlclean-shared:
231196200Sscottl	@for i in $(SHLIBDIRS); do \
232196200Sscottl		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
233196200Sscottl			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
234196200Sscottl			for j in $${tmp:-x}; do \
235196200Sscottl				( set -x; rm -f lib$$i$$j ); \
236196200Sscottl			done; \
237196200Sscottl		fi; \
238196200Sscottl		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
239196200Sscottl		if [ "$(PLATFORM)" = "Cygwin" ]; then \
240196200Sscottl			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
241196200Sscottl		fi; \
242196200Sscottl	done
243196200Sscottl
244196200Sscottllink-shared:
245196200Sscottl	@if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
246196200Sscottl		tmp="$(SHARED_LIBS_LINK_EXTS)"; \
247196200Sscottl		for i in $(SHLIBDIRS); do \
248196200Sscottl			prev=lib$$i$(SHLIB_EXT); \
249196200Sscottl			for j in $${tmp:-x}; do \
250196200Sscottl				( set -x; ln -f -s $$prev lib$$i$$j ); \
251196200Sscottl				prev=lib$$i$$j; \
252196200Sscottl			done; \
253196200Sscottl		done; \
254196200Sscottl	fi
255196200Sscottl
256196200Sscottlbuild-shared: clean-shared do_$(SHLIB_TARGET) link-shared
257196200Sscottl
258196200Sscottldo_bsd-gcc-shared: do_gnu-shared
259196200Sscottldo_linux-shared: do_gnu-shared
260196200Sscottldo_gnu-shared:
261196200Sscottl	libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
262196200Sscottl	( set -x; ${CC} ${SHARED_LDFLAGS} \
263196200Sscottl		-shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
264196200Sscottl		-Wl,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
265196200Sscottl		-Wl,-Bsymbolic \
266196200Sscottl		-Wl,--whole-archive lib$$i.a \
267196200Sscottl		-Wl,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
268196200Sscottl	libs="$$libs -l$$i"; \
269196200Sscottl	done
270196200Sscottl
271196200SscottlDETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
272196200Sscottl	collect2=`gcc -print-prog-name=collect2 2>&1` && \
273196200Sscottl	[ -n "$$collect2" ] && \
274196200Sscottl	my_ld=`$$collect2 --help 2>&1 | grep Usage: | sed 's/^Usage: *\([^ ][^ ]*\).*/\1/'` && \
275196200Sscottl	[ -n "$$my_ld" ] && \
276196200Sscottl	$$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
277196200Sscottl
278196200Sscottl# For Darwin AKA Mac OS/X (dyld)
279196200Sscottldo_darwin-shared: 
280196200Sscottl	libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
281196200Sscottl	( set -x ; ${CC} --verbose -dynamiclib -o lib$$i${SHLIB_EXT} \
282196200Sscottl		lib$$i.a $$libs -all_load -current_version ${SHLIB_MAJOR}.${SHLIB_MINOR} \
283196200Sscottl		-compatibility_version ${SHLIB_MAJOR}.`echo ${SHLIB_MINOR} | cut -d. -f1` \
284196200Sscottl		-install_name ${INSTALLTOP}/lib/lib$$i${SHLIB_EXT} ) || exit 1; \
285196200Sscottl	libs="$$libs -l`basename $$i${SHLIB_EXT} .dylib`"; \
286196200Sscottl	echo "" ; \
287196200Sscottl	done
288196200Sscottl
289196200Sscottldo_cygwin-shared:
290196200Sscottl	libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
291196200Sscottl	( set -x; ${CC}  -shared -o cyg$$i.dll \
292196200Sscottl		-Wl,-Bsymbolic \
293196200Sscottl		-Wl,--whole-archive lib$$i.a \
294196200Sscottl		-Wl,--out-implib,lib$$i.dll.a \
295196200Sscottl		-Wl,--no-whole-archive $$libs ) || exit 1; \
296196200Sscottl	libs="$$libs -l$$i"; \
297196200Sscottl	done
298196200Sscottl
299196200Sscottl# This assumes that GNU utilities are *not* used
300196200Sscottldo_alpha-osf1-shared:
301196200Sscottl	if ${DETECT_GNU_LD}; then \
302196200Sscottl		$(MAKE) do_gnu-shared; \
303196200Sscottl	else \
304196200Sscottl		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
305196200Sscottl		( set -x; ${CC} ${SHARED_LDFLAGS} \
306196200Sscottl			-shared -o lib$$i.so \
307196200Sscottl			-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
308196200Sscottl			-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
309196200Sscottl		libs="$$libs -l$$i"; \
310196200Sscottl		done; \
311196200Sscottl	fi
312196200Sscottl
313196200Sscottl# This assumes that GNU utilities are *not* used
314196200Sscottl# The difference between alpha-osf1-shared and tru64-shared is the `-msym'
315196200Sscottl# option passed to the linker.
316196200Sscottldo_tru64-shared:
317196200Sscottl	if ${DETECT_GNU_LD}; then \
318196200Sscottl		$(MAKE) do_gnu-shared; \
319196200Sscottl	else \
320196200Sscottl		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
321196200Sscottl		( set -x; ${CC} ${SHARED_LDFLAGS} \
322196200Sscottl			-shared -msym -o lib$$i.so \
323196200Sscottl			-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
324196200Sscottl			-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
325196200Sscottl		libs="$$libs -l$$i"; \
326196200Sscottl		done; \
327196200Sscottl	fi
328196200Sscottl
329196200Sscottl# This assumes that GNU utilities are *not* used
330196200Sscottl# The difference between tru64-shared and tru64-shared-rpath is the
331196200Sscottl# -rpath ${INSTALLTOP}/lib passed to the linker.
332196200Sscottldo_tru64-shared-rpath:
333237329Smjacob	if ${DETECT_GNU_LD}; then \
334196200Sscottl		$(MAKE) do_gnu-shared; \
335196200Sscottl	else \
336196200Sscottl		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
337237329Smjacob		( set -x; ${CC} ${SHARED_LDFLAGS} \
338237329Smjacob			-shared -msym -o lib$$i.so \
339237329Smjacob			-rpath  ${INSTALLTOP}/lib \
340196200Sscottl			-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
341196200Sscottl			-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
342196200Sscottl		libs="$$libs -l$$i"; \
343196200Sscottl		done; \
344196200Sscottl	fi
345196200Sscottl
346196200Sscottl
347196200Sscottl# This assumes that GNU utilities are *not* used
348196200Sscottldo_solaris-shared:
349196200Sscottl	if ${DETECT_GNU_LD}; then \
350196200Sscottl		$(MAKE) do_gnu-shared; \
351196200Sscottl	else \
352196200Sscottl		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
353196200Sscottl		( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
354196200Sscottl		  set -x; ${CC} ${SHARED_LDFLAGS} \
355196200Sscottl			-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
356196200Sscottl			-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
357196200Sscottl			-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
358196200Sscottl		libs="$$libs -l$$i"; \
359196200Sscottl		done; \
360196200Sscottl	fi
361196200Sscottl
362196200Sscottl# OpenServer 5 native compilers used
363196200Sscottldo_svr3-shared:
364196200Sscottl	if ${DETECT_GNU_LD}; then \
365196200Sscottl		$(MAKE) do_gnu-shared; \
366196200Sscottl	else \
367196200Sscottl		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
368196200Sscottl		( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
369196200Sscottl		  find . -name "*.o" -print > allobjs ; \
370196200Sscottl		  OBJS= ; export OBJS ; \
371196200Sscottl		  for obj in `ar t lib$$i.a` ; do \
372196200Sscottl		    OBJS="$${OBJS} `grep $$obj allobjs`" ; \
373196200Sscottl		  done ; \
374196200Sscottl		  set -x; ${CC}  -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
375196200Sscottl			-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
376196200Sscottl			$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
377196200Sscottl		libs="$$libs -l$$i"; \
378196200Sscottl		done; \
379196200Sscottl	fi
380196200Sscottl
381196200Sscottl# UnixWare 7 and OpenUNIX 8 native compilers used
382196200Sscottldo_svr5-shared:
383196200Sscottl	if ${DETECT_GNU_LD}; then \
384196200Sscottl		$(MAKE) do_gnu-shared; \
385196200Sscottl	else \
386196200Sscottl		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
387196200Sscottl		( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
388196200Sscottl		  find . -name "*.o" -print > allobjs ; \
389237259Seadler		  OBJS= ; export OBJS ; \
390196200Sscottl		  for obj in `ar t lib$$i.a` ; do \
391214396Sjhb		    OBJS="$${OBJS} `grep $$obj allobjs`" ; \
392196200Sscottl		  done ; \
393214396Sjhb		  set -x; ${CC} ${SHARED_LDFLAGS} \
394196200Sscottl			-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
395196200Sscottl			-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
396196200Sscottl			$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
397222899Sbz		libs="$$libs -l$$i"; \
398222899Sbz		done; \
399196200Sscottl	fi
400222899Sbz
401196200Sscottl# This assumes that GNU utilities are *not* used
402196200Sscottldo_irix-shared:
403196200Sscottl	if ${DETECT_GNU_LD}; then \
404214396Sjhb		$(MAKE) do_gnu-shared; \
405196200Sscottl	else \
406222899Sbz		libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
407214396Sjhb		( set -x; ${CC} ${SHARED_LDFLAGS} \
408196200Sscottl			-shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
409196200Sscottl			-Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
410196200Sscottl			-all lib$$i.a $$libs ${EX_LIBS} -lc) || exit 1; \
411196200Sscottl		libs="$$libs -l$$i"; \
412196200Sscottl		done; \
413222899Sbz	fi
414196200Sscottl
415196200Sscottl# This assumes that GNU utilities are *not* used
416196200Sscottldo_hpux-shared:
417196200Sscottl	libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
418196200Sscottl	( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
419196200Sscottl		+vnocompatwarnings \
420196200Sscottl		-b -z -o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
421196200Sscottl		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
422214396Sjhb		-Fl lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
423196200Sscottl	libs="$$libs -L. -l$$i"; \
424196200Sscottl	done
425222899Sbz
426214396Sjhb# This assumes that GNU utilities are *not* used
427196200Sscottldo_hpux64-shared:
428196200Sscottl	libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
429196200Sscottl	( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
430196200Sscottl		-b -z -o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
431196200Sscottl		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
432196200Sscottl		+forceload lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
433196200Sscottl	libs="$$libs -L. -l$$i"; \
434196200Sscottl	done
435196200Sscottl
436196200Sscottl# The following method is said to work on all platforms.  Tests will
437196200Sscottl# determine if that's how it's gong to be used.
438196200Sscottl# This assumes that for all but GNU systems, GNU utilities are *not* used.
439196200Sscottl# ALLSYMSFLAGS would be:
440196200Sscottl#  GNU systems: --whole-archive
441196200Sscottl#  Tru64 Unix:  -all
442196200Sscottl#  Solaris:     -z allextract
443196200Sscottl#  Irix:        -all
444196200Sscottl#  HP/UX-32bit: -Fl
445196200Sscottl#  HP/UX-64bit: +forceload
446196200Sscottl#  AIX:		-bnogc
447196200Sscottl# SHAREDFLAGS would be:
448196200Sscottl#  GNU systems: -shared -Wl,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
449196200Sscottl#  Tru64 Unix:  -shared \
450196200Sscottl#		-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}"
451196200Sscottl#  Solaris:     -G -h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
452196200Sscottl#  Irix:        -shared -Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
453196200Sscottl#  HP/UX-32bit: +vnocompatwarnings -b -z +s \
454196200Sscottl#		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}
455196200Sscottl#  HP/UX-64bit: -b -z +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}
456196200Sscottl#  AIX:		-G -bE:lib$$i.exp -bM:SRE
457196200Sscottl# SHAREDCMD would be:
458196200Sscottl#  GNU systems: $(CC)
459196200Sscottl#  Tru64 Unix:  $(CC)
460196200Sscottl#  Solaris:     $(CC)
461196200Sscottl#  Irix:        $(CC)
462196200Sscottl#  HP/UX-32bit: /usr/ccs/bin/ld
463196200Sscottl#  HP/UX-64bit: /usr/ccs/bin/ld
464196200Sscottl#  AIX:		$(CC)
465196200SscottlALLSYMSFLAG=-bnogc
466196200SscottlSHAREDFLAGS=${SHARED_LDFLAGS} -G -bE:lib$$i.exp -bM:SRE
467196200SscottlSHAREDCMD=$(CC)
468196200Sscottldo_aix-shared:
469196200Sscottl	libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
470196200Sscottl	( set -x; \
471196200Sscottl	  ld -r -o $$i.o $(ALLSYMSFLAG) lib$$i.a && \
472196200Sscottl	  ( nm -Pg lib$$i.o | grep ' [BD] ' | cut -f1 -d' ' > lib$$i.exp; \
473196200Sscottl	    $(SHAREDCMD) $(SHAREDFLAG) -o lib$$i.so lib$$i.o \
474196200Sscottl		$$libs ${EX_LIBS} ) ) \
475196200Sscottl	|| exit 1; \
476196200Sscottl	libs="$$libs -l$$i"; \
477254906Ssbruno	done
478254906Ssbruno
479254906SsbrunoMakefile.ssl: Makefile.org
480254906Ssbruno	@echo "Makefile.ssl is older than Makefile.org."
481254906Ssbruno	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
482254906Ssbruno	@false
483254906Ssbruno
484254906Ssbrunolibclean:
485254906Ssbruno	rm -f *.a */lib */*/lib
486254906Ssbruno
487254906Ssbrunoclean:
488254906Ssbruno	rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
489254906Ssbruno	@for i in $(DIRS) ;\
490254906Ssbruno	do \
491196200Sscottl	if [ -d "$$i" ]; then \
492196200Sscottl		(cd $$i && echo "making clean in $$i..." && \
493196200Sscottl		$(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
494196200Sscottl		rm -f $(LIBS); \
495196200Sscottl	fi; \
496196200Sscottl	done;
497196200Sscottl	rm -f *.a *.o speed.* *.map *.so .pure core
498196200Sscottl	rm -f $(TARFILE)
499196200Sscottl	@for i in $(ONEDIRS) ;\
500196200Sscottl	do \
501196200Sscottl	rm -fr $$i/*; \
502196200Sscottl	done
503196200Sscottl
504237259Seadlermakefile.one: files
505196200Sscottl	$(PERL) util/mk1mf.pl >makefile.one; \
506214396Sjhb	sh util/do_ms.sh
507196200Sscottl
508214396Sjhbfiles:
509196200Sscottl	$(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
510196200Sscottl	@for i in $(DIRS) ;\
511196200Sscottl	do \
512222899Sbz	if [ -d "$$i" ]; then \
513222899Sbz		(cd $$i && echo "making 'files' in $$i..." && \
514196200Sscottl		$(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
515222899Sbz	fi; \
516196200Sscottl	done;
517196200Sscottl
518196200Sscottllinks:
519214396Sjhb	@$(TOP)/util/point.sh Makefile.ssl Makefile
520196200Sscottl	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
521222899Sbz	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
522214396Sjhb	@for i in $(DIRS); do \
523196200Sscottl	if [ -d "$$i" ]; then \
524196200Sscottl		(cd $$i && echo "making links in $$i..." && \
525196200Sscottl		$(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; \
526196200Sscottl	fi; \
527214396Sjhb	done;
528222899Sbz
529196200Sscottldclean:
530196200Sscottl	rm -f *.bak
531196200Sscottl	@for i in $(DIRS) ;\
532196200Sscottl	do \
533196200Sscottl	if [ -d "$$i" ]; then \
534196200Sscottl		(cd $$i && echo "making dclean in $$i..." && \
535196200Sscottl		$(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
536214396Sjhb	fi; \
537196200Sscottl	done;
538222899Sbz
539214396Sjhbrehash: rehash.time
540196200Sscottlrehash.time: certs
541196200Sscottl	@(OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)
542196200Sscottl	touch rehash.time
543196200Sscottl
544196200Sscottltest:   tests
545196200Sscottl
546196200Sscottltests: rehash
547196200Sscottl	@(cd test && echo "testing..." && \
548196200Sscottl	$(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}' PERL='${PERL}' EXE_EXT='${EXE_EXT}' tests );
549196200Sscottl	@apps/openssl version -a
550196200Sscottl
551196200Sscottlreport:
552196200Sscottl	@$(PERL) util/selftest.pl
553196200Sscottl
554196200Sscottldepend:
555196200Sscottl	@for i in $(DIRS) ;\
556196200Sscottl	do \
557196200Sscottl	if [ -d "$$i" ]; then \
558196200Sscottl		(cd $$i && echo "making dependencies $$i..." && \
559196200Sscottl		$(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' depend ) || exit 1; \
560196200Sscottl	fi; \
561237259Seadler	done;
562196200Sscottl
563214396Sjhblint:
564196200Sscottl	@for i in $(DIRS) ;\
565214396Sjhb	do \
566196200Sscottl	if [ -d "$$i" ]; then \
567196200Sscottl		(cd $$i && echo "making lint $$i..." && \
568196200Sscottl		$(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
569222899Sbz	fi; \
570222899Sbz	done;
571196200Sscottl
572222899Sbztags:
573196200Sscottl	@for i in $(DIRS) ;\
574196200Sscottl	do \
575196200Sscottl	if [ -d "$$i" ]; then \
576214396Sjhb		(cd $$i && echo "making tags $$i..." && \
577196200Sscottl		$(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
578222899Sbz	fi; \
579214396Sjhb	done;
580196200Sscottl
581196200Sscottlerrors:
582196200Sscottl	$(PERL) util/mkerr.pl -recurse -write
583196200Sscottl
584196200Sscottlstacks:
585222899Sbz	$(PERL) util/mkstack.pl -write
586196200Sscottl
587196200Sscottlutil/libeay.num::
588196200Sscottl	$(PERL) util/mkdef.pl crypto update
589196200Sscottl
590196200Sscottlutil/ssleay.num::
591196200Sscottl	$(PERL) util/mkdef.pl ssl update
592196200Sscottl
593214396Sjhbcrypto/objects/obj_dat.h: crypto/objects/obj_mac.h crypto/objects/obj_dat.pl
594196200Sscottl	$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
595222899Sbzcrypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt 
596214396Sjhb	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
597196200Sscottl
598196200SscottlTABLE: Configure
599196200Sscottl	(echo 'Output of `Configure TABLE'"':"; \
600196200Sscottl	$(PERL) Configure TABLE) > TABLE
601196200Sscottl
602196200Sscottlupdate: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
603196200Sscottl
604196200Sscottltar:
605196200Sscottl	@$(TAR) $(TARFLAGS) -cvf - \
606196200Sscottl		`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort` |\
607196200Sscottl	tardy --user_number=0  --user_name=openssl \
608196200Sscottl	      --group_number=0 --group_name=openssl \
609196200Sscottl	      --prefix=openssl-$(VERSION) - |\
610196200Sscottl	gzip --best >../$(TARFILE).gz; \
611196200Sscottl	ls -l ../$(TARFILE).gz
612196200Sscottl
613196200Sscottldist:   
614196200Sscottl	$(PERL) Configure dist
615196200Sscottl	@$(MAKE) dist_pem_h
616196200Sscottl	@$(MAKE) SDIRS='${SDIRS}' clean
617237259Seadler	@$(MAKE) tar
618196200Sscottl
619214396Sjhbdist_pem_h:
620196200Sscottl	(cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
621214396Sjhb
622196200Sscottlinstall: all install_docs
623196200Sscottl	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
624196200Sscottl		$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
625222899Sbz		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
626222899Sbz		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
627196200Sscottl		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
628222899Sbz		$(INSTALL_PREFIX)$(OPENSSLDIR)/private \
629196200Sscottl		$(INSTALL_PREFIX)$(OPENSSLDIR)/lib
630196200Sscottl	@for i in $(EXHEADER) ;\
631196200Sscottl	do \
632214396Sjhb	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
633196200Sscottl	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
634222899Sbz	done;
635214396Sjhb	@for i in $(DIRS) ;\
636196200Sscottl	do \
637196200Sscottl	if [ -d "$$i" ]; then \
638196200Sscottl		(cd $$i; echo "installing $$i..."; \
639196200Sscottl		$(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}' install ); \
640196200Sscottl	fi; \
641196200Sscottl	done
642196200Sscottl	@for i in $(LIBS) ;\
643196200Sscottl	do \
644196200Sscottl		if [ -f "$$i" ]; then \
645196200Sscottl		(       echo installing $$i; \
646196200Sscottl			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
647196200Sscottl			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
648223345Sbz			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
649223345Sbz		fi; \
650223345Sbz	done
651196200Sscottl	@if [ -n "$(SHARED_LIBS)" ]; then \
652196200Sscottl		tmp="$(SHARED_LIBS)"; \
653196200Sscottl		for i in $${tmp:-x}; \
654196200Sscottl		do \
655196200Sscottl			if [ -f "$$i" -o -f "$$i.a" ]; then \
656196200Sscottl			(       echo installing $$i; \
657196200Sscottl				if [ "$(PLATFORM)" != "Cygwin" ]; then \
658196200Sscottl					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
659196200Sscottl					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
660196200Sscottl				else \
661196200Sscottl					c=`echo $$i | sed 's/^lib/cyg/'`; \
662196200Sscottl					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
663196200Sscottl					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
664196200Sscottl					cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
665196200Sscottl					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
666196200Sscottl				fi ); \
667196200Sscottl			fi; \
668196200Sscottl		done; \
669196200Sscottl		(	here="`pwd`"; \
670196200Sscottl			cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
671196200Sscottl			make -f $$here/Makefile link-shared ); \
672196200Sscottl	fi
673196200Sscottl
674196200Sscottlinstall_docs:
675196200Sscottl	@$(PERL) $(TOP)/util/mkdir-p.pl \
676196200Sscottl		$(INSTALL_PREFIX)$(MANDIR)/man1 \
677196200Sscottl		$(INSTALL_PREFIX)$(MANDIR)/man3 \
678196200Sscottl		$(INSTALL_PREFIX)$(MANDIR)/man5 \
679196200Sscottl		$(INSTALL_PREFIX)$(MANDIR)/man7
680196200Sscottl	@for i in doc/apps/*.pod; do \
681196200Sscottl		fn=`basename $$i .pod`; \
682196200Sscottl		if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
683237259Seadler		echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
684196200Sscottl		(cd `dirname $$i`; \
685214396Sjhb		$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
686196200Sscottl			 --release=$(VERSION) `basename $$i`) \
687214396Sjhb			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
688196200Sscottl	done
689196200Sscottl	@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
690196200Sscottl		fn=`basename $$i .pod`; \
691222899Sbz		if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
692222899Sbz		echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
693196200Sscottl		(cd `dirname $$i`; \
694222899Sbz		$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
695196200Sscottl			--release=$(VERSION) `basename $$i`) \
696196200Sscottl			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
697196200Sscottl	done
698214396Sjhb
699196200Sscottl# DO NOT DELETE THIS LINE -- make depend depends on it.
700222899Sbz