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>
.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)
$(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)
-$(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