Makefile 9.9 KB
Newer Older
1 2 3 4 5 6 7
#
# SSLeay/crypto/Makefile
#

DIR=		crypto
TOP=		..
CC=		cc
8
INCLUDE=	-I. -I$(TOP) -I../include
9
# INCLUDES targets sudbirs!
10
INCLUDES=	-I.. -I../.. -I../../include
11
CFLAG=		-g
12 13
MAKEDEPPROG=	makedepend
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
B
Ben Laurie 已提交
14
MAKEFILE=       Makefile
15
RM=             rm -f
16 17 18 19 20
AR=		ar r

PEX_LIBS=
EX_LIBS=
 
21
CFLAGS= $(INCLUDE) $(CFLAG)
22
ASFLAGS= $(INCLUDE) $(ASFLAG)
23
AFLAGS=$(ASFLAGS)
24

25 26
LIBS=

27 28
SDIRS=	objects \
	md2 md4 md5 sha mdc2 hmac ripemd \
29
	des rc2 rc4 rc5 idea bf cast \
B
Bodo Möller 已提交
30
	bn ec rsa dsa ecdsa ecdh dh dso engine aes \
31
	buffer bio stack lhash rand err \
32
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
B
Ben Laurie 已提交
33
	store pqueue
34

U
Ulf Möller 已提交
35
GENERAL=Makefile README crypto-lib.com install.com
36 37

LIB= $(TOP)/libcrypto.a
38
SHARED_LIB= libcrypto$(SHLIB_EXT)
39
LIBSRC=	cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c
40
LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o $(CPUID_OBJ)
41 42 43

SRC= $(LIBSRC)

44
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
45
	ossl_typ.h
46
HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
47 48 49 50 51 52

ALL=    $(GENERAL) $(SRC) $(HEADER)

top:
	@(cd ..; $(MAKE) DIRS=$(DIR) all)

53
all: shared
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
BUILDENV=	PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
		CC='${CC}' CFLAG='${CFLAG}' 			\
		AS='${CC}' ASFLAG='${CFLAG} -c'			\
		AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'	\
		SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/lib'		\
		INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'	\
		MAKEDEPEND='$$(TOP)/util/domd $$(TOP) -MD $(MAKEDEPPROG)'\
		DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}'	\
		MAKEDEPPROG='${MAKEDEPPROG}'			\
		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}'	\
		CPUID_OBJ='${CPUID_OBJ}'			\
		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}'		\
		THIS=$${THIS:-$@}

B
Ben Laurie 已提交
79
buildinf.h: ../Makefile
80
	( echo "#ifndef MK1MF_BUILD"; \
B
Ben Laurie 已提交
81
	echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
82 83
	echo '  #define CFLAGS "$(CC) $(CFLAG)"'; \
	echo '  #define PLATFORM "$(PLATFORM)"'; \
84
	echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
85
	echo '#endif' ) >buildinf.h
86

