Makefile.tpl: Avoid race condition in generating site.exp from the top level

A command like "make -j 2 check-gcc-c check-gcc-c++" run in the top level of
a fresh build directory does not work reliably. That will spawn two
independent make processes inside the "gcc" directory, and each of those
will attempt to create site.exp if it doesn't exist and will interfere with
each other, producing often a corrupted or empty site.exp. Resolve that by
making these targets depend on a new phony target which makes sure site.exp
is created first before starting the recursive makes.

ChangeLog:

	* Makefile.in: Regenerate.
	* Makefile.tpl: Add dependency on site.exp to check-gcc-* targets
This commit is contained in:
Lewis Hyatt 2023-11-16 11:18:37 -05:00
parent 78d132d73e
commit 56ca59a031
2 changed files with 28 additions and 12 deletions

View File

@ -62200,8 +62200,16 @@ cross: all-build all-gas all-ld
@if gcc
.PHONY: gcc-site.exp
gcc-site.exp:
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) site.exp);
.PHONY: check-gcc-c check-c
check-gcc-c:
check-gcc-c: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62209,7 +62217,7 @@ check-gcc-c:
check-c: check-gcc-c
.PHONY: check-gcc-c++ check-c++
check-gcc-c++:
check-gcc-c++: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62217,7 +62225,7 @@ check-gcc-c++:
check-c++: check-gcc-c++ check-target-libstdc++-v3 check-target-libitm-c++ check-target-libgomp-c++
.PHONY: check-gcc-fortran check-fortran
check-gcc-fortran:
check-gcc-fortran: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62225,7 +62233,7 @@ check-gcc-fortran:
check-fortran: check-gcc-fortran check-target-libquadmath check-target-libgfortran check-target-libgomp-fortran
.PHONY: check-gcc-ada check-ada
check-gcc-ada:
check-gcc-ada: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62233,7 +62241,7 @@ check-gcc-ada:
check-ada: check-gcc-ada check-target-libada
.PHONY: check-gcc-objc check-objc
check-gcc-objc:
check-gcc-objc: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62241,7 +62249,7 @@ check-gcc-objc:
check-objc: check-gcc-objc check-target-libobjc
.PHONY: check-gcc-obj-c++ check-obj-c++
check-gcc-obj-c++:
check-gcc-obj-c++: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62249,7 +62257,7 @@ check-gcc-obj-c++:
check-obj-c++: check-gcc-obj-c++
.PHONY: check-gcc-go check-go
check-gcc-go:
check-gcc-go: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62257,7 +62265,7 @@ check-gcc-go:
check-go: check-gcc-go check-target-libgo check-gotools
.PHONY: check-gcc-m2 check-m2
check-gcc-m2:
check-gcc-m2: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62265,7 +62273,7 @@ check-gcc-m2:
check-m2: check-gcc-m2 check-target-libgm2
.PHONY: check-gcc-d check-d
check-gcc-d:
check-gcc-d: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62273,7 +62281,7 @@ check-gcc-d:
check-d: check-gcc-d check-target-libphobos
.PHONY: check-gcc-jit check-jit
check-gcc-jit:
check-gcc-jit: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
@ -62281,7 +62289,7 @@ check-gcc-jit:
check-jit: check-gcc-jit
.PHONY: check-gcc-rust check-rust
check-gcc-rust:
check-gcc-rust: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \

View File

@ -1639,9 +1639,17 @@ cross: all-build all-gas all-ld
@endif gcc-no-bootstrap
@if gcc
.PHONY: gcc-site.exp
gcc-site.exp:
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) site.exp);
[+ FOR languages +]
.PHONY: check-gcc-[+language+] check-[+language+]
check-gcc-[+language+]:
check-gcc-[+language+]: gcc-site.exp
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \