]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Makefile: always run any clean targets before starting any build
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 23 Dec 2023 08:30:27 +0000 (18:30 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 23 Dec 2023 08:40:39 +0000 (18:40 +1000)
Should fix occasional failures in Xonotic build system which specifies
multiple targets including clean and enables parallel jobs.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
makefile.inc

index d68421fe009315bf00085899a8cdcf2bfcc696d9..b24ab2be4befe670240db0b81db132cf3172b134 100644 (file)
@@ -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