Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 1 | |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 2 | # Also see "include/mbedtls/mbedtls_config.h" |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 3 | |
Alon Bar-Lev | f7a9f30 | 2015-02-18 17:55:05 +0200 | [diff] [blame] | 4 | CFLAGS ?= -O2 |
Paul Elliott | 9e3256a | 2020-12-17 18:17:32 +0000 | [diff] [blame] | 5 | WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral |
Alon Bar-Lev | ada4105 | 2015-02-18 17:47:52 +0200 | [diff] [blame] | 6 | LDFLAGS ?= |
Alon Bar-Lev | f7a9f30 | 2015-02-18 17:55:05 +0200 | [diff] [blame] | 7 | |
Gilles Peskine | 76dd3aa | 2020-07-02 15:58:37 +0200 | [diff] [blame] | 8 | # Include ../include for public headers and . for private headers. |
| 9 | # Note that . needs to be included explicitly for the sake of library |
| 10 | # files that are not in the /library directory (which currently means |
| 11 | # under /3rdparty). |
Gilles Peskine | 66c3dc4 | 2020-06-03 02:25:17 +0200 | [diff] [blame] | 12 | LOCAL_CFLAGS = $(WARNING_CFLAGS) -I. -I../include -D_FILE_OFFSET_BITS=64 |
Alon Bar-Lev | ada4105 | 2015-02-18 17:47:52 +0200 | [diff] [blame] | 13 | LOCAL_LDFLAGS = |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 14 | |
Paul Bakker | c7ffd36 | 2012-04-05 12:08:29 +0000 | [diff] [blame] | 15 | ifdef DEBUG |
Alon Bar-Lev | f7a9f30 | 2015-02-18 17:55:05 +0200 | [diff] [blame] | 16 | LOCAL_CFLAGS += -g3 |
Paul Bakker | c7ffd36 | 2012-04-05 12:08:29 +0000 | [diff] [blame] | 17 | endif |
| 18 | |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 19 | # MicroBlaze specific options: |
| 20 | # CFLAGS += -mno-xl-soft-mul -mxl-barrel-shift |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 21 | |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 22 | # To compile on Plan9: |
| 23 | # CFLAGS += -D_BSD_EXTENSION |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 24 | |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 25 | PERL ?= perl |
Gilles Peskine | 30d9a37 | 2021-11-22 11:02:10 +0100 | [diff] [blame] | 26 | ifdef WINDOWS |
| 27 | PYTHON ?= python |
| 28 | else |
| 29 | PYTHON ?= $(shell if type python3 >/dev/null 2>/dev/null; then echo python3; else echo python; fi) |
| 30 | endif |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 31 | |
Manuel Pégourié-Gonnard | 02ba578 | 2015-02-18 13:42:26 +0000 | [diff] [blame] | 32 | # if were running on Windows build for Windows |
| 33 | ifdef WINDOWS |
| 34 | WINDOWS_BUILD=1 |
Andres Amaya Garcia | c471cd7 | 2018-06-13 09:28:04 +0100 | [diff] [blame] | 35 | else ifeq ($(shell uname -s),Darwin) |
Andres Amaya Garcia | e3402ce | 2018-06-20 10:43:21 +0100 | [diff] [blame] | 36 | ifeq ($(AR),ar) |
Andres Amaya Garcia | 1d93759 | 2018-06-13 10:04:58 +0100 | [diff] [blame] | 37 | APPLE_BUILD ?= 1 |
Manuel Pégourié-Gonnard | 02ba578 | 2015-02-18 13:42:26 +0000 | [diff] [blame] | 38 | endif |
Manuel Pégourié-Gonnard | 02ba578 | 2015-02-18 13:42:26 +0000 | [diff] [blame] | 39 | endif |
| 40 | |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 41 | # To compile as a shared library: |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 42 | ifdef SHARED |
Manuel Pégourié-Gonnard | 3cfb345 | 2015-02-13 13:34:08 +0000 | [diff] [blame] | 43 | # all code is position-indep with mingw, avoid warning about useless flag |
Manuel Pégourié-Gonnard | 02ba578 | 2015-02-18 13:42:26 +0000 | [diff] [blame] | 44 | ifndef WINDOWS_BUILD |
Alon Bar-Lev | f7a9f30 | 2015-02-18 17:55:05 +0200 | [diff] [blame] | 45 | LOCAL_CFLAGS += -fPIC -fpic |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 46 | endif |
Manuel Pégourié-Gonnard | 3cfb345 | 2015-02-13 13:34:08 +0000 | [diff] [blame] | 47 | endif |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 48 | |
Dave Rodgman | 527b82a | 2021-07-02 15:19:38 +0100 | [diff] [blame] | 49 | SOEXT_TLS=so.16 |
| 50 | SOEXT_X509=so.4 |
| 51 | SOEXT_CRYPTO=so.10 |
Paul Bakker | 33aac37 | 2011-08-13 11:47:41 +0000 | [diff] [blame] | 52 | |
Antonin Décimo | 36e89b5 | 2019-01-23 15:24:37 +0100 | [diff] [blame] | 53 | # Set AR_DASH= (empty string) to use an ar implementation that does not accept |
Andres Amaya Garcia | ceed91b | 2018-03-25 23:48:39 +0100 | [diff] [blame] | 54 | # the - prefix for command line options (e.g. llvm-ar) |
| 55 | AR_DASH ?= - |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 56 | |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 57 | ARFLAGS = $(AR_DASH)src |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 58 | ifdef APPLE_BUILD |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 59 | ifneq ($(APPLE_BUILD),0) |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 60 | ARFLAGS = $(AR_DASH)Src |
| 61 | RLFLAGS = -no_warning_for_no_symbols -c |
| 62 | RL ?= ranlib |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 63 | endif |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 64 | endif |
| 65 | |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 66 | DLEXT ?= so |
Alon Bar-Lev | 18ba0cc | 2015-02-14 01:04:58 +0200 | [diff] [blame] | 67 | ifdef WINDOWS_BUILD |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 68 | # Windows shared library extension: |
| 69 | DLEXT = dll |
| 70 | else ifdef APPLE_BUILD |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 71 | ifneq ($(APPLE_BUILD),0) |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 72 | # Mac OS X shared library extension: |
| 73 | DLEXT = dylib |
Paul Bakker | cd5b529 | 2012-05-10 20:49:10 +0000 | [diff] [blame] | 74 | endif |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 75 | endif |
Paul Bakker | bdb912d | 2012-02-13 23:11:30 +0000 | [diff] [blame] | 76 | |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 77 | OBJS_CRYPTO= \ |
| 78 | aes.o \ |
| 79 | aesni.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 80 | aria.o \ |
| 81 | asn1parse.o \ |
| 82 | asn1write.o \ |
| 83 | base64.o \ |
| 84 | bignum.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 85 | camellia.o \ |
| 86 | ccm.o \ |
| 87 | chacha20.o \ |
| 88 | chachapoly.o \ |
| 89 | cipher.o \ |
| 90 | cipher_wrap.o \ |
| 91 | cmac.o \ |
| 92 | ctr_drbg.o \ |
| 93 | des.o \ |
| 94 | dhm.o \ |
| 95 | ecdh.o \ |
| 96 | ecdsa.o \ |
| 97 | ecjpake.o \ |
| 98 | ecp.o \ |
| 99 | ecp_curves.o \ |
| 100 | entropy.o \ |
| 101 | entropy_poll.o \ |
| 102 | error.o \ |
| 103 | gcm.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 104 | hkdf.o \ |
| 105 | hmac_drbg.o \ |
| 106 | md.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 107 | md5.o \ |
| 108 | memory_buffer_alloc.o \ |
Hanno Becker | 53314aa | 2021-02-22 15:03:37 +0000 | [diff] [blame] | 109 | mps_reader.o \ |
| 110 | mps_trace.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 111 | nist_kw.o \ |
| 112 | oid.o \ |
| 113 | padlock.o \ |
| 114 | pem.o \ |
| 115 | pk.o \ |
| 116 | pk_wrap.o \ |
| 117 | pkcs12.o \ |
| 118 | pkcs5.o \ |
| 119 | pkparse.o \ |
| 120 | pkwrite.o \ |
| 121 | platform.o \ |
| 122 | platform_util.o \ |
| 123 | poly1305.o \ |
| 124 | psa_crypto.o \ |
Ronald Cron | 7ceee8d | 2021-03-17 16:55:43 +0100 | [diff] [blame] | 125 | psa_crypto_aead.o \ |
Ronald Cron | 0ff5795 | 2021-03-08 16:46:35 +0100 | [diff] [blame] | 126 | psa_crypto_cipher.o \ |
Ronald Cron | d790632 | 2021-01-28 16:07:56 +0100 | [diff] [blame] | 127 | psa_crypto_client.o \ |
Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 128 | psa_crypto_driver_wrappers.o \ |
Ronald Cron | 00b7bfc | 2020-11-25 15:25:26 +0100 | [diff] [blame] | 129 | psa_crypto_ecp.o \ |
Steven Cooreman | 0e30764 | 2021-02-18 16:18:32 +0100 | [diff] [blame] | 130 | psa_crypto_hash.o \ |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 131 | psa_crypto_mac.o \ |
Ronald Cron | 00b7bfc | 2020-11-25 15:25:26 +0100 | [diff] [blame] | 132 | psa_crypto_rsa.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 133 | psa_crypto_se.o \ |
| 134 | psa_crypto_slot_management.o \ |
| 135 | psa_crypto_storage.o \ |
| 136 | psa_its_file.o \ |
| 137 | ripemd160.o \ |
| 138 | rsa.o \ |
Chris Jones | 66a4cd4 | 2021-03-09 16:04:12 +0000 | [diff] [blame] | 139 | rsa_alt_helpers.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 140 | sha1.o \ |
| 141 | sha256.o \ |
| 142 | sha512.o \ |
| 143 | threading.o \ |
| 144 | timing.o \ |
| 145 | version.o \ |
| 146 | version_features.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 147 | # This line is intentionally left blank |
Jaeden Amero | 30b340a | 2018-10-25 17:37:00 +0100 | [diff] [blame] | 148 | |
Christoph M. Wintersteiger | 62dddd0 | 2018-12-14 13:07:50 +0000 | [diff] [blame] | 149 | include ../3rdparty/Makefile.inc |
| 150 | LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES) |
Christoph M. Wintersteiger | 2d4725f | 2019-02-15 13:35:04 +0000 | [diff] [blame] | 151 | OBJS_CRYPTO+=$(THIRDPARTY_CRYPTO_OBJECTS) |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 152 | |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 153 | OBJS_X509= \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 154 | x509.o \ |
| 155 | x509_create.o \ |
| 156 | x509_crl.o \ |
| 157 | x509_crt.o \ |
| 158 | x509_csr.o \ |
| 159 | x509write_crt.o \ |
| 160 | x509write_csr.o \ |
| 161 | # This line is intentionally left blank |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 162 | |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 163 | OBJS_TLS= \ |
| 164 | debug.o \ |
| 165 | net_sockets.o \ |
| 166 | ssl_cache.o \ |
| 167 | ssl_ciphersuites.o \ |
| 168 | ssl_cli.o \ |
| 169 | ssl_cookie.o \ |
| 170 | ssl_msg.o \ |
| 171 | ssl_srv.o \ |
| 172 | ssl_ticket.o \ |
| 173 | ssl_tls.o \ |
Hanno Becker | be9d664 | 2020-08-21 13:20:06 +0100 | [diff] [blame] | 174 | ssl_tls13_keys.o \ |
Jerry Yu | 3cc4c2a | 2021-08-06 16:29:08 +0800 | [diff] [blame] | 175 | ssl_tls13_client.o \ |
| 176 | ssl_tls13_server.o \ |
Jerry Yu | 65dd2cc | 2021-08-18 16:38:40 +0800 | [diff] [blame] | 177 | ssl_tls13_generic.o \ |
Manuel Pégourié-Gonnard | 10a5b53 | 2020-04-03 11:50:59 +0200 | [diff] [blame] | 178 | # This line is intentionally left blank |
Manuel Pégourié-Gonnard | 463e09d | 2015-06-24 11:54:19 +0200 | [diff] [blame] | 179 | |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 180 | .SILENT: |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 181 | |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 182 | .PHONY: all static shared clean |
| 183 | |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 184 | ifndef SHARED |
Paul Bakker | 3783d6d | 2011-07-13 11:25:36 +0000 | [diff] [blame] | 185 | all: static |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 186 | else |
Manuel Pégourié-Gonnard | 04a81d5 | 2015-01-27 11:24:05 +0100 | [diff] [blame] | 187 | all: shared static |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 188 | endif |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 189 | |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 190 | static: libmbedcrypto.a libmbedx509.a libmbedtls.a |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 191 | |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 192 | shared: libmbedcrypto.$(DLEXT) libmbedx509.$(DLEXT) libmbedtls.$(DLEXT) |
Manuel Pégourié-Gonnard | c26a092 | 2015-01-23 12:51:33 +0000 | [diff] [blame] | 193 | |
Tom Cosgrove | 0eedd36 | 2021-11-10 11:15:46 +0000 | [diff] [blame] | 194 | # Windows builds under Mingw can fail if make tries to create archives in the same |
| 195 | # directory at the same time - see https://bugs.launchpad.net/gcc-arm-embedded/+bug/1848002. |
| 196 | # This forces builds of the .a files to be serialised. |
| 197 | ifdef WINDOWS |
| 198 | libmbedtls.a: | libmbedx509.a |
| 199 | libmbedx509.a: | libmbedcrypto.a |
| 200 | endif |
| 201 | |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 202 | # tls |
| 203 | libmbedtls.a: $(OBJS_TLS) |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 204 | echo " AR $@" |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 205 | $(AR) $(ARFLAGS) $@ $(OBJS_TLS) |
| 206 | ifdef APPLE_BUILD |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 207 | ifneq ($(APPLE_BUILD),0) |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 208 | echo " RL $@" |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 209 | $(RL) $(RLFLAGS) $@ |
| 210 | endif |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 211 | endif |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 212 | |
Manuel Pégourié-Gonnard | ed46c43 | 2015-08-10 10:17:32 +0200 | [diff] [blame] | 213 | libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) libmbedx509.so |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 214 | echo " LD $@" |
Harmen Stoppels | fcb4fb7 | 2021-11-04 17:33:51 +0100 | [diff] [blame] | 215 | $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS_TLS) -L. -lmbedx509 -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 216 | |
Manuel Pégourié-Gonnard | 752c501 | 2015-06-25 11:54:52 +0200 | [diff] [blame] | 217 | libmbedtls.so: libmbedtls.$(SOEXT_TLS) |
| 218 | echo " LN $@ -> $<" |
| 219 | ln -sf $< $@ |
Paul Bakker | b076314 | 2013-11-05 11:27:12 +0100 | [diff] [blame] | 220 | |
Mitsuhiro Nakamura | 5ff2ee5 | 2018-02-20 11:58:19 +0900 | [diff] [blame] | 221 | libmbedtls.dylib: $(OBJS_TLS) libmbedx509.dylib |
Paul Bakker | ad7eca2 | 2010-03-24 06:46:47 +0000 | [diff] [blame] | 222 | echo " LD $@" |
Harmen Stoppels | fcb4fb7 | 2021-11-04 17:33:51 +0100 | [diff] [blame] | 223 | $(CC) -dynamiclib -o $@ $(OBJS_TLS) -L. -lmbedx509 -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 224 | |
Manuel Pégourié-Gonnard | 111ce9f | 2015-08-07 12:07:16 +0200 | [diff] [blame] | 225 | libmbedtls.dll: $(OBJS_TLS) libmbedx509.dll |
Paul Bakker | b076314 | 2013-11-05 11:27:12 +0100 | [diff] [blame] | 226 | echo " LD $@" |
Harmen Stoppels | fcb4fb7 | 2021-11-04 17:33:51 +0100 | [diff] [blame] | 227 | $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_TLS) -lws2_32 -lwinmm -lgdi32 -L. -lmbedx509 -lmbedcrypto -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 228 | |
| 229 | # x509 |
| 230 | libmbedx509.a: $(OBJS_X509) |
| 231 | echo " AR $@" |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 232 | $(AR) $(ARFLAGS) $@ $(OBJS_X509) |
| 233 | ifdef APPLE_BUILD |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 234 | ifneq ($(APPLE_BUILD),0) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 235 | echo " RL $@" |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 236 | $(RL) $(RLFLAGS) $@ |
| 237 | endif |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 238 | endif |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 239 | |
Gilles Peskine | 722a7e6 | 2020-02-26 19:05:19 +0100 | [diff] [blame] | 240 | libmbedx509.$(SOEXT_X509): $(OBJS_X509) libmbedcrypto.so |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 241 | echo " LD $@" |
Harmen Stoppels | 01ef723 | 2021-11-03 00:53:05 +0100 | [diff] [blame] | 242 | $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS_X509) -L. -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 243 | |
Manuel Pégourié-Gonnard | 752c501 | 2015-06-25 11:54:52 +0200 | [diff] [blame] | 244 | libmbedx509.so: libmbedx509.$(SOEXT_X509) |
| 245 | echo " LN $@ -> $<" |
| 246 | ln -sf $< $@ |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 247 | |
Gilles Peskine | 722a7e6 | 2020-02-26 19:05:19 +0100 | [diff] [blame] | 248 | libmbedx509.dylib: $(OBJS_X509) libmbedcrypto.dylib |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 249 | echo " LD $@" |
Harmen Stoppels | 01ef723 | 2021-11-03 00:53:05 +0100 | [diff] [blame] | 250 | $(CC) -dynamiclib -o $@ $(OBJS_X509) -L. -lmbedcrypto $(LOCAL_LDFLAGS) $(LDFLAGS) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 251 | |
Gilles Peskine | 722a7e6 | 2020-02-26 19:05:19 +0100 | [diff] [blame] | 252 | libmbedx509.dll: $(OBJS_X509) libmbedcrypto.dll |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 253 | echo " LD $@" |
Manuel Pégourié-Gonnard | 111ce9f | 2015-08-07 12:07:16 +0200 | [diff] [blame] | 254 | $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_X509) -lws2_32 -lwinmm -lgdi32 -L. -lmbedcrypto -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 255 | |
| 256 | # crypto |
| 257 | libmbedcrypto.a: $(OBJS_CRYPTO) |
| 258 | echo " AR $@" |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 259 | $(AR) $(ARFLAGS) $@ $(OBJS_CRYPTO) |
| 260 | ifdef APPLE_BUILD |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 261 | ifneq ($(APPLE_BUILD),0) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 262 | echo " RL $@" |
Andres Amaya Garcia | 0e98e88 | 2018-05-23 09:19:54 +0100 | [diff] [blame] | 263 | $(RL) $(RLFLAGS) $@ |
| 264 | endif |
Andres Amaya Garcia | c51d613 | 2018-06-19 17:25:34 +0100 | [diff] [blame] | 265 | endif |
Paul Bakker | a585beb | 2011-06-21 08:59:44 +0000 | [diff] [blame] | 266 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 267 | libmbedcrypto.$(SOEXT_CRYPTO): $(OBJS_CRYPTO) |
Paul Bakker | 62f88dc | 2012-05-10 21:26:28 +0000 | [diff] [blame] | 268 | echo " LD $@" |
Harmen Stoppels | 01ef723 | 2021-11-03 00:53:05 +0100 | [diff] [blame] | 269 | $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS_CRYPTO) $(LOCAL_LDFLAGS) $(LDFLAGS) |
Andrzej Kurek | 8af3923 | 2019-10-07 09:19:18 -0400 | [diff] [blame] | 270 | |
Paul Bakker | 62f88dc | 2012-05-10 21:26:28 +0000 | [diff] [blame] | 271 | libmbedcrypto.so: libmbedcrypto.$(SOEXT_CRYPTO) |
Manuel Pégourié-Gonnard | c26a092 | 2015-01-23 12:51:33 +0000 | [diff] [blame] | 272 | echo " LN $@ -> $<" |
Paul Bakker | 62f88dc | 2012-05-10 21:26:28 +0000 | [diff] [blame] | 273 | ln -sf $< $@ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 274 | |
| 275 | libmbedcrypto.dylib: $(OBJS_CRYPTO) |
| 276 | echo " LD $@" |
Harmen Stoppels | 01ef723 | 2021-11-03 00:53:05 +0100 | [diff] [blame] | 277 | $(CC) -dynamiclib -o $@ $(OBJS_CRYPTO) $(LOCAL_LDFLAGS) $(LDFLAGS) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 278 | |
| 279 | libmbedcrypto.dll: $(OBJS_CRYPTO) |
| 280 | echo " LD $@" |
| 281 | $(CC) -shared -Wl,-soname,$@ -Wl,--out-implib,$@.a -o $@ $(OBJS_CRYPTO) -lws2_32 -lwinmm -lgdi32 -static-libgcc $(LOCAL_LDFLAGS) $(LDFLAGS) |
| 282 | |
| 283 | .c.o: |
| 284 | echo " CC $<" |
Christoph M. Wintersteiger | 977d89a | 2018-10-25 12:47:03 +0100 | [diff] [blame] | 285 | $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $< |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 286 | |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 287 | .PHONY: generated_files |
Archana | e963a0e | 2021-11-17 08:44:07 +0530 | [diff] [blame] | 288 | GENERATED_FILES = error.c version_features.c psa_crypto_driver_wrappers.c |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 289 | generated_files: $(GENERATED_FILES) |
| 290 | |
| 291 | error.c: ../scripts/generate_errors.pl |
| 292 | error.c: ../scripts/data_files/error.fmt |
Gilles Peskine | 1411c7c | 2021-04-22 14:50:16 +0200 | [diff] [blame] | 293 | error.c: $(filter-out %config%,$(wildcard ../include/mbedtls/*.h)) |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 294 | error.c: |
| 295 | echo " Gen $@" |
| 296 | $(PERL) ../scripts/generate_errors.pl |
| 297 | |
| 298 | version_features.c: ../scripts/generate_features.pl |
| 299 | version_features.c: ../scripts/data_files/version_features.fmt |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 300 | ## The generated file only depends on the options that are present in mbedtls_config.h, |
Gilles Peskine | 1411c7c | 2021-04-22 14:50:16 +0200 | [diff] [blame] | 301 | ## not on which options are set. To avoid regenerating this file all the time |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 302 | ## when switching between configurations, don't declare mbedtls_config.h as a |
Gilles Peskine | 1411c7c | 2021-04-22 14:50:16 +0200 | [diff] [blame] | 303 | ## dependency. Remove this file from your working tree if you've just added or |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 304 | ## removed an option in mbedtls_config.h. |
| 305 | #version_features.c: ../include/mbedtls/mbedtls_config.h |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 306 | version_features.c: |
| 307 | echo " Gen $@" |
| 308 | $(PERL) ../scripts/generate_features.pl |
| 309 | |
Archana | e963a0e | 2021-11-17 08:44:07 +0530 | [diff] [blame] | 310 | psa_crypto_driver_wrappers.c: ../scripts/codegen_driverwrappers/generate_driver_wrappers.py |
| 311 | psa_crypto_driver_wrappers.c: |
| 312 | echo " Gen $@" |
| 313 | $(PYTHON) ../scripts/codegen_driverwrappers/generate_driver_wrappers.py \ |
| 314 | "../scripts/codegen_driverwrappers/psa_crypto_driver_wrappers.conf" \ |
| 315 | "psa_crypto_driver_wrappers.c" |
| 316 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 317 | clean: |
| 318 | ifndef WINDOWS |
Gilles Peskine | 55d5353 | 2020-03-09 17:48:13 +0100 | [diff] [blame] | 319 | rm -f *.o libmbed* |
Gilles Peskine | a647f12 | 2020-03-10 10:36:19 +0100 | [diff] [blame] | 320 | rm -f $(THIRDPARTY_CRYPTO_OBJECTS) |
Manuel Pégourié-Gonnard | 5c59a4f | 2015-06-24 13:06:24 +0200 | [diff] [blame] | 321 | else |
Darryl Green | 9b9a790 | 2019-08-30 14:51:55 +0100 | [diff] [blame] | 322 | if exist *.o del /Q /F *.o |
| 323 | if exist libmbed* del /Q /F libmbed* |
Gilles Peskine | a647f12 | 2020-03-10 10:36:19 +0100 | [diff] [blame] | 324 | del /Q /F del_errors_out_if_the_file_list_is_empty_but_not_if_a_file_does_not_exist $(subst /,\,$(THIRDPARTY_CRYPTO_OBJECTS)) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 325 | endif |
Gilles Peskine | 687d1ab | 2021-04-22 01:01:56 +0200 | [diff] [blame] | 326 | |
| 327 | neat: clean |
| 328 | ifndef WINDOWS |
| 329 | rm -f $(GENERATED_FILES) |
| 330 | else |
| 331 | for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f |
| 332 | endif |