Skip to content

Commit 2769dc2

Browse files
committed
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 and a missing file still triggers it. .SECONDARY keeps the generated sources from being deleted as intermediates.
1 parent f7cb8d7 commit 2769dc2

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎Makefile‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,17 +1081,12 @@ build/http/%.o: build/http/%.c
10811081
@echo "[CC] $<"
10821082
@$(CC) $(CFLAGS) -c $< -o $@
10831083

1084-
build/certs/ca_cert.c:
1085-
@echo "[MKCERTS] `dirname $@`"
1086-
@tools/certs/mkcerts.sh
1084+
# A pattern rule tells make that one mkcerts.sh run writes all three files.
1085+
build/%/ca_cert.c build/%/server_key.c build/%/server_cert.c:
1086+
@echo "[MKCERTS] build/$*"
1087+
@tools/certs/mkcerts.sh build/$*
10871088

1088-
build/certs/server_key.c:
1089-
@echo "[MKCERTS] `dirname $@`"
1090-
@tools/certs/mkcerts.sh
1091-
1092-
build/certs/server_cert.c:
1093-
@echo "[MKCERTS] `dirname $@`"
1094-
@tools/certs/mkcerts.sh
1089+
.SECONDARY: build/certs/ca_cert.c build/certs/server_key.c build/certs/server_cert.c
10951090

10961091
build/certs/server_key.o: build/certs/server_key.c
10971092
@mkdir -p `dirname $@` || true

0 commit comments

Comments
 (0)