From a8c3955776fcf5a8fd941af56a8773032027a812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Frauenschl=C3=A4ger?= Date: Fri, 16 Oct 2026 09:54:21 +0200 Subject: [PATCH] Generate the test certificates once under parallel make ca_cert.c, server_key.c and server_cert.c each had their own rule running tools/certs/mkcerts.sh, and the script rewrites all of the cert files. With make -j the three rules run at the same time, overwrite each other's keys and certificates, and can leave server_cert.c without server_der, so build/test-wolfssl fails to link with an undefined reference to server_der. wolfSSL's cross-library CI hits this intermittently. One pattern rule now names all three files as targets, which GNU make treats as a single recipe that writes all of them, so mkcerts.sh runs once under -j. The files are also named as plain targets so make does not treat them as intermediates: they survive the build and a deleted one is regenerated. --- Makefile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 1023f0ca..2499d0cc 100644 --- a/Makefile +++ b/Makefile @@ -1081,17 +1081,13 @@ build/http/%.o: build/http/%.c @echo "[CC] $<" @$(CC) $(CFLAGS) -c $< -o $@ -build/certs/ca_cert.c: - @echo "[MKCERTS] `dirname $@`" - @tools/certs/mkcerts.sh +# A pattern rule tells make that one mkcerts.sh run writes all three files. +build/%/ca_cert.c build/%/server_key.c build/%/server_cert.c: + @echo "[MKCERTS] build/$*" + @tools/certs/mkcerts.sh build/$* -build/certs/server_key.c: - @echo "[MKCERTS] `dirname $@`" - @tools/certs/mkcerts.sh - -build/certs/server_cert.c: - @echo "[MKCERTS] `dirname $@`" - @tools/certs/mkcerts.sh +# Named as targets so make does not treat them as intermediate files. +build/certs/ca_cert.c build/certs/server_key.c build/certs/server_cert.c: build/certs/server_key.o: build/certs/server_key.c @mkdir -p `dirname $@` || true