From 8af3923815643057b16567ed11792a575d867b7a Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Mon, 7 Oct 2019 09:19:18 -0400 Subject: [PATCH] Add a recipe for libmbedcrypto with a path prefix This caused problems when running multiple jobs at once, since there was no target matching libmbedcrypto.so with the path prefix. It only worked if it was built first, since such file was found. Additionally, building of libmbedcrypto.so now waits for the static .a version. Previously, recipes for both libmbedcrypto.a and libmbedcrypto.so could run independently when running parallel jobs, which resulted in the .o files being built twice. It could sometimes be a problem, since linking would start when building one of the object files was still in progress (the previous one existed). This in turn resulted in reading (and trying to link) a malformed file. The "|" character is followed by "order-only-prerequisites", and in this case, makes linking of the shared version of the library wait for the .a file. Since it's guaranteed to be always built in the "all" target, it's fine to do that. All of the .o files are only built once thanks to this change. --- library/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/Makefile b/library/Makefile index 501421fb6..64f69a2d9 100644 --- a/library/Makefile +++ b/library/Makefile @@ -157,6 +157,11 @@ libmbedx509.dll: $(OBJS_X509) libmbedcrypto.dll libmbedcrypto.%: $(MAKE) CRYPTO_INCLUDES:="-I../../include -I../include" -C ../crypto/library $@ +libmbedcrypto.$(DLEXT): $(CRYPTO)libmbedcrypto.$(DLEXT) + +$(CRYPTO)libmbedcrypto.$(DLEXT): | libmbedcrypto.a + $(MAKE) CRYPTO_INCLUDES:="-I../../include -I../include" -C ../crypto/library libmbedcrypto.$(DLEXT) + .c.o: echo " CC $<" $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<