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.
This commit is contained in:
Andrzej Kurek 2019-10-07 09:19:18 -04:00
parent bdcca14076
commit 8af3923815

View file

@ -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 $<