diff --git a/Makefile.include b/Makefile.include index 4b05fb9d19fd64bbee350bf957410c3cdbc5e0a7..c943b5d1f146c35a041263f1a774c767662c5262 100644 --- a/Makefile.include +++ b/Makefile.include @@ -107,6 +107,11 @@ USEMODULE_INCLUDES_ = $(shell echo $(USEMODULE_INCLUDES) | tr ' ' '\n' | awk '!a INCLUDES += $(USEMODULE_INCLUDES_:%=-I%) +# The `clean` needs to be serialized before everything else. +ifneq (, $(filter clean, $(MAKECMDGOALS))) + $(OBJ) $(BASELIBS) $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include): clean +endif + # include Makefile.includes for packages in $(USEPKG) $(RIOTBASE)/pkg/%/Makefile.include:: $(AD)"$(MAKE)" -C $(RIOTBASE)/pkg/$* Makefile.include