Makefile.org 20.8 KB
Newer Older
1 2 3 4
##
## Makefile for OpenSSL
##

U
Ulf Möller 已提交
5 6 7
VERSION=
MAJOR=
MINOR=
8 9 10 11
SHLIB_VERSION_NUMBER=
SHLIB_VERSION_HISTORY=
SHLIB_MAJOR=
SHLIB_MINOR=
12
SHLIB_EXT=
13
PLATFORM=dist
14
OPTIONS=
15
CONFIGURE_ARGS=
16 17
SHLIB_TARGET=

18 19 20 21 22
# HERE indicates where this Makefile lives.  This can be used to indicate
# where sub-Makefiles are expected to be.  Currently has very limited usage,
# and should probably not be bothered with at all.
HERE=.

23 24 25 26
# INSTALL_PREFIX is for package builders so that they can configure
# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
# Normally it is left empty.
INSTALL_PREFIX=
27 28 29 30
INSTALLTOP=/usr/local/ssl

# Do not edit this manually. Use Configure --openssldir=DIR do change this!
OPENSSLDIR=/usr/local/ssl
31

32 33 34 35
# NO_IDEA - Define to build without the IDEA algorithm
# NO_RC4  - Define to build without the RC4 algorithm
# NO_RC2  - Define to build without the RC2 algorithm
# THREADS - Define when building with threads, you will probably also need any
36
#           system defines as well, i.e. _REENTERANT for Solaris 2.[34]
37 38 39 40
# TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
# DEVRANDOM - Give this the value of the 'random device' if your OS supports
41 42
#           one.  32 bytes will be read from this when the random
#           number generator is initalised.
43
# SSL_FORBID_ENULL - define if you want the server to be not able to use the
44
#           NULL encryption ciphers.
45 46 47
#
# LOCK_DEBUG - turns on lots of lock debug output :-)
# REF_CHECK - turn on some xyz_free() assertions.
48
# REF_PRINT - prints some stuff on structure free.
49 50
# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
# MFUNC - Make all Malloc/Free/Realloc calls call
51 52 53 54 55
#       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
#       call application defined callbacks via CRYPTO_set_mem_functions()
# MD5_ASM needs to be defined to use the x86 assembler for MD5
# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
56 57 58
# Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
# equal 4.
# PKCS1_CHECK - pkcs1 tests.
59

B
Ben Laurie 已提交
60
CC= gcc
61
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
B
Ben Laurie 已提交
62
CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
63
DEPFLAG= 
64
PEX_LIBS= 
65
EX_LIBS= 
66
EXE_EXT= 
67 68
ARFLAGS=
AR=ar $(ARFLAGS) r
69 70
RANLIB= ranlib
PERL= perl
71
TAR= tar
R
Richard Levitte 已提交
72
TARFLAGS= --no-recursion
73
MAKEDEPPROG=makedepend
74

75 76 77 78 79 80
# We let the C compiler driver to take care of .s files. This is done in
# order to be excused from maintaining a separate set of architecture
# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
# gcc, then the driver will automatically translate it to -xarch=v8plus
# and pass it down to assembler.
AS=$(CC) -c
81
ASFLAG=$(CFLAG)
82

83 84 85 86 87 88 89
# For x86 assembler: Set PROCESSOR to 386 if you want to support
# the 80386.
PROCESSOR=

# CPUID module collects small commonly used assembler snippets
CPUID_OBJ= 

90 91 92 93 94 95 96 97 98 99 100 101 102 103
# Set BN_ASM to bn_asm.o if you want to use the C version
BN_ASM= bn_asm.o
#BN_ASM= bn_asm.o
#BN_ASM= asm/bn86-elf.o	# elf, linux-elf
#BN_ASM= asm/bn86-sol.o # solaris
#BN_ASM= asm/bn86-out.o # a.out, FreeBSD
#BN_ASM= asm/bn86bsdi.o # bsdi
#BN_ASM= asm/alpha.o    # DEC Alpha
#BN_ASM= asm/pa-risc2.o # HP-UX PA-RISC
#BN_ASM= asm/r3000.o    # SGI MIPS cpu
#BN_ASM= asm/sparc.o    # Sun solaris/SunOS
#BN_ASM= asm/bn-win32.o # Windows 95/NT
#BN_ASM= asm/x86w16.o   # 16 bit code for Windows 3.1/DOS
#BN_ASM= asm/x86w32.o   # 32 bit code for Windows 3.1
104 105 106

