From cc40305a121246116d5e08037e94942a9c0ec1fb Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 25 Dec 2020 02:10:43 +0100 Subject: [PATCH] Fix errors with parallel make seen when doing 'make -j i386-tcc tcc', as explained in the comment. --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4058fef2..d41b81a2 100644 --- a/Makefile +++ b/Makefile @@ -236,7 +236,13 @@ tcc$(EXESUF): tcc.o $(LIBTCC) $S$(CC) -o $@ $^ $(LIBS) $(LDFLAGS) $(LINK_LIBTCC) # Cross Tiny C Compilers -%-tcc$(EXESUF): FORCE +# (the TCCDEFS_H dependency is only necessary for parallel makes, +# ala 'make -j x86_64-tcc i386-tcc tcc', which would create multiple +# c2str.exe and tccdefs_.h files in parallel, leading to access errors. +# This forces it to be made only once. Make normally tracks multiple paths +# to the same goals and only remakes it once, but that doesn't work over +# sub-makes like in this target) +%-tcc$(EXESUF): $(TCCDEFS_H) FORCE @$(MAKE) --no-print-directory $@ CROSS_TARGET=$* ONE_SOURCE=$(or $(ONE_SOURCE),yes) $(CROSS_TARGET)-tcc$(EXESUF): $(TCC_FILES)