Fix parallel build race with dep/ directory

Pattern rules that move .d files into dep/ do not depend on the dep
directory target, so parallel make can attempt the move before the
directory exists.

Add dep as an order-only prerequisite to all affected pattern rules.

Bug: https://bugs.gentoo.org/880921
Bug: https://bugs.gentoo.org/911647
Bug: https://bugs.gentoo.org/917344
Closes: https://github.com/steveicarus/iverilog/issues/1314
Signed-off-by: Huang Rui <vowstar@gmail.com>
This commit is contained in:
Huang Rui 2026-03-27 11:22:05 +08:00
parent 6767a07956
commit ac3ef217c3
3 changed files with 5 additions and 5 deletions

View File

@ -252,7 +252,7 @@ endif
version.exe: $(srcdir)/version.c $(srcdir)/version_base.h version_tag.h
$(BUILDCC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o version.exe -I. -I$(srcdir) $(srcdir)/version.c
%.o: %.cc config.h
%.o: %.cc config.h | dep
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
mv $*.d dep/$*.d

View File

@ -104,11 +104,11 @@ dep:
vhdlpp@EXEEXT@: $O
$(CXX) -o vhdlpp@EXEEXT@ $(LDFLAGS) $O $(LIBS)
%.o: $(srcdir)/../libmisc/%.cc
%.o: $(srcdir)/../libmisc/%.cc | dep
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
mv $*.d dep/$*.d
%.o: %.cc vhdlpp_config.h
%.o: %.cc vhdlpp_config.h | dep
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
mv $*.d dep/$*.d

View File

@ -159,11 +159,11 @@ vvp@EXEEXT@: $O main.o
endif
endif
%.o: %.cc config.h
%.o: %.cc config.h | dep
$(CXX) $(CPPFLAGS) -DIVL_SUFFIX='"$(suffix)"' $(MDIR1) $(MDIR2) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
mv $*.d dep/$*.d
%.o: %.c config.h
%.o: %.c config.h | dep
$(CC) $(CPPFLAGS) $(MDIR1) $(MDIR2) $(CFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
mv $*.d dep/$*.d