# Set DES_ENC to des_enc.o if you want to use the C version
#There are 4 x86 assember options.
B
Ben Laurie 已提交
107
DES_ENC= asm/dx86-out.o asm/yx86-out.o
108 109 110 111 112
#DES_ENC= des_enc.o fcrypt_b.o          # C
#DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
#DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
#DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
#DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
113

114 115
AES_ASM_OBJ=

116 117
# Set BF_ENC to bf_enc.o if you want to use the C version
#There are 4 x86 assember options.
B
Ben Laurie 已提交
118
BF_ENC= asm/bx86-out.o
119
#BF_ENC= bf_enc.o
120
#BF_ENC= asm/bx86-elf.o # elf
121 122 123
#BF_ENC= asm/bx86-sol.o # solaris
#BF_ENC= asm/bx86-out.o # a.out, FreeBSD
#BF_ENC= asm/bx86bsdi.o # bsdi
124

125 126
# Set CAST_ENC to c_enc.o if you want to use the C version
#There are 4 x86 assember options.
B
Ben Laurie 已提交
127
CAST_ENC= asm/cx86-out.o
128 129 130 131 132 133 134 135
#CAST_ENC= c_enc.o
#CAST_ENC= asm/cx86-elf.o # elf
#CAST_ENC= asm/cx86-sol.o # solaris
#CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
#CAST_ENC= asm/cx86bsdi.o # bsdi

# Set RC4_ENC to rc4_enc.o if you want to use the C version
#There are 4 x86 assember options.
B
Ben Laurie 已提交
136
RC4_ENC= asm/rx86-out.o
137 138 139 140 141 142 143 144
#RC4_ENC= rc4_enc.o
#RC4_ENC= asm/rx86-elf.o # elf
#RC4_ENC= asm/rx86-sol.o # solaris
#RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
#RC4_ENC= asm/rx86bsdi.o # bsdi

# Set RC5_ENC to rc5_enc.o if you want to use the C version
#There are 4 x86 assember options.
B
Ben Laurie 已提交
145
RC5_ENC= asm/r586-out.o
146 147 148 149 150 151 152
#RC5_ENC= rc5_enc.o
#RC5_ENC= asm/r586-elf.o # elf
#RC5_ENC= asm/r586-sol.o # solaris
#RC5_ENC= asm/r586-out.o # a.out, FreeBSD
#RC5_ENC= asm/r586bsdi.o # bsdi

# Also need MD5_ASM defined
B
Ben Laurie 已提交
153
MD5_ASM_OBJ= asm/mx86-out.o
154 155 156 157 158 159
#MD5_ASM_OBJ= asm/mx86-elf.o        # elf
#MD5_ASM_OBJ= asm/mx86-sol.o        # solaris
#MD5_ASM_OBJ= asm/mx86-out.o        # a.out, FreeBSD
#MD5_ASM_OBJ= asm/mx86bsdi.o        # bsdi

# Also need SHA1_ASM defined
B
Ben Laurie 已提交
160
SHA1_ASM_OBJ= asm/sx86-out.o
161 162 163 164 165 166
#SHA1_ASM_OBJ= asm/sx86-elf.o       # elf
#SHA1_ASM_OBJ= asm/sx86-sol.o       # solaris
#SHA1_ASM_OBJ= asm/sx86-out.o       # a.out, FreeBSD
#SHA1_ASM_OBJ= asm/sx86bsdi.o       # bsdi

# Also need RMD160_ASM defined
B
Ben Laurie 已提交
167
RMD160_ASM_OBJ= asm/rm86-out.o
168 169 170 171 172
#RMD160_ASM_OBJ= asm/rm86-elf.o       # elf
#RMD160_ASM_OBJ= asm/rm86-sol.o       # solaris
#RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
#RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi

173 174
# KRB5 stuff
KRB5_INCLUDES=
175
LIBKRB5=
176

177
DIRS=   crypto ssl engines apps test tools
U
Ulf Möller 已提交
178 179
SHLIBDIRS= crypto ssl

