Skip to content

Commit 92da0bd

Browse files
committed
Makefile: Use generated source files from parent
When building as a submodule of a parent project, like Mbed TLS, use the parent projects generated source files (error.c, version.c, version_features.c)
1 parent 8df5de4 commit 92da0bd

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

library/Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \
7373
dhm.o ecdh.o ecdsa.o \
7474
ecjpake.o ecp.o \
7575
ecp_curves.o entropy.o entropy_poll.o \
76-
error.o gcm.o havege.o \
76+
gcm.o havege.o \
7777
hkdf.o \
7878
hmac_drbg.o md.o md2.o \
7979
md4.o md5.o md_wrap.o \
@@ -88,8 +88,22 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \
8888
psa_its_file.o \
8989
ripemd160.o rsa_internal.o rsa.o \
9090
sha1.o sha256.o sha512.o \
91-
threading.o timing.o version.o \
92-
version_features.o xtea.o
91+
threading.o timing.o \
92+
xtea.o
93+
94+
# For files generated by the parent project (Mbed TLS) when building Mbed
95+
# Crypto as a submodule, ensure that the parent project instance is used.
96+
ifeq ($(USE_CRYPTO_SUBMODULE), 1)
97+
OBJS_CRYPTO += ../../library/error.o
98+
OBJS_CRYPTO += ../../library/version.o
99+
OBJS_CRYPTO += ../../library/version_features.o
100+
else
101+
OBJS_CRYPTO += error.o
102+
OBJS_CRYPTO += version.o
103+
OBJS_CRYPTO += version_features.o
104+
endif
105+
106+
$(info $(OBJS_CRYPTO))
93107

94108
OBJS_X509= certs.o pkcs11.o x509.o \
95109
x509_create.o x509_crl.o x509_crt.o \

0 commit comments

Comments
 (0)