87 88
x86cpuid-elf.s:	x86cpuid.pl perlasm/x86asm.pl
	$(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
89 90
x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
	$(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
91 92
x86cpuid-out.s: x86cpuid.pl perlasm/x86asm.pl
	$(PERL) x86cpuid.pl a.out $(CFLAGS) $(PROCESSOR) > $@
93

94 95 96 97 98 99
uplink.o:	../ms/uplink.c
	$(CC) $(CFLAGS) -c -o $@ ../ms/uplink.c

uplink-cof.s:	../ms/uplink.pl
	$(PERL) ../ms/uplink.pl coff > $@

100 101
x86_64cpuid.s: x86_64cpuid.pl
	$(PERL) x86_64cpuid.pl $@
102 103 104
ia64cpuid.s: ia64cpuid.S
	$(CC) $(CFLAGS) -E ia64cpuid.S > $@

U
Ulf Möller 已提交
105
testapps:
106 107 108
	[ -z "$(THIS)" ] || ( if echo ${SDIRS} | fgrep ' des '; \
	then cd des && $(MAKE) des; fi )
	[ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) testapps );
109
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
U
Ulf Möller 已提交
110

111 112 113
subdirs:
	@for i in $(SDIRS) ;\
	do \
114
	(cd $$i && echo "making all in crypto/$$i..." && \
115
	$(MAKE) $(BUILDENV) INCLUDES='${INCLUDES}' all ) || exit 1; \
116 117 118
	done;

files:
B
Ben Laurie 已提交
119
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
120 121
	@for i in $(SDIRS) ;\
	do \
122
	(cd $$i && echo "making 'files' in crypto/$$i..." && \
123
	$(MAKE) files ); \
124 125 126
	done;

links:
127 128 129
	@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
	@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
	@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
130
	@for i in $(SDIRS); do \
131 132
	    (cd $$i && echo "making links in crypto/$$i..." && \
	    $(MAKE) links ); \
133 134 135 136
	done;

lib:	$(LIBOBJ)
	$(AR) $(LIB) $(LIBOBJ)
137
	$(RANLIB) $(LIB) || echo Never mind.
138 139
	@touch lib

140
shared: buildinf.h lib subdirs
141
	if [ -n "$(SHARED_LIBS)" ]; then \
142
		(cd ..; $(MAKE) $(SHARED_LIB)); \
143 144
	fi

145 146 147
libs:
	@for i in $(SDIRS) ;\
	do \
148
	(cd $$i && echo "making libs in crypto/$$i..." && \
149
	$(MAKE) lib );
150 151 152
	done;

tests:
153
	@[ -z "$(THIS)" ] || (for i in $(SDIRS) ;\
154
	do \
155
	(cd $$i && echo "making tests in crypto/$$i..." && \
156 157
	$(MAKE) tests ); \
	done; )
158
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
159 160

install:
161
	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
162
	@headerlist="$(EXHEADER)"; for i in $$headerlist ;\
163
	do \
164 165
	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
166 167 168
	done;
	@for i in $(SDIRS) ;\
	do \
169
	(cd $$i && echo "making install in crypto/$$i..." && \
170
	$(MAKE) install ); \
171 172 173 174 175
	done;

lint:
	@for i in $(SDIRS) ;\
	do \
176
	(cd $$i && echo "making lint in crypto/$$i..." && \
177
	$(MAKE) lint ); \
178 179 180
	done;

depend:
181 182 183
	[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
	[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
	[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
184 185 186 187 188 189
	@[ -z "$(THIS)" ] || (set -e; \
	for i in $(SDIRS) ; do \
	    (	cd $$i && echo "making depend in crypto/$$i..." && \
		$(MAKE) INCLUDES='${INCLUDES}' depend \
	    ); \
	done; )
190
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
191 192

clean:
193
	rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
194 195
	@for i in $(SDIRS) ;\
	do \
196
	(cd $$i && echo "making clean in crypto/$$i..." && \
197
	$(MAKE) clean ); \
198 199 200
	done;

dclean:
201
	$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
202 203 204
	mv -f Makefile.new $(MAKEFILE)
	@for i in $(SDIRS) ;\
	do \
205
	(cd $$i && echo "making dclean in crypto/$$i..." && \
206
	$(MAKE) dclean ); \
207 208 209
	done;

# DO NOT DELETE THIS LINE -- make depend depends on it.
B
Ben Laurie 已提交
210

211
cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
212 213
cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
G
Geoff Thorpe 已提交
214 215 216
cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
cpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h
cpt_err.o: ../include/openssl/symhacks.h cpt_err.c
217 218 219 220
cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
G
Geoff Thorpe 已提交
221 222 223
cryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
cryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c
cryptlib.o: cryptlib.h
224 225 226 227
cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
G
Geoff Thorpe 已提交
228 229 230
cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
cversion.o: cryptlib.h cversion.c
L
Lutz Jänicke 已提交
231
ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
232 233 234 235
ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
G
Geoff Thorpe 已提交
236 237 238
ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
ex_data.o: ex_data.c
239 240 241 242
mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
G
Geoff Thorpe 已提交
243 244 245
mem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
mem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
mem.o: mem.c
246 247
mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
248 249
mem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
mem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c
250 251 252 253
mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
G
Geoff Thorpe 已提交
254 255 256
mem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
mem_dbg.o: mem_dbg.c
257 258
o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
o_dir.o: LPdir_unix.c o_dir.c o_dir.h
259 260
o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
o_str.o: o_str.c o_str.h
R
Richard Levitte 已提交
261 262
o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
o_time.o: o_time.h
263 264 265 266
tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
G
Geoff Thorpe 已提交
267 268 269
tmdiff.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h tmdiff.c
270 271
uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
272 273
uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
uid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c