diff --git a/Makefile b/Makefile index 3a9b4a17f19d..1b42326e3b4e 100644 --- a/Makefile +++ b/Makefile @@ -117,9 +117,10 @@ ifneq ($(KBUILD_OUTPUT),) # Invoke a second make in the output directory, passing relevant variables # check that the output directory actually exists saved-output := $(KBUILD_OUTPUT) -KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) +KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ + && /bin/pwd) $(if $(KBUILD_OUTPUT),, \ - $(error output directory "$(saved-output)" does not exist)) + $(error failed to create output directory "$(saved-output)")) PHONY += $(MAKECMDGOALS) sub-make