From ea581c96b928c23f8c88617b4590c63779a52d91 Mon Sep 17 00:00:00 2001 From: Maria Glushenok Date: Wed, 4 Jun 2025 23:15:10 +0300 Subject: [PATCH] Validate BIND_DIR variable in Makefile Signed-off-by: Maria Glushenok --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 43fb18b939..47db5b2c97 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ build: shell_target := --target=dev-base else build: shell_target := --target=dev endif -build: bundles +build: validate-bind-dir bundles $(BUILD_CMD) $(BUILD_OPTS) $(shell_target) --load -t "$(DOCKER_IMAGE)" . .PHONY: shell @@ -284,3 +284,10 @@ generate-files: --file "./hack/dockerfiles/generate-files.Dockerfile" . cp -R "$($@_TMP_OUT)"/. . rm -rf "$($@_TMP_OUT)"/* + +.PHONY: validate-bind-dir +validate-bind-dir: + @case "$(BIND_DIR)" in \ + ".."*|"/"*) echo "Make needs to be run from the project-root directory, with BIND_DIR set to \".\" or a subdir"; \ + exit 1 ;; \ + esac