From 7017914b51848136971f8337765e5051b5602327 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 3 Dec 2018 17:30:56 +0100 Subject: [PATCH] Remove concurrency If compiling with more than one task running at once, there could be a concurrency on $(DEPSDIR)/tmp.d Fixed that by making the temporary name unique using the target's name. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2a91c52..fcf31f4 100644 --- a/Makefile +++ b/Makefile @@ -70,10 +70,10 @@ $(DEPSDIR)/%.d: $(SRCDIR)/%.asm dummy @set -e @# Generate dependency file (side effect: also compiles!) @# Output to a different file to not overwrite the old one on compilation failure (Make would think the compilation succeeded the next time) - $(RGBASM) -M $(@D)/tmp.d $(ASFLAGS) -o $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$<) $< + $(RGBASM) -M $@.tmp $(ASFLAGS) -o $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$<) $< @# Add all obj dependencies to the deps file too, so Make knows to remake it - @sed 's,\($*\)\.o[ :]*,\1.o $@: ,g' < $(DEPSDIR)/tmp.d > $@ - @rm $(DEPSDIR)/tmp.d + @sed 's,\($*\)\.o[ :]*,\1.o $@: ,g' < $@.tmp > $@ + @rm $@.tmp # Include (and potentially remake) all dependency files include $(patsubst $(SRCDIR)/%.asm,$(DEPSDIR)/%.d,$(ASMFILES))