From: bones_was_here Date: Sat, 23 Dec 2023 08:30:27 +0000 (+1000) Subject: Makefile: always run any clean targets before starting any build X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8a9f7e9e336cede20ec7da6bebc0f81a86ab79db;p=xonotic%2Fdarkplaces.git 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 --- 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