blob: 6e1c12945ec884e03ca2f62d163192b547f4a76a [file] [log] [blame]
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +00001#
Dr. Stephen Henson15ac9712006-02-04 01:45:59 +00002# OpenSSL/crypto/Makefile
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +00003#
4
5DIR= crypto
6TOP= ..
7CC= cc
Dr. Stephen Hensoncc7399e2009-04-07 16:33:26 +00008INCLUDE= -I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
Andy Polyakov7abbffc2005-05-16 14:24:45 +00009# INCLUDES targets sudbirs!
Matt Caswell85bcf272014-11-24 10:06:20 +000010INCLUDES= -I.. -I../.. -I../modes -I../asn1 -I../evp -I../include -I../../include $(ZLIB_INCLUDE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000011CFLAG= -g
Richard Levittecf1b7d92001-02-19 16:06:34 +000012MAKEDEPPROG= makedepend
13MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
Ben Laurie42ba5d22005-03-30 13:05:57 +000014MAKEFILE= Makefile
Ralf S. Engelschallbb8f3c51999-03-06 12:32:06 +000015RM= rm -f
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000016AR= ar r
17
Andy Polyakov02c31fa2005-06-23 00:03:26 +000018RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
19 (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
Andy Polyakova3705372008-12-29 16:17:52 +000020 $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
Andy Polyakov02c31fa2005-06-23 00:03:26 +000021 done;
22
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000023PEX_LIBS=
24EX_LIBS=
25
Bodo Möller664b9981999-07-21 20:49:15 +000026CFLAGS= $(INCLUDE) $(CFLAG)
Andy Polyakov14e21f82004-07-26 20:18:55 +000027ASFLAGS= $(INCLUDE) $(ASFLAG)
Andy Polyakov16760a32004-08-29 21:36:37 +000028AFLAGS=$(ASFLAGS)
Dr. Stephen Henson167066f2007-08-13 02:24:26 +000029CPUID_OBJ=mem_clr.o
Ralf S. Engelschall58964a41998-12-21 10:56:39 +000030
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000031LIBS=
32
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000033GENERAL=Makefile README crypto-lib.com install.com
Emilia Kasper5a3d21c2014-08-28 15:33:34 +020034TEST=constant_time_test.c
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000035
36LIB= $(TOP)/libcrypto.a
Richard Levittea7b42002001-10-30 08:00:59 +000037SHARED_LIB= libcrypto$(SHLIB_EXT)
Dr. Stephen Henson3f746832011-04-01 14:49:30 +000038LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
39 ebcdic.c uid.c o_time.c o_str.c o_dir.c thr_id.c lock.c fips_ers.c \
Dr. Stephen Henson086e32a2011-05-19 18:09:02 +000040 o_init.c o_fips.c
Dr. Stephen Henson3f746832011-04-01 14:49:30 +000041LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o \
42 ebcdic.o uid.o o_time.o o_str.o o_dir.o thr_id.o lock.o fips_ers.o \
Dr. Stephen Henson086e32a2011-05-19 18:09:02 +000043 o_init.o o_fips.o $(CPUID_OBJ)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000044
45SRC= $(LIBSRC)
46
Andy Polyakov6852d1d2005-11-06 11:38:18 +000047EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
Ben Lauriec0482542014-02-19 17:57:07 +000048 ossl_typ.h
Tim Hudsonc6e9b392014-09-25 08:04:35 +020049HEADER= cryptlib.h buildinf.h md32_common.h o_str.h o_dir.h \
50 constant_time_locl.h $(EXHEADER)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000051
52ALL= $(GENERAL) $(SRC) $(HEADER)
53
54top:
55 @(cd ..; $(MAKE) DIRS=$(DIR) all)
56
Lutz Jänicke919f8bc2003-12-03 16:29:41 +000057all: shared
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000058
Dr. Stephen Hensoneead69f2011-02-21 14:07:15 +000059fips: cryptlib.o thr_id.o uid.o $(CPUID_OBJ)
60 [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
61 ( obj=`$(PERL) $(TOP)/util/fipsobj.pl $$i` && \
62 cd $$i && echo "making fips in $(DIR)/$$i..." && \
63 $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$obj ) || exit 1; \
64 done;
65
Ben Laurie42ba5d22005-03-30 13:05:57 +000066buildinf.h: ../Makefile
Matt Caswell2d267172015-01-13 10:20:12 +000067 $(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000068
Andy Polyakovfa8e9212008-01-11 13:15:11 +000069x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl
70 $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
Andy Polyakovec38ddc2004-08-01 17:33:58 +000071
Andy Polyakov5b50f992006-10-24 22:14:20 +000072applink.o: $(TOP)/ms/applink.c
73 $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
Andy Polyakov51ff6bd2005-05-18 08:16:46 +000074
Andy Polyakov5b50f992006-10-24 22:14:20 +000075uplink.o: $(TOP)/ms/uplink.c applink.o
76 $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
77
Andy Polyakovbeef7142009-12-27 20:38:32 +000078uplink-x86.s: $(TOP)/ms/uplink-x86.pl
79 $(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
Andy Polyakov51ff6bd2005-05-18 08:16:46 +000080
Andy Polyakovcb3b9b12009-12-27 20:49:40 +000081x86_64cpuid.s: x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
82ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@
83ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
84pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@
Andy Polyakov149b1802010-07-26 22:04:31 +000085alphacpuid.s: alphacpuid.pl
Andy Polyakovd475b2a2014-09-20 10:18:19 +020086 (preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
Andy Polyakovd1cf23a2013-11-12 21:49:15 +010087 $(PERL) alphacpuid.pl > $$preproc && \
Andy Polyakovd475b2a2014-09-20 10:18:19 +020088 $(CC) -E -P $$preproc > $@ && rm $$preproc)
Andy Polyakov9b05cbc2015-01-05 11:25:10 +010089arm64cpuid.S: arm64cpuid.pl; $(PERL) arm64cpuid.pl $(PERLASM_SCHEME) > $@
Andy Polyakov14e21f82004-07-26 20:18:55 +000090
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000091subdirs:
Andy Polyakov02c31fa2005-06-23 00:03:26 +000092 @target=all; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000093
94files:
Ben Laurie4e232282013-03-04 14:09:17 +000095 $(PERL) $(TOP)/util/files.pl "CPUID_OBJ=$(CPUID_OBJ)" Makefile >> $(TOP)/MINFO
Andy Polyakov02c31fa2005-06-23 00:03:26 +000096 @target=files; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +000097
98links:
Bodo Möller1314c341999-04-29 12:46:59 +000099 @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
100 @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
101 @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000102 @target=links; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000103
Andy Polyakove347b0d2005-11-09 20:46:37 +0000104# lib: $(LIB): are splitted to avoid end-less loop
Andy Polyakov52b1fbb2005-11-09 20:41:21 +0000105lib: $(LIB)
106 @touch lib
Andy Polyakov52b1fbb2005-11-09 20:41:21 +0000107$(LIB): $(LIBOBJ)
Dr. Stephen Hensonf0727852014-10-18 23:47:03 +0100108 $(AR) $(LIB) $(LIBOBJ)
Bodo Möller4e20b1a2001-03-09 14:01:42 +0000109 $(RANLIB) $(LIB) || echo Never mind.
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000110
Lutz Jänicke919f8bc2003-12-03 16:29:41 +0000111shared: buildinf.h lib subdirs
Richard Levittea7b42002001-10-30 08:00:59 +0000112 if [ -n "$(SHARED_LIBS)" ]; then \
Richard Levittee70a3982002-07-31 13:49:06 +0000113 (cd ..; $(MAKE) $(SHARED_LIB)); \
Richard Levittea7b42002001-10-30 08:00:59 +0000114 fi
115
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000116libs:
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000117 @target=lib; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000118
119install:
Andy Polyakov734540f2005-05-15 23:53:34 +0000120 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
Richard Levittea2ac4292004-11-02 23:55:01 +0000121 @headerlist="$(EXHEADER)"; for i in $$headerlist ;\
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000122 do \
Bodo Möllere5f30451999-04-29 21:52:08 +0000123 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
124 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000125 done;
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000126 @target=install; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000127
Rich Salz9405a9a2015-01-12 10:28:05 -0500128uninstall:
129
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000130lint:
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000131 @target=lint; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000132
133depend:
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000134 @[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
135 @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
136 @[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
137 @[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
Andy Polyakov7abbffc2005-05-16 14:24:45 +0000138 @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000139
140clean:
Andy Polyakov14e21f82004-07-26 20:18:55 +0000141 rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000142 @target=clean; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000143
144dclean:
Ulf Möller99aab161999-04-01 12:34:33 +0000145 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000146 mv -f Makefile.new $(MAKEFILE)
Andy Polyakov02c31fa2005-06-23 00:03:26 +0000147 @target=dclean; $(RECURSIVE_MAKE)
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000148
Ralf S. Engelschalld02b48c1998-12-21 10:52:47 +0000149# DO NOT DELETE THIS LINE -- make depend depends on it.
Ben Laurie6242bb91999-03-06 14:32:48 +0000150
Geoff Thorpe1c4f90a2000-06-13 12:59:38 +0000151cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
Richard Levittecf1b7d92001-02-19 16:06:34 +0000152cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
153cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
Geoff Thorpec57bc2d2004-04-19 18:33:41 +0000154cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
155cpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h
156cpt_err.o: ../include/openssl/symhacks.h cpt_err.c
Richard Levitte41d2a332001-02-22 14:45:02 +0000157cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
158cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
159cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
160cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpec57bc2d2004-04-19 18:33:41 +0000161cryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
162cryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c
163cryptlib.o: cryptlib.h
Richard Levitte41d2a332001-02-22 14:45:02 +0000164cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
165cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
166cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
167cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpec57bc2d2004-04-19 18:33:41 +0000168cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
169cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
170cversion.o: cryptlib.h cversion.c
Lutz Jänicke3aecef72002-07-30 12:44:33 +0000171ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
Richard Levitte41d2a332001-02-22 14:45:02 +0000172ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
173ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
174ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
175ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpec57bc2d2004-04-19 18:33:41 +0000176ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
177ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
178ex_data.o: ex_data.c
Bodo Möllerae53b292011-09-05 09:46:15 +0000179fips_ers.o: ../include/openssl/opensslconf.h fips_ers.c
Bodo Möller9d0397e2011-02-03 10:17:53 +0000180lock.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
181lock.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
Bodo Möllerae53b292011-09-05 09:46:15 +0000182lock.o: ../include/openssl/err.h ../include/openssl/lhash.h
183lock.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
184lock.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
185lock.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
186lock.o: lock.c
Richard Levitte41d2a332001-02-22 14:45:02 +0000187mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
188mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
189mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
190mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpec57bc2d2004-04-19 18:33:41 +0000191mem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
192mem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
193mem.o: mem.c
Richard Levittedf29cc82002-11-27 12:24:05 +0000194mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
195mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpe9c52d2c2004-05-17 19:26:06 +0000196mem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
197mem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c
Richard Levitte41d2a332001-02-22 14:45:02 +0000198mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
199mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
200mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
201mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpec57bc2d2004-04-19 18:33:41 +0000202mem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
203mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
204mem_dbg.o: mem_dbg.c
Richard Levittea2400fc2004-07-10 13:16:02 +0000205o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
206o_dir.o: LPdir_unix.c o_dir.c o_dir.h
Bodo Möllerae53b292011-09-05 09:46:15 +0000207o_fips.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
208o_fips.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
209o_fips.o: ../include/openssl/err.h ../include/openssl/lhash.h
210o_fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
211o_fips.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
212o_fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
213o_fips.o: o_fips.c
214o_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
215o_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
216o_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
217o_init.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
218o_init.o: ../include/openssl/safestack.h ../include/openssl/stack.h
219o_init.o: ../include/openssl/symhacks.h o_init.c
Richard Levittea7201e92005-01-17 17:06:58 +0000220o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
221o_str.o: o_str.c o_str.h
Matt Caswellfd0ba772014-12-11 23:33:10 +0000222o_time.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
223o_time.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
224o_time.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
225o_time.o: ../include/openssl/stack.h ../include/openssl/symhacks.h o_time.c
Bodo Möller9d0397e2011-02-03 10:17:53 +0000226thr_id.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
227thr_id.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
228thr_id.o: ../include/openssl/err.h ../include/openssl/lhash.h
229thr_id.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
230thr_id.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
231thr_id.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
232thr_id.o: thr_id.c
Richard Levittecf1b7d92001-02-19 16:06:34 +0000233uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
234uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
Geoff Thorpe9c52d2c2004-05-17 19:26:06 +0000235uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
236uid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c