180 181
# dirs in crypto to build
SDIRS=  \
182
	objects \
183
	md2 md4 md5 sha mdc2 hmac ripemd \
184
	des rc2 rc4 rc5 idea bf cast \
B
Bodo Möller 已提交
185
	bn ec rsa dsa ecdsa dh ecdh dso engine aes \
186
	buffer bio stack lhash rand err \
187 188
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
	store
189

190 191 192 193
# tests to perform.  "alltests" is a special word indicating that all tests
# should be performed.
TESTS = alltests

194
MAKEFILE= Makefile.ssl
195 196
NEWMAKE=  make
MAKE=     $(NEWMAKE) -f Makefile.ssl
197

198
MANDIR=$(OPENSSLDIR)/man
199 200
MAN1=1
MAN3=3
201
MANSUFFIX=
202 203
SHELL=/bin/sh

204
TOP=    .
205
ONEDIRS=out tmp
U
Ulf Möller 已提交
206
EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
207
WDIRS=  windows
208
LIBS=   libcrypto.a libssl.a
209 210 211 212
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
SHARED_SSL=libssl$(SHLIB_EXT)
SHARED_LIBS=
SHARED_LIBS_LINK_EXTS=
213
SHARED_LDFLAGS=
214 215

GENERAL=        Makefile
R
Ralf S. Engelschall 已提交
216
BASENAME=       openssl
217 218 219
NAME=           $(BASENAME)-$(VERSION)
TARFILE=        $(NAME).tar
WTARFILE=       $(NAME)-win.tar
220
EXHEADER=       e_os2.h
221
HEADER=         e_os.h
222

223
all: Makefile.ssl build_all openssl.pc
224

225 226 227
BUILDENV=	PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
		SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}'	\
		CC='${CC}' CFLAG='${CFLAG}' 			\
228
		AS='${CC}' ASFLAG='${CFLAG} -c'			\
229 230 231 232 233 234
		AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'	\
		LDFLAGS="$(LDFLAGS)" SHARED_LDFLAGS="$(SHARED_LDFLAGS)"	\
		KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'	\
		EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'	\
		SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}'	\
		PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}'	\
235
		CPUID_OBJ='${CPUID_OBJ}'			\
236 237 238 239 240 241 242 243
		BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' 	\
		AES_ASM_OBJ='${AES_ASM_OBJ}'			\
		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}'

244 245 246
BUILD_CMD=if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
	if [ -d "$$dir" ]; then \
		(cd $$dir && echo "making $$target in $$dir..." && \
247
		$(MAKE) $(BUILDENV) $$target ) || exit 1; \
248
	else \
249
		$(MAKE) $$dir; \
250 251
	fi; fi

252
sub_all: build_all
253 254
build_all: build_libs build_apps build_tests build_tools

255
build_libs: build_crypto build_ssl build_engines
256 257

build_crypto:
258
	@dir=crypto; target=all; $(BUILD_CMD)
259
build_ssl:
260
	@dir=ssl; target=all; $(BUILD_CMD)
261
build_engines:
262
	@dir=engines; target=all; $(BUILD_CMD)
263
build_apps:
264
	@dir=apps; target=all; $(BUILD_CMD)
265
build_tests:
266
	@dir=test; target=all; $(BUILD_CMD)
267
build_tools:
268 269 270 271 272
	@dir=tools; target=all; $(BUILD_CMD)

all_testapps: build_libs build_testapps
build_testapps:
	@dir=crypto; target=testapps; $(BUILD_CMD)
273

274
libcrypto$(SHLIB_EXT): libcrypto.a
275
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
276
		$(MAKE) SHLIBDIRS=crypto build-shared; \
277 278
	else \
		echo "There's no support for shared libraries on this platform" >&2; \
279
		exit 1; \
280
	fi
281

282
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
283
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
284
		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
285 286
	else \
		echo "There's no support for shared libraries on this platform" >&2; \
287
		exit 1; \
288
	fi
289 290

clean-shared:
291
	@set -e; for i in $(SHLIBDIRS); do \
292 293 294 295 296 297 298
		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
			for j in $${tmp:-x}; do \
				( set -x; rm -f lib$$i$$j ); \
			done; \
		fi; \
		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
299
		if [ "$(PLATFORM)" = "Cygwin" ]; then \
300 301
			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
		fi; \
302
	done
303

304
link-shared:
305
	@ set -e; for i in ${SHLIBDIRS}; do \
306
		$(NEWMAKE) -f $(HERE)/Makefile.shared \
307 308 309
			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
			symlink.$(SHLIB_TARGET); \
310
		libs="$$libs -l$$i"; \
311 312
	done

313 314 315
build-shared: do_$(SHLIB_TARGET) link-shared

do_$(SHLIB_TARGET):
316
	@ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
317 318 319
		if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
			libs="$(LIBKRB5) $$libs"; \
		fi; \
320
		$(NEWMAKE) -f Makefile.shared \
321
			$(BUILDENV) \
322 323 324
			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
			LIBDEPS="$$libs $(EX_LIBS)" \
325
			LIBRPATH="$(INSTALLTOP)/lib" \
326
			link_a.$(SHLIB_TARGET); \
327
		libs="-l$$i $$libs"; \
328 329
	done

330
openssl.pc: Makefile.ssl
331 332 333 334 335 336 337 338 339 340
	@ ( echo 'prefix=$(INSTALLTOP)'; \
	    echo 'exec_prefix=$${prefix}'; \
	    echo 'libdir=$${exec_prefix}/lib'; \
	    echo 'includedir=$${prefix}/include'; \
	    echo ''; \
	    echo 'Name: OpenSSL'; \
	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
	    echo 'Version: '$(VERSION); \
	    echo 'Requires: '; \
	    echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
341
	    echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
342

343
Makefile.ssl: Makefile.org
344
	@echo "Makefile.ssl is older than Makefile.org."
345
	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
346 347
	@false

348
libclean:
349
	rm -f *.map *.so *.so.* engines/*.so *.a */lib */*/lib
350

351 352
clean:	libclean
	rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
353
	@set -e; for i in $(DIRS) ;\
354
	do \
355
	if [ -d "$$i" ]; then \
356 357 358 359
		(cd $$i && echo "making clean in $$i..." && \
		$(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
		rm -f $(LIBS); \
	fi; \
360
	done;
361
	rm -f openssl.pc
362
	rm -f speed.* .pure
363
	rm -f $(TARFILE)
364
	@set -e; for i in $(ONEDIRS) ;\
365
	do \
366
	rm -fr $$i/*; \
367 368 369
	done

makefile.one: files
370
	$(PERL) util/mk1mf.pl >makefile.one; \
371 372
	sh util/do_ms.sh

U
Ulf Möller 已提交
373
files:
374
	$(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
375
	@set -e; for i in $(DIRS) ;\
376
	do \
377
	if [ -d "$$i" ]; then \
378 379 380
		(cd $$i && echo "making 'files' in $$i..." && \
		$(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
	fi; \
381 382 383
	done;

links:
384
	@$(TOP)/util/point.sh Makefile.ssl Makefile
385
	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
386
	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
387
	@set -e; target=links; for dir in $(DIRS); do $(BUILD_CMD); done
388

389 390
gentests:
	@(cd test && echo "generating dummy tests (if needed)..." && \
391
	$(MAKE) $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
392

393
dclean:
394
	rm -f *.bak
395
	@set -e; for i in $(DIRS) ;\
396
	do \
397
	if [ -d "$$i" ]; then \
398 399 400
		(cd $$i && echo "making dclean in $$i..." && \
		$(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
	fi; \
401 402
	done;

403 404
rehash: rehash.time
rehash.time: certs
405
	@(OPENSSL="`pwd`/apps/openssl$(EXE_EXT)"; OPENSSL_DEBUG_MEMORY=on; \
406 407 408 409 410 411 412 413 414
	  export OPENSSL OPENSSL_DEBUG_MEMORY; \
	  if [ -n "$(SHARED_LIBS)" ]; then \
	    LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
	    DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
	    SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \
	    LIBPATH="`pwd`:$$LIBPATH"; \
	    if [ "$(PLATFORM)" = "Cygwin" ]; then \
	      PATH="`pwd`:$$PATH"; \
	    fi; \
415
	    LD_PRELOAD="`pwd`/libssl.so `pwd`/libcrypto.so"; \
416 417 418 419
	    export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
	    export LD_PRELOAD; \
	  fi; \
	  $(PERL) tools/c_rehash certs)
B
Bodo Möller 已提交
420
	touch rehash.time
421

422
test:   tests
423

424
tests: rehash
425
	@(cd test && echo "testing..." && \
426
	$(MAKE) $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
427 428 429 430 431 432
	@if [ -n "$(SHARED_LIBS)" ]; then \
	  LD_LIBRARY_PATH="`pwd`:$$LD_LIBRARY_PATH"; \
	  DYLD_LIBRARY_PATH="`pwd`:$$DYLD_LIBRARY_PATH"; \
	  SHLIB_PATH="`pwd`:$$SHLIB_PATH"; \
	  LIBPATH="`pwd`:$$LIBPATH"; \
	  if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
433
	  LD_PRELOAD="`pwd`/libssl.so `pwd`/libcrypto.so"; \
434
	  export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
435 436
	  export LD_PRELOAD; \
	fi; \
437
	apps/openssl version -a
438

439 440 441
report:
	@$(PERL) util/selftest.pl

442
depend:
443
	@set -e; for i in $(DIRS) ;\
444
	do \
445
	if [ -d "$$i" ]; then \
446
		(cd $$i && echo "making dependencies $$i..." && \
447
		$(MAKE) SDIRS='${SDIRS}' CFLAG='-DOPENSSL_NO_DEPRECATED ${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
448
	fi; \
449 450 451
	done;

lint:
452
	@set -e; for i in $(DIRS) ;\
453
	do \
454
	if [ -d "$$i" ]; then \
455 456 457
		(cd $$i && echo "making lint $$i..." && \
		$(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
	fi; \
458 459 460
	done;

tags:
461
	@set -e; for i in $(DIRS) ;\
462
	do \
463
	if [ -d "$$i" ]; then \
464 465 466
		(cd $$i && echo "making tags $$i..." && \
		$(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
	fi; \
467 468 469
	done;

errors:
470
	$(PERL) util/mkerr.pl -recurse -write
471
	(cd engines; $(MAKE) PERL=$(PERL) errors)
472

473
stacks:
474
	$(PERL) util/mkstack.pl -write
475

476
util/libeay.num::
477
	$(PERL) util/mkdef.pl crypto update
478 479

util/ssleay.num::
480
	$(PERL) util/mkdef.pl ssl update
481

482
crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
483
	$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
B
typo  
Bodo Möller 已提交
484
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
485
	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
486

487 488 489
apps/openssl-vms.cnf: apps/openssl.cnf
	$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf

490
TABLE: Configure
B
Bodo Möller 已提交
491
	(echo 'Output of `Configure TABLE'"':"; \
492
	$(PERL) Configure TABLE) > TABLE
493

494
update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf TABLE
495

496 497 498 499 500
# Build distribution tar-file. As the list of files returned by "find" is
# pretty long, on several platforms a "too many arguments" error or similar
# would occur. Therefore the list of files is temporarily stored into a file
# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
# tar does not support the --files-from option.
501
tar:
502 503 504
	find . -type d -print | xargs chmod 755
	find . -type f -print | xargs chmod a+r
	find . -type f -perm -0100 -print | xargs chmod a+x
505 506
	find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
	$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
507
	tardy --user_number=0  --user_name=openssl \
R
Ralf S. Engelschall 已提交
508 509
	      --group_number=0 --group_name=openssl \
	      --prefix=openssl-$(VERSION) - |\
510
	gzip --best >../$(TARFILE).gz; \
511
	rm -f ../$(TARFILE).list; \
512
	ls -l ../$(TARFILE).gz
513

514 515
tar-snap:
	@$(TAR) $(TARFLAGS) -cvf - \
516
		`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \! -name '*test' \! -name '.#*' \! -name '*~' | sort` |\
517 518 519 520 521
	tardy --user_number=0  --user_name=openssl \
	      --group_number=0 --group_name=openssl \
	      --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
	ls -l ../$(TARFILE)

522
dist:   
523
	$(PERL) Configure dist
524 525
	@$(MAKE) dist_pem_h
	@$(MAKE) SDIRS='${SDIRS}' clean
526
	@$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
527 528

dist_pem_h:
529
	(cd crypto/pem; $(MAKE) $(BUILDENV) pem.h; $(MAKE) clean)
530

531 532 533
install: all install_docs install_sw

install_sw:
B
Bodo Möller 已提交
534 535
	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
		$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
536
		$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines \
537
		$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \
B
Bodo Möller 已提交
538 539 540
		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
541
		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
542
	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
B
Bodo Möller 已提交
543 544 545 546
	do \
	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
	done;
547
	@set -e; for i in $(DIRS) ;\
548
	do \
549
	if [ -d "$$i" ]; then \
550
		(cd $$i; echo "installing $$i..."; \
551
		$(MAKE) $(BUILDENV) INSTALL_PREFIX='${INSTALL_PREFIX}' OPENSSLDIR='${OPENSSLDIR}' install ); \
552
	fi; \
553
	done
554
	@set -e; for i in $(LIBS) ;\
555
	do \
556 557
		if [ -f "$$i" ]; then \
		(       echo installing $$i; \
558 559 560
			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
561
			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
L
Lutz Jänicke 已提交
562 563
		fi; \
	done;
564
	@set -e; if [ -n "$(SHARED_LIBS)" ]; then \
565 566 567
		tmp="$(SHARED_LIBS)"; \
		for i in $${tmp:-x}; \
		do \
568
			if [ -f "$$i" -o -f "$$i.a" ]; then \
569
			(       echo installing $$i; \
570
				if [ "$(PLATFORM)" != "Cygwin" ]; then \
571 572
					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
573
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
574 575
				else \
					c=`echo $$i | sed 's/^lib/cyg/'`; \
576 577
					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
578
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
579 580
					cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
581
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
582
				fi ); \
L
Lutz Jänicke 已提交
583
			fi; \
584 585 586
		done; \
		(	here="`pwd`"; \
			cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
587
			$(NEWMAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
588 589 590 591
		if [ "$(INSTALLTOP)" != "/usr" ]; then \
			echo 'OpenSSL shared libraries have been installed in:'; \
			echo '  $(INSTALLTOP)'; \
			echo ''; \
592
			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
593
		fi; \
594
	fi
595
	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
596
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc
597 598 599

install_docs:
	@$(PERL) $(TOP)/util/mkdir-p.pl \
600 601 602 603
		$(INSTALL_PREFIX)$(MANDIR)/man1 \
		$(INSTALL_PREFIX)$(MANDIR)/man3 \
		$(INSTALL_PREFIX)$(MANDIR)/man5 \
		$(INSTALL_PREFIX)$(MANDIR)/man7
604
	@pod2man="`cd util; ./pod2mantest $(PERL)`"; \
605 606 607 608 609
	here="`pwd`"; \
	filecase=; \
	if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" ]; then \
		filecase=-i; \
	fi; \
610
	set -e; for i in doc/apps/*.pod; do \
611
		fn=`basename $$i .pod`; \
612
		if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
613
		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
614
		(cd `$(PERL) util/dirname.pl $$i`; \
615
		sh -c "$$pod2man \
616 617
			--section=$$sec --center=OpenSSL \
			--release=$(VERSION) `basename $$i`") \
618
			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
619 620
		$(PERL) util/extract-names.pl < $$i | \
			grep -v $$filecase "^$$fn\$$" | \
621
			grep -v "[	]" | \
622 623
			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
			 while read n; do \
R
Richard Levitte 已提交
624
				$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
625
			 done); \
626
	done; \
627
	set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
628
		fn=`basename $$i .pod`; \
629
		if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
630
		echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
631
		(cd `$(PERL) util/dirname.pl $$i`; \
632
		sh -c "$$pod2man \
633 634
			--section=$$sec --center=OpenSSL \
			--release=$(VERSION) `basename $$i`") \
635
			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
636 637
		$(PERL) util/extract-names.pl < $$i | \
			grep -v $$filecase "^$$fn\$$" | \
R
Richard Levitte 已提交
638
			grep -v "[	]" | \
639 640
			(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
			 while read n; do \
R
Richard Levitte 已提交
641
				$$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
642
			 done); \
643
	done
644 645

# DO NOT DELETE THIS LINE -- make depend depends on it.