diff --git a/Makefile b/Makefile index 2738966e1d3786b9d602b087efe998fee6f7636e..1b0d84d4961281acacbcd85caec8180878c97f3e 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,9 @@ saved-output := $(KBUILD_OUTPUT) KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) $(if $(KBUILD_OUTPUT),, \ $(error output directory "$(saved-output)" does not exist)) - +# Check that OUTPUT directory is not the same as where we have kernel src +$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \ + $(error Output directory (O=...) specifies kernel src dir)) PHONY += $(MAKECMDGOALS) $(filter-out _all,$(MAKECMDGOALS)) _all: