From 8e6e900098f3f6964fc2ac306dbc316f70616114 Mon Sep 17 00:00:00 2001 From: Benjamin Demaille Date: Fri, 26 Jun 2026 14:31:05 +0200 Subject: [PATCH] fix(build): avoid parallel-make race on generated parametersDefault.xxd (#2672) parametersDefault.xxd is generated by 'xxd -i parametersDefault' and #include'd by Parameters.cpp and STAR.cpp. Under 'make -jN' those two objects could be compiled before xxd had produced the header, causing intermittent build failures. Add an order-only prerequisite '$(OBJECTS): | parametersDefault.xxd' so the header is always generated before any object is compiled. Order-only avoids forcing a full rebuild when only the header timestamp changes; the real content dependency for Parameters.o/STAR.o is still supplied by Depend.list. Also gitignore the generated source/parametersDefault.xxd build artifact. Verified with a clean 'make STARforMac -j16' build. Co-Authored-By: Claude Opus 4.8 --- .gitignore | 3 +++ source/Makefile | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index cc7e5064..5917fefa 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,9 @@ extras/doc-latex/*.toc # Don't track the STAR binary once it has being built source/STAR + +# Generated by `xxd -i parametersDefault` during the build +source/parametersDefault.xxd .DS_Store *.xcworkspacedata *.pbxproj diff --git a/source/Makefile b/source/Makefile index a6b5fcb3..30ccb8dc 100644 --- a/source/Makefile +++ b/source/Makefile @@ -151,6 +151,15 @@ htslib/libhts.a : parametersDefault.xxd: parametersDefault xxd -i parametersDefault > parametersDefault.xxd +# parametersDefault.xxd is a generated header #include'd by Parameters.cpp and +# STAR.cpp. Under parallel builds (make -jN) those objects could be compiled +# before xxd had generated the header, causing intermittent build failures +# (issue #2672). Order-only (|) prerequisite guarantees the header is generated +# before any object is compiled, while not forcing a full rebuild when only its +# timestamp changes; the real content dependency for Parameters.o/STAR.o is +# still provided by Depend.list. +$(OBJECTS): | parametersDefault.xxd + STAR$(SFX) : CXXFLAGS := $(CXXFLAGSextra) $(CXXFLAGS_main) $(CXXFLAGS) STAR$(SFX) : LDFLAGS := $(LDFLAGSextra) $(LDFLAGS_shared) $(LDFLAGS) STAR$(SFX) : Depend.list parametersDefault.xxd $(OBJECTS)