From 8a9f7e9e336cede20ec7da6bebc0f81a86ab79db Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sat, 23 Dec 2023 18:30:27 +1000 Subject: [PATCH] Makefile: always run any clean targets before starting any build Should fix occasional failures in Xonotic build system which specifies multiple targets including clean and enables parallel jobs. Signed-off-by: bones_was_here --- makefile.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/makefile.inc b/makefile.inc index d68421fe..b24ab2be 100644 --- a/makefile.inc +++ b/makefile.inc @@ -490,6 +490,7 @@ nexuiz.o: %.o : %.rc .c.o: $(CHECKLEVEL2) $(DO_CC) +.c.o: .EXTRA_PREREQS = # According to POSIX, a suffix rule cannot contain prerequisites. $(EXE_SV): $(OBJ_SV) $(OBJ_ICON) $(CHECKLEVEL2) @@ -507,6 +508,10 @@ $(EXE_SDLNEXUIZ): $(OBJ_SDL) $(OBJ_ICON_NEXUIZ) $(CHECKLEVEL2) $(DO_LD) +# If requested, these targets must always run first: +.EXTRA_PREREQS := $(filter clean clean-profile, $(MAKECMDGOALS)) +.NOTPARALLEL: $(.EXTRA_PREREQS) + clean: -$(CMD_RM) $(EXE_SV) -$(CMD_RM) $(EXE_SDL) @@ -516,6 +521,7 @@ clean: -$(CMD_RM) *.d -$(CMD_RM) *.gch -$(CMD_RM) build-obj/ +clean: .EXTRA_PREREQS = # prevents circular dependency with clean-profile clean-profile: clean -$(CMD_RM) *.gcda -- 2.